mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-01 01:41:01 -08:00
(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.
This commit is contained in:
parent
d2d846a3d1
commit
cef13e5501
1 changed files with 9 additions and 9 deletions
18
src/xterm.c
18
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue