From 921533747756aab4493b905fdd6c0f0af8c09b60 Mon Sep 17 00:00:00 2001 From: handa Date: Fri, 18 Feb 2005 02:00:57 +0000 Subject: [PATCH] (error_message): Allocate it statically. (otf__error): Don't allocate error_message dynamically. (OTF_perror): Adjust for the above changes. --- src/otferror.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/otferror.c b/src/otferror.c index a631c9b..36093fd 100644 --- a/src/otferror.c +++ b/src/otferror.c @@ -28,7 +28,7 @@ write to the Free Software Foundation, Inc., 59 Temple Place, Suite #include "otf.h" -static char *error_message; +static char error_message[1024]; int OTF_error; static char *error_string[] = @@ -46,8 +46,6 @@ static char *error_string[] = int otf__error (int err, char *fmt, void *arg) { - if (! error_message) - error_message = (char *) malloc (1024); sprintf (error_message, "OTF-Error (%s): ", error_string[err]); sprintf (error_message + strlen (error_message), fmt, arg); OTF_error = err; @@ -58,7 +56,7 @@ void OTF_perror (char *prefix) { if (OTF_error == 0) - error_message = error_string[0]; + sprintf (error_message, "%s", error_string[0]); if (prefix) fprintf (stderr, "%s: %s\n", prefix, error_message); else -- 1.7.10.4