diff options
| author | Richard M. Stallman | 1993-06-07 23:52:45 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-06-07 23:52:45 +0000 |
| commit | cef13e5501f7033a96df8045a1fcbeabc7f889c0 (patch) | |
| tree | 82bbf4a4440fc670bb86c309c72b9c194a5e46af /src/xterm.c | |
| parent | d2d846a3d1fcf81ebd45aaf3e44dada86744fc91 (diff) | |
| download | emacs-cef13e5501f7033a96df8045a1fcbeabc7f889c0.tar.gz emacs-cef13e5501f7033a96df8045a1fcbeabc7f889c0.zip | |
(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) | |||
| 3801 | } | 3801 | } |
| 3802 | 3802 | ||
| 3803 | /* A buffer for storing X error messages. */ | 3803 | /* A buffer for storing X error messages. */ |
| 3804 | static char (*x_caught_error_message)[200]; | 3804 | static char *x_caught_error_message; |
| 3805 | #define X_CAUGHT_ERROR_MESSAGE_SIZE 200 | ||
| 3805 | 3806 | ||
| 3806 | /* An X error handler which stores the error message in | 3807 | /* An X error handler which stores the error message in |
| 3807 | x_caught_error_message. This is what's installed when | 3808 | x_caught_error_message. This is what's installed when |
| @@ -3812,7 +3813,7 @@ x_error_catcher (display, error) | |||
| 3812 | XErrorEvent *error; | 3813 | XErrorEvent *error; |
| 3813 | { | 3814 | { |
| 3814 | XGetErrorText (display, error->error_code, | 3815 | XGetErrorText (display, error->error_code, |
| 3815 | *x_caught_error_message, sizeof (*x_caught_error_message)); | 3816 | x_caught_error_message, X_CAUGHT_ERROR_MESSAGE_SIZE); |
| 3816 | } | 3817 | } |
| 3817 | 3818 | ||
| 3818 | 3819 | ||
| @@ -3836,8 +3837,8 @@ x_catch_errors () | |||
| 3836 | 3837 | ||
| 3837 | /* Set up the error buffer. */ | 3838 | /* Set up the error buffer. */ |
| 3838 | x_caught_error_message | 3839 | x_caught_error_message |
| 3839 | = (char (*)[200]) xmalloc (sizeof (*x_caught_error_message)); | 3840 | = (char*) xmalloc (X_CAUGHT_ERROR_MESSAGE_SIZE); |
| 3840 | (*x_caught_error_message)[0] = '\0'; | 3841 | x_caught_error_message[0] = '\0'; |
| 3841 | 3842 | ||
| 3842 | /* Install our little error handler. */ | 3843 | /* Install our little error handler. */ |
| 3843 | XHandleError (x_error_catcher); | 3844 | XHandleError (x_error_catcher); |
| @@ -3853,13 +3854,11 @@ x_check_errors (format) | |||
| 3853 | /* Make sure to catch any errors incurred so far. */ | 3854 | /* Make sure to catch any errors incurred so far. */ |
| 3854 | XSync (x_current_display, False); | 3855 | XSync (x_current_display, False); |
| 3855 | 3856 | ||
| 3856 | if ((*x_caught_error_message)[0]) | 3857 | if (x_caught_error_message[0]) |
| 3857 | { | 3858 | { |
| 3858 | char buf[256]; | 3859 | char buf[X_CAUGHT_ERROR_MESSAGE_SIZE + 56]; |
| 3859 | |||
| 3860 | sprintf (buf, format, *x_caught_error_message); | ||
| 3861 | xfree (x_caught_error_message); | ||
| 3862 | 3860 | ||
| 3861 | sprintf (buf, format, x_caught_error_message); | ||
| 3863 | x_uncatch_errors (); | 3862 | x_uncatch_errors (); |
| 3864 | error (buf); | 3863 | error (buf); |
| 3865 | } | 3864 | } |
| @@ -3869,6 +3868,7 @@ void | |||
| 3869 | x_uncatch_errors () | 3868 | x_uncatch_errors () |
| 3870 | { | 3869 | { |
| 3871 | xfree (x_caught_error_message); | 3870 | xfree (x_caught_error_message); |
| 3871 | x_caught_error_message = 0; | ||
| 3872 | XHandleError (x_error_quitter); | 3872 | XHandleError (x_error_quitter); |
| 3873 | } | 3873 | } |
| 3874 | 3874 | ||