diff options
author | Richard M. Stallman <rms@gnu.org> | 1993-06-07 23:52:45 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1993-06-07 23:52:45 +0000 |
commit | cef13e5501f7033a96df8045a1fcbeabc7f889c0 (patch) | |
tree | 82bbf4a4440fc670bb86c309c72b9c194a5e46af /src/xterm.c | |
parent | d2d846a3d1fcf81ebd45aaf3e44dada86744fc91 (diff) | |
download | emacs-cef13e5501f7033a96df8045a1fcbeabc7f889c0.tar.gz |
(x_caught_error_message): Change type to char* from char*[].
(X_CAUGHT_ERROR_MESSAGE_SIZE): New macro.
(x_error_catcher): Corresponding changes.
(x_catch_errors): Corresponding changes.
(x_check_errors): Do not free x_caught_error_message.
(x_uncatch_errors): Set x_caught_error_message to 0 after freeing it.
Diffstat (limited to 'src/xterm.c')
-rw-r--r-- | src/xterm.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/xterm.c b/src/xterm.c index fc1b995e1a3..d0ec3093334 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -3801,7 +3801,8 @@ x_io_error_quitter (display) } /* A buffer for storing X error messages. */ -static char (*x_caught_error_message)[200]; +static char *x_caught_error_message; +#define X_CAUGHT_ERROR_MESSAGE_SIZE 200 /* An X error handler which stores the error message in x_caught_error_message. This is what's installed when @@ -3812,7 +3813,7 @@ x_error_catcher (display, error) XErrorEvent *error; { XGetErrorText (display, error->error_code, - *x_caught_error_message, sizeof (*x_caught_error_message)); + x_caught_error_message, X_CAUGHT_ERROR_MESSAGE_SIZE); } @@ -3836,8 +3837,8 @@ x_catch_errors () /* Set up the error buffer. */ x_caught_error_message - = (char (*)[200]) xmalloc (sizeof (*x_caught_error_message)); - (*x_caught_error_message)[0] = '\0'; + = (char*) xmalloc (X_CAUGHT_ERROR_MESSAGE_SIZE); + x_caught_error_message[0] = '\0'; /* Install our little error handler. */ XHandleError (x_error_catcher); @@ -3853,13 +3854,11 @@ x_check_errors (format) /* Make sure to catch any errors incurred so far. */ XSync (x_current_display, False); - if ((*x_caught_error_message)[0]) + if (x_caught_error_message[0]) { - char buf[256]; - - sprintf (buf, format, *x_caught_error_message); - xfree (x_caught_error_message); + char buf[X_CAUGHT_ERROR_MESSAGE_SIZE + 56]; + sprintf (buf, format, x_caught_error_message); x_uncatch_errors (); error (buf); } @@ -3869,6 +3868,7 @@ void x_uncatch_errors () { xfree (x_caught_error_message); + x_caught_error_message = 0; XHandleError (x_error_quitter); } |