"Daniel Pittman" <daniel(a)danann.net> writes:
make[1]: Entering directory `/usr/src/xemacs/src'
gcc -c -g -O3 -Wall -Wno-switch -Wpointer-arith -Winline -Wmissing-prototypes -Wshadow
-Demacs -I. -DHAVE_CONFIG_H -I/usr/X11R6/include print.c
print.c: In function `std_handle_out_va':
print.c:173: warning: `extlen' might be used uninitialized in this function
Oops gcc is right. Please use this patch at end instead. This at least
compiles without warnings
Index: print.c
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs-20/src/print.c,v
retrieving revision 1.27.2.17
diff -u -r1.27.2.17 print.c
--- print.c 2000/03/13 10:04:29 1.27.2.17
+++ print.c 2000/05/11 10:05:37
@@ -166,23 +166,44 @@
msw_output_console_string(). */
static int
-std_handle_out_va (FILE *stream, const char *fmt, va_list args)
+std_handle_out_va (FILE *stream, int recode, const char *fmt, va_list args)
{
Bufbyte kludge[8192];
Extbyte *extptr;
Extcount extlen;
int retval;
+#ifdef HAVE_VSNPRINTF
+ retval = vsnprintf ((char *) kludge, 8191, fmt, args);
+#else
retval = vsprintf ((char *) kludge, fmt, args);
- TO_EXTERNAL_FORMAT (DATA, (kludge, strlen ((char *) kludge)),
+#endif
+ kludge[8191] = 0;
+ if (recode)
+ {
+ TO_EXTERNAL_FORMAT (DATA, (kludge, strlen ((char *) kludge)),
ALLOCA, (extptr, extlen),
Qnative);
+ }
+ else
+ {
+ /* We are not doing the proper thing because we might be in
+ the middle of a crash, so we cast and pray. */
+
+ extptr = (Extbyte *) kludge;
+ extlen = strlen((char *) kludge);
+ }
+
std_handle_out_external (stream, Qnil, extptr, extlen, 1, 1);
return retval;
}
/* Output portably to stderr or its equivalent; call GETTEXT on the
- format string. Automatically flush when done. */
+ format string. Automatically flush when done.
+
+ We do not call std_handle_va because that tries to do code conversion
+ which is not a good idea in the middle of a crash
+*/
int
stderr_out (const char *fmt, ...)
@@ -190,7 +211,7 @@
int retval;
va_list args;
va_start (args, fmt);
- retval = std_handle_out_va (stderr, GETTEXT (fmt), args);
+ retval = std_handle_out_va (stderr, 0, GETTEXT (fmt), args);
va_end (args);
return retval;
}
@@ -204,7 +225,7 @@
int retval;
va_list args;
va_start (args, fmt);
- retval = std_handle_out_va (stdout, GETTEXT (fmt), args);
+ retval = std_handle_out_va (stdout, 1 , GETTEXT (fmt), args);
va_end (args);
return retval;
}
@@ -216,7 +237,7 @@
va_start (args, fmt);
stderr_out ("\nXEmacs: ");
- std_handle_out_va (stderr, GETTEXT (fmt), args);
+ std_handle_out_va (stderr, 0, GETTEXT (fmt), args);
stderr_out ("\n");
va_end (args);