Now on revision 108743. ------------------------------------------------------------ revno: 108743 committer: Dmitry Antipov branch nick: trunk timestamp: Tue 2012-06-26 09:40:33 +0400 message: * term.c (delete_tty): Remove redundant call to memset. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-06-26 05:00:30 +0000 +++ src/ChangeLog 2012-06-26 05:40:33 +0000 @@ -1,5 +1,9 @@ 2012-06-26 Dmitry Antipov + * term.c (delete_tty): Remove redundant call to memset. + +2012-06-26 Dmitry Antipov + * alloc.c: Remove build_string. * lisp.h: Define build_string as static inline. This provides a better opportunity to optimize away calls to strlen when the === modified file 'src/term.c' --- src/term.c 2012-06-26 02:33:51 +0000 +++ src/term.c 2012-06-26 05:40:33 +0000 @@ -3605,7 +3605,6 @@ xfree (tty->termcap_strings_buffer); xfree (tty->termcap_term_buffer); - memset (tty, 0, sizeof (struct tty_display_info)); xfree (tty); } ------------------------------------------------------------ revno: 108742 committer: Dmitry Antipov branch nick: trunk timestamp: Tue 2012-06-26 09:00:30 +0400 message: * src/alloc.c: Remove build_string. * src/lisp.h: Define build_string as static inline. This provides a better opportunity to optimize away calls to strlen when the function is called with compile-time constant argument. * src/image.c (imagemagick_error): Convert to build_string. * src/w32proc.c (sys_spawnve): Likewise. * src/xterm.c (x_term_init): Likewise. * admin/coccinelle/build_string.cocci: Semantic patch to convert from make_string to build_string. diff: === modified file 'admin/ChangeLog' --- admin/ChangeLog 2012-06-24 16:18:41 +0000 +++ admin/ChangeLog 2012-06-26 05:00:30 +0000 @@ -1,3 +1,8 @@ +2012-06-26 Dmitry Antipov + + * coccinelle/build_string.cocci: Semantic patch + to convert from make_string to build_string. + 2012-06-24 Dmitry Antipov First Coccinelle semantic patch. === added file 'admin/coccinelle/build_string.cocci' --- admin/coccinelle/build_string.cocci 1970-01-01 00:00:00 +0000 +++ admin/coccinelle/build_string.cocci 2012-06-26 05:00:30 +0000 @@ -0,0 +1,6 @@ +// Convert simple cases to build_string. +@@ +identifier I; +@@ +- make_string (I, strlen (I)) ++ build_string (I) === modified file 'src/ChangeLog' --- src/ChangeLog 2012-06-26 02:33:51 +0000 +++ src/ChangeLog 2012-06-26 05:00:30 +0000 @@ -1,3 +1,13 @@ +2012-06-26 Dmitry Antipov + + * alloc.c: Remove build_string. + * lisp.h: Define build_string as static inline. This provides + a better opportunity to optimize away calls to strlen when the + function is called with compile-time constant argument. + * image.c (imagemagick_error): Convert to build_string. + * w32proc.c (sys_spawnve): Likewise. + * xterm.c (x_term_init): Likewise. + 2012-06-26 Paul Eggert Use sprintf return value instead of invoking strlen on result. === modified file 'src/alloc.c' --- src/alloc.c 2012-06-22 21:17:42 +0000 +++ src/alloc.c 2012-06-26 05:00:30 +0000 @@ -2496,16 +2496,6 @@ } -/* Make a string from the data at STR, treating it as multibyte if the - data warrants. */ - -Lisp_Object -build_string (const char *str) -{ - return make_string (str, strlen (str)); -} - - /* Return an unibyte Lisp_String set up to hold LENGTH characters occupying LENGTH bytes. */ === modified file 'src/image.c' --- src/image.c 2012-06-24 17:39:14 +0000 +++ src/image.c 2012-06-26 05:00:30 +0000 @@ -7570,7 +7570,7 @@ description = MagickGetException (wand, &severity); image_error ("ImageMagick error: %s", - make_string (description, strlen (description)), + build_string (description), Qnil); description = (char *) MagickRelinquishMemory (description); } === modified file 'src/lisp.h' --- src/lisp.h 2012-06-26 02:33:51 +0000 +++ src/lisp.h 2012-06-26 05:00:30 +0000 @@ -2700,7 +2700,6 @@ EXFUN (Fmake_marker, 0); extern _Noreturn void string_overflow (void); EXFUN (Fmake_string, 2); -extern Lisp_Object build_string (const char *); extern Lisp_Object make_string (const char *, ptrdiff_t); extern Lisp_Object make_unibyte_string (const char *, ptrdiff_t); extern Lisp_Object make_multibyte_string (const char *, ptrdiff_t, ptrdiff_t); @@ -2713,6 +2712,16 @@ EXFUN (Fpurecopy, 1); extern Lisp_Object make_pure_string (const char *, ptrdiff_t, ptrdiff_t, int); extern Lisp_Object make_pure_c_string (const char *data); + +/* Make a string from the data at STR, treating it as multibyte if the + data warrants. */ + +static inline Lisp_Object +build_string (const char *str) +{ + return make_string (str, strlen (str)); +} + extern Lisp_Object pure_cons (Lisp_Object, Lisp_Object); EXFUN (Fgarbage_collect, 0); extern void make_byte_code (struct Lisp_Vector *); === modified file 'src/w32proc.c' --- src/w32proc.c 2012-06-23 12:44:42 +0000 +++ src/w32proc.c 2012-06-26 05:00:30 +0000 @@ -777,7 +777,7 @@ } /* Handle executable names without an executable suffix. */ - program = make_string (cmdname, strlen (cmdname)); + program = build_string (cmdname); if (NILP (Ffile_executable_p (program))) { struct gcpro gcpro1; === modified file 'src/xterm.c' --- src/xterm.c 2012-06-24 23:14:39 +0000 +++ src/xterm.c 2012-06-26 05:00:30 +0000 @@ -10036,7 +10036,7 @@ const char *file = "~/.emacs.d/gtkrc"; Lisp_Object s, abs_file; - s = make_string (file, strlen (file)); + s = build_string (file); abs_file = Fexpand_file_name (s, Qnil); if (! NILP (abs_file) && !NILP (Ffile_readable_p (abs_file))) ------------------------------------------------------------ revno: 108741 committer: Paul Eggert branch nick: trunk timestamp: Mon 2012-06-25 19:33:51 -0700 message: Use sprintf return value instead of invoking strlen on result. In the old days this wasn't portable, since some sprintf implementations returned char *. But they died out years ago and Emacs already assumes sprintf returns int. Similarly for float_to_string. This patch speeds up (number-to-string 1000) by 3% on Fedora 15 x86-64. * ccl.c (ccl_driver): * character.c (string_escape_byte8): * data.c (Fnumber_to_string): * doprnt.c (doprnt): * print.c (print_object): * xdisp.c (message_dolog): * xfns.c (syms_of_xfns): Use sprintf or float_to_string result to avoid need to call strlen. * data.c (Fnumber_to_string): Use make_unibyte_string, since the string must be ASCII. * lisp.h, print.c (float_to_string): Now returns int length. * term.c (produce_glyphless_glyph): Use sprintf result rather than recomputing it. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-06-26 01:05:39 +0000 +++ src/ChangeLog 2012-06-26 02:33:51 +0000 @@ -1,5 +1,25 @@ 2012-06-26 Paul Eggert + Use sprintf return value instead of invoking strlen on result. + In the old days this wasn't portable, since some sprintf + implementations returned char *. But they died out years ago and + Emacs already assumes sprintf returns int. + Similarly for float_to_string. + This patch speeds up (number-to-string 1000) by 3% on Fedora 15 x86-64. + * ccl.c (ccl_driver): + * character.c (string_escape_byte8): + * data.c (Fnumber_to_string): + * doprnt.c (doprnt): + * print.c (print_object): + * xdisp.c (message_dolog): + * xfns.c (syms_of_xfns): + Use sprintf or float_to_string result to avoid need to call strlen. + * data.c (Fnumber_to_string): + Use make_unibyte_string, since the string must be ASCII. + * lisp.h, print.c (float_to_string): Now returns int length. + * term.c (produce_glyphless_glyph): + Use sprintf result rather than recomputing it. + Clean out last vestiges of the old HAVE_CONFIG_H stuff. * Makefile.in (ALL_CFLAGS): * makefile.w32-in (LOCAL_FLAGS): Remove -DHAVE_CONFIG_H. === modified file 'src/ccl.c' --- src/ccl.c 2012-06-19 16:56:28 +0000 +++ src/ccl.c 2012-06-26 02:33:51 +0000 @@ -1729,14 +1729,14 @@ switch (ccl->status) { case CCL_STAT_INVALID_CMD: - sprintf (msg, "\nCCL: Invalid command %x (ccl_code = %x) at %d.", - code & 0x1F, code, this_ic); + msglen = sprintf (msg, + "\nCCL: Invalid command %x (ccl_code = %x) at %d.", + code & 0x1F, code, this_ic); #ifdef CCL_DEBUG { int i = ccl_backtrace_idx - 1; int j; - msglen = strlen (msg); if (dst + msglen <= (dst_bytes ? dst_end : src)) { memcpy (dst, msg, msglen); @@ -1748,8 +1748,7 @@ if (i < 0) i = CCL_DEBUG_BACKTRACE_LEN - 1; if (ccl_backtrace_table[i] == 0) break; - sprintf (msg, " %d", ccl_backtrace_table[i]); - msglen = strlen (msg); + msglen = sprintf (msg, " %d", ccl_backtrace_table[i]); if (dst + msglen > (dst_bytes ? dst_end : src)) break; memcpy (dst, msg, msglen); @@ -1761,15 +1760,13 @@ break; case CCL_STAT_QUIT: - if (! ccl->quit_silently) - sprintf (msg, "\nCCL: Quitted."); + msglen = ccl->quit_silently ? 0 : sprintf (msg, "\nCCL: Quitted."); break; default: - sprintf (msg, "\nCCL: Unknown error type (%d)", ccl->status); + msglen = sprintf (msg, "\nCCL: Unknown error type (%d)", ccl->status); } - msglen = strlen (msg); if (msglen <= dst_end - dst) { for (i = 0; i < msglen; i++) === modified file 'src/character.c' --- src/character.c 2012-06-16 12:24:15 +0000 +++ src/character.c 2012-06-26 02:33:51 +0000 @@ -867,8 +867,7 @@ { c = STRING_CHAR_ADVANCE (src); c = CHAR_TO_BYTE8 (c); - sprintf ((char *) dst, "\\%03o", c); - dst += 4; + dst += sprintf ((char *) dst, "\\%03o", c); } else while (len--) *dst++ = *src++; @@ -878,10 +877,7 @@ { c = *src++; if (c >= 0x80) - { - sprintf ((char *) dst, "\\%03o", c); - dst += 4; - } + dst += sprintf ((char *) dst, "\\%03o", c); else *dst++ = c; } === modified file 'src/data.c' --- src/data.c 2012-06-24 17:39:14 +0000 +++ src/data.c 2012-06-26 02:33:51 +0000 @@ -2449,20 +2449,17 @@ NUMBER may be an integer or a floating point number. */) (Lisp_Object number) { - char buffer[VALBITS]; + char buffer[max (FLOAT_TO_STRING_BUFSIZE, INT_BUFSIZE_BOUND (EMACS_INT))]; + int len; CHECK_NUMBER_OR_FLOAT (number); if (FLOATP (number)) - { - char pigbuf[FLOAT_TO_STRING_BUFSIZE]; - - float_to_string (pigbuf, XFLOAT_DATA (number)); - return build_string (pigbuf); - } - - sprintf (buffer, "%"pI"d", XINT (number)); - return build_string (buffer); + len = float_to_string (buffer, XFLOAT_DATA (number)); + else + len = sprintf (buffer, "%"pI"d", XINT (number)); + + return make_unibyte_string (buffer, len); } DEFUN ("string-to-number", Fstring_to_number, Sstring_to_number, 1, 2, 0, === modified file 'src/doprnt.c' --- src/doprnt.c 2012-06-07 05:11:51 +0000 +++ src/doprnt.c 2012-06-26 02:33:51 +0000 @@ -275,32 +275,32 @@ case no_modifier: { int v = va_arg (ap, int); - sprintf (sprintf_buffer, fmtcpy, v); + tem = sprintf (sprintf_buffer, fmtcpy, v); } break; case long_modifier: { long v = va_arg (ap, long); - sprintf (sprintf_buffer, fmtcpy, v); + tem = sprintf (sprintf_buffer, fmtcpy, v); } break; case pD_modifier: signed_pD_modifier: { ptrdiff_t v = va_arg (ap, ptrdiff_t); - sprintf (sprintf_buffer, fmtcpy, v); + tem = sprintf (sprintf_buffer, fmtcpy, v); } break; case pI_modifier: { EMACS_INT v = va_arg (ap, EMACS_INT); - sprintf (sprintf_buffer, fmtcpy, v); + tem = sprintf (sprintf_buffer, fmtcpy, v); } break; case pM_modifier: { intmax_t v = va_arg (ap, intmax_t); - sprintf (sprintf_buffer, fmtcpy, v); + tem = sprintf (sprintf_buffer, fmtcpy, v); } break; } @@ -315,13 +315,13 @@ case no_modifier: { unsigned v = va_arg (ap, unsigned); - sprintf (sprintf_buffer, fmtcpy, v); + tem = sprintf (sprintf_buffer, fmtcpy, v); } break; case long_modifier: { unsigned long v = va_arg (ap, unsigned long); - sprintf (sprintf_buffer, fmtcpy, v); + tem = sprintf (sprintf_buffer, fmtcpy, v); } break; case pD_modifier: @@ -329,13 +329,13 @@ case pI_modifier: { EMACS_UINT v = va_arg (ap, EMACS_UINT); - sprintf (sprintf_buffer, fmtcpy, v); + tem = sprintf (sprintf_buffer, fmtcpy, v); } break; case pM_modifier: { uintmax_t v = va_arg (ap, uintmax_t); - sprintf (sprintf_buffer, fmtcpy, v); + tem = sprintf (sprintf_buffer, fmtcpy, v); } break; } @@ -348,7 +348,7 @@ case 'g': { double d = va_arg (ap, double); - sprintf (sprintf_buffer, fmtcpy, d); + tem = sprintf (sprintf_buffer, fmtcpy, d); /* Now copy into final output, truncating as necessary. */ string = sprintf_buffer; goto doit; @@ -369,7 +369,6 @@ /* Copy string into final output, truncating if no room. */ doit: /* Coming here means STRING contains ASCII only. */ - tem = strlen (string); if (STRING_BYTES_BOUND < tem) error ("Format width or precision too large"); width = tem; @@ -413,8 +412,7 @@ bufsize = 0; continue; } - else - memcpy (bufptr, string, tem); + memcpy (bufptr, string, tem); bufptr += tem; bufsize -= tem; if (minlen < 0) === modified file 'src/lisp.h' --- src/lisp.h 2012-06-24 17:39:14 +0000 +++ src/lisp.h 2012-06-26 02:33:51 +0000 @@ -2797,7 +2797,7 @@ extern Lisp_Object internal_with_output_to_temp_buffer (const char *, Lisp_Object (*) (Lisp_Object), Lisp_Object); #define FLOAT_TO_STRING_BUFSIZE 350 -extern void float_to_string (char *, double); +extern int float_to_string (char *, double); extern void syms_of_print (void); /* Defined in doprnt.c */ === modified file 'src/print.c' --- src/print.c 2012-06-19 16:56:28 +0000 +++ src/print.c 2012-06-26 02:33:51 +0000 @@ -912,7 +912,7 @@ for (; CONSP (tail); tail = XCDR (tail), sep = ", ") { Lisp_Object obj; - + if (sep) write_string_1 (sep, 2, stream); obj = XCAR (tail); @@ -944,43 +944,49 @@ * Given the above, the buffer must be least FLOAT_TO_STRING_BUFSIZE bytes. */ -void +int float_to_string (char *buf, double data) { char *cp; int width; + int len; /* Check for plus infinity in a way that won't lose if there is no plus infinity. */ if (data == data / 2 && data > 1.0) { - strcpy (buf, "1.0e+INF"); - return; + static char const infinity_string[] = "1.0e+INF"; + strcpy (buf, infinity_string); + return sizeof infinity_string - 1; } /* Likewise for minus infinity. */ if (data == data / 2 && data < -1.0) { - strcpy (buf, "-1.0e+INF"); - return; + static char const minus_infinity_string[] = "-1.0e+INF"; + strcpy (buf, minus_infinity_string); + return sizeof minus_infinity_string - 1; } /* Check for NaN in a way that won't fail if there are no NaNs. */ if (! (data * 0.0 >= 0.0)) { /* Prepend "-" if the NaN's sign bit is negative. The sign bit of a double is the bit that is 1 in -0.0. */ + static char const NaN_string[] = "0.0e+NaN"; int i; union { double d; char c[sizeof (double)]; } u_data, u_minus_zero; + int negative = 0; u_data.d = data; u_minus_zero.d = - 0.0; for (i = 0; i < sizeof (double); i++) if (u_data.c[i] & u_minus_zero.c[i]) { - *buf++ = '-'; + *buf = '-'; + negative = 1; break; } - strcpy (buf, "0.0e+NaN"); - return; + strcpy (buf + negative, NaN_string); + return negative + sizeof NaN_string - 1; } if (NILP (Vfloat_output_format) @@ -989,7 +995,7 @@ { /* Generate the fewest number of digits that represent the floating point value without losing information. */ - dtoastr (buf, FLOAT_TO_STRING_BUFSIZE - 2, 0, 0, data); + len = dtoastr (buf, FLOAT_TO_STRING_BUFSIZE - 2, 0, 0, data); /* The decimal point must be printed, or the byte compiler can get confused (Bug#8033). */ width = 1; @@ -1032,7 +1038,7 @@ if (cp[1] != 0) goto lose; - sprintf (buf, SSDATA (Vfloat_output_format), data); + len = sprintf (buf, SSDATA (Vfloat_output_format), data); } /* Make sure there is a decimal point with digit after, or an @@ -1049,14 +1055,18 @@ { cp[1] = '0'; cp[2] = 0; + len++; } else if (*cp == 0) { *cp++ = '.'; *cp++ = '0'; *cp++ = 0; + len += 2; } } + + return len; } @@ -1332,8 +1342,8 @@ for (i = 0; i < print_depth; i++) if (EQ (obj, being_printed[i])) { - sprintf (buf, "#%d", i); - strout (buf, -1, -1, printcharfun); + int len = sprintf (buf, "#%d", i); + strout (buf, len, len, printcharfun); return; } being_printed[print_depth] = obj; @@ -1348,16 +1358,16 @@ if (n < 0) { /* Add a prefix #n= if OBJ has not yet been printed; that is, its status field is nil. */ - sprintf (buf, "#%"pI"d=", -n); - strout (buf, -1, -1, printcharfun); + int len = sprintf (buf, "#%"pI"d=", -n); + strout (buf, len, len, printcharfun); /* OBJ is going to be printed. Remember that fact. */ Fputhash (obj, make_number (- n), Vprint_number_table); } else { /* Just print #n# if OBJ has already been printed. */ - sprintf (buf, "#%"pI"d#", n); - strout (buf, -1, -1, printcharfun); + int len = sprintf (buf, "#%"pI"d#", n); + strout (buf, len, len, printcharfun); return; } } @@ -1368,16 +1378,17 @@ switch (XTYPE (obj)) { case_Lisp_Int: - sprintf (buf, "%"pI"d", XINT (obj)); - strout (buf, -1, -1, printcharfun); + { + int len = sprintf (buf, "%"pI"d", XINT (obj)); + strout (buf, len, len, printcharfun); + } break; case Lisp_Float: { char pigbuf[FLOAT_TO_STRING_BUFSIZE]; - - float_to_string (pigbuf, XFLOAT_DATA (obj)); - strout (pigbuf, -1, -1, printcharfun); + int len = float_to_string (pigbuf, XFLOAT_DATA (obj)); + strout (pigbuf, len, len, printcharfun); } break; @@ -1447,15 +1458,16 @@ when found in a multibyte string, always use a hex escape so it reads back as multibyte. */ char outbuf[50]; + int len; if (CHAR_BYTE8_P (c)) - sprintf (outbuf, "\\%03o", CHAR_TO_BYTE8 (c)); + len = sprintf (outbuf, "\\%03o", CHAR_TO_BYTE8 (c)); else { - sprintf (outbuf, "\\x%04x", c); + len = sprintf (outbuf, "\\x%04x", c); need_nonhex = 1; } - strout (outbuf, -1, -1, printcharfun); + strout (outbuf, len, len, printcharfun); } else if (! multibyte && SINGLE_BYTE_CHAR_P (c) && ! ASCII_BYTE_P (c) @@ -1466,8 +1478,8 @@ print single-byte non-ASCII string chars using octal escapes. */ char outbuf[5]; - sprintf (outbuf, "\\%03o", c); - strout (outbuf, -1, -1, printcharfun); + int len = sprintf (outbuf, "\\%03o", c); + strout (outbuf, len, len, printcharfun); } else { @@ -1632,8 +1644,8 @@ /* Simple but incomplete way. */ if (i != 0 && EQ (obj, halftail)) { - sprintf (buf, " . #%"pMd, i / 2); - strout (buf, -1, -1, printcharfun); + int len = sprintf (buf, " . #%"pMd, i / 2); + strout (buf, len, len, printcharfun); goto end_of_list; } } @@ -1697,7 +1709,8 @@ else if (BOOL_VECTOR_P (obj)) { ptrdiff_t i; - register unsigned char c; + int len; + unsigned char c; struct gcpro gcpro1; ptrdiff_t size_in_chars = ((XBOOL_VECTOR (obj)->size + BOOL_VECTOR_BITS_PER_CHAR - 1) @@ -1707,8 +1720,8 @@ PRINTCHAR ('#'); PRINTCHAR ('&'); - sprintf (buf, "%"pI"d", XBOOL_VECTOR (obj)->size); - strout (buf, -1, -1, printcharfun); + len = sprintf (buf, "%"pI"d", XBOOL_VECTOR (obj)->size); + strout (buf, len, len, printcharfun); PRINTCHAR ('\"'); /* Don't print more characters than the specified maximum. @@ -1759,9 +1772,11 @@ } else if (WINDOWP (obj)) { + int len; strout ("#sequence_number)); - strout (buf, -1, -1, printcharfun); + len = sprintf (buf, "%"pI"d", + XFASTINT (XWINDOW (obj)->sequence_number)); + strout (buf, len, len, printcharfun); if (!NILP (XWINDOW (obj)->buffer)) { strout (" on ", -1, -1, printcharfun); @@ -1771,10 +1786,11 @@ } else if (TERMINALP (obj)) { + int len; struct terminal *t = XTERMINAL (obj); strout ("#id); - strout (buf, -1, -1, printcharfun); + len = sprintf (buf, "%d", t->id); + strout (buf, len, len, printcharfun); if (t->name) { strout (" on ", -1, -1, printcharfun); @@ -1787,6 +1803,7 @@ struct Lisp_Hash_Table *h = XHASH_TABLE (obj); ptrdiff_t i; ptrdiff_t real_size, size; + int len; #if 0 strout ("#test)) @@ -1797,18 +1814,18 @@ PRINTCHAR (' '); strout (SDATA (SYMBOL_NAME (h->weak)), -1, -1, printcharfun); PRINTCHAR (' '); - sprintf (buf, "%"pD"d/%"pD"d", h->count, ASIZE (h->next)); - strout (buf, -1, -1, printcharfun); + len = sprintf (buf, "%"pD"d/%"pD"d", h->count, ASIZE (h->next)); + strout (buf, len, len, printcharfun); } - sprintf (buf, " %p", h); - strout (buf, -1, -1, printcharfun); + len = sprintf (buf, " %p", h); + strout (buf, len, len, printcharfun); PRINTCHAR ('>'); #endif /* Implement a readable output, e.g.: #s(hash-table size 2 test equal data (k1 v1 k2 v2)) */ /* Always print the size. */ - sprintf (buf, "#s(hash-table size %"pD"d", ASIZE (h->next)); - strout (buf, -1, -1, printcharfun); + len = sprintf (buf, "#s(hash-table size %"pD"d", ASIZE (h->next)); + strout (buf, len, len, printcharfun); if (!NILP (h->test)) { @@ -1881,12 +1898,13 @@ } else if (FRAMEP (obj)) { + int len; strout ((FRAME_LIVE_P (XFRAME (obj)) ? "#name, printcharfun); - sprintf (buf, " %p", XFRAME (obj)); - strout (buf, -1, -1, printcharfun); + len = sprintf (buf, " %p", XFRAME (obj)); + strout (buf, len, len, printcharfun); PRINTCHAR ('>'); } else if (FONTP (obj)) @@ -1982,8 +2000,8 @@ strout ("in no buffer", -1, -1, printcharfun); else { - sprintf (buf, "at %"pD"d", marker_position (obj)); - strout (buf, -1, -1, printcharfun); + int len = sprintf (buf, "at %"pD"d", marker_position (obj)); + strout (buf, len, len, printcharfun); strout (" in ", -1, -1, printcharfun); print_string (BVAR (XMARKER (obj)->buffer, name), printcharfun); } @@ -1996,10 +2014,10 @@ strout ("in no buffer", -1, -1, printcharfun); else { - sprintf (buf, "from %"pD"d to %"pD"d in ", - marker_position (OVERLAY_START (obj)), - marker_position (OVERLAY_END (obj))); - strout (buf, -1, -1, printcharfun); + int len = sprintf (buf, "from %"pD"d to %"pD"d in ", + marker_position (OVERLAY_START (obj)), + marker_position (OVERLAY_END (obj))); + strout (buf, len, len, printcharfun); print_string (BVAR (XMARKER (OVERLAY_START (obj))->buffer, name), printcharfun); } @@ -2014,10 +2032,12 @@ case Lisp_Misc_Save_Value: strout ("#pointer, - XSAVE_VALUE (obj)->integer); - strout (buf, -1, -1, printcharfun); + { + int len = sprintf (buf, "ptr=%p int=%"pD"d", + XSAVE_VALUE (obj)->pointer, + XSAVE_VALUE (obj)->integer); + strout (buf, len, len, printcharfun); + } PRINTCHAR ('>'); break; @@ -2029,16 +2049,17 @@ default: badtype: { + int len; /* We're in trouble if this happens! Probably should just abort () */ strout ("#", -1, -1, printcharfun); } === modified file 'src/term.c' --- src/term.c 2012-06-24 17:39:14 +0000 +++ src/term.c 2012-06-26 02:33:51 +0000 @@ -1851,8 +1851,7 @@ len = 1; else if (len > 4) len = 4; - sprintf (buf, "[%.*s]", len, str); - len += 2; + len = sprintf (buf, "[%.*s]", len, str); str = buf; } else === modified file 'src/xdisp.c' --- src/xdisp.c 2012-06-22 21:17:42 +0000 +++ src/xdisp.c 2012-06-26 02:33:51 +0000 @@ -9365,12 +9365,10 @@ { char dupstr[sizeof " [ times]" + INT_STRLEN_BOUND (printmax_t)]; - int duplen; /* If you change this format, don't forget to also change message_log_check_duplicate. */ - sprintf (dupstr, " [%"pMd" times]", dups); - duplen = strlen (dupstr); + int duplen = sprintf (dupstr, " [%"pMd" times]", dups); TEMP_SET_PT_BOTH (Z - 1, Z_BYTE - 1); insert_1 (dupstr, duplen, 1, 0, 1); } === modified file 'src/xfns.c' --- src/xfns.c 2012-06-25 10:16:11 +0000 +++ src/xfns.c 2012-06-26 02:33:51 +0000 @@ -5956,10 +5956,10 @@ DEFVAR_LISP ("gtk-version-string", Vgtk_version_string, doc: /* Version info for GTK+. */); { - char gtk_version[40]; - g_snprintf (gtk_version, sizeof (gtk_version), "%u.%u.%u", - GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); - Vgtk_version_string = make_pure_string (gtk_version, strlen (gtk_version), strlen (gtk_version), 0); + char gtk_version[sizeof ".." + 3 * INT_STRLEN_BOUND (int)]; + int len = sprintf (gtk_version, "%d.%d.%d", + GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); + Vgtk_version_string = make_pure_string (gtk_version, len, len, 0); } #endif /* USE_GTK */ ------------------------------------------------------------ revno: 108740 committer: Paul Eggert branch nick: trunk timestamp: Mon 2012-06-25 18:05:39 -0700 message: Clean out last vestiges of the old HAVE_CONFIG_H stuff. diff: === modified file 'ChangeLog' --- ChangeLog 2012-06-25 14:07:04 +0000 +++ ChangeLog 2012-06-26 01:05:39 +0000 @@ -1,3 +1,8 @@ +2012-06-26 Paul Eggert + + Clean out last vestiges of the old HAVE_CONFIG_H stuff. + * lib/makefile.w32-in (LOCAL_FLAGS): Remove -DHAVE_CONFIG_H. + 2012-06-25 Dmitry Antipov * configure.in (AC_CHECK_FUNCS): Detect library functions === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2012-06-25 14:07:04 +0000 +++ lib-src/ChangeLog 2012-06-26 01:05:39 +0000 @@ -1,3 +1,13 @@ +2012-06-26 Paul Eggert + + Clean out last vestiges of the old HAVE_CONFIG_H stuff. + * Makefile.in (BASE_CFLAGS): + * makefile.w32-in (LOCAL_FLAGS): Remove -DHAVE_CONFIG_H. + * etags.c, hexl.c, pop.c: Include unconditionally. + * etags.c (DOS_NT): + * pop.c (MAIL_USE_POP, h_errno): + Remove code that was conditioned on !HAVE_CONFIG_H. + 2012-06-25 Dmitry Antipov * etags.c (etags_strcasecmp, etags_strncasecmp): Define to === modified file 'lib-src/Makefile.in' --- lib-src/Makefile.in 2012-06-22 21:17:42 +0000 +++ lib-src/Makefile.in 2012-06-26 01:05:39 +0000 @@ -169,12 +169,9 @@ ## Some systems define this to request special libraries. LIBS_SYSTEM = @LIBS_SYSTEM@ -# Those files shared with other GNU utilities need HAVE_CONFIG_H -# defined before they know they can take advantage of the information -# in ../src/config.h. BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ - -DHAVE_CONFIG_H -I. -I../src -I../lib \ + -I. -I../src -I../lib \ -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS} === modified file 'lib-src/etags.c' --- lib-src/etags.c 2012-06-25 14:07:04 +0000 +++ lib-src/etags.c 2012-06-26 01:05:39 +0000 @@ -91,9 +91,7 @@ # define NDEBUG /* disable assert */ #endif -#ifdef HAVE_CONFIG_H -# include -#endif /* !HAVE_CONFIG_H */ +#include #ifndef _GNU_SOURCE # define _GNU_SOURCE 1 /* enables some compiler checks on GNU */ @@ -113,10 +111,6 @@ # include # include # include -# ifndef HAVE_CONFIG_H -# define DOS_NT -# include -# endif #else # define MSDOS FALSE #endif /* MSDOS */ @@ -167,14 +161,6 @@ # include #endif /* NO_LONG_OPTIONS */ -#ifndef HAVE_CONFIG_H /* this is a standalone compilation */ -# ifdef __CYGWIN__ /* compiling on Cygwin */ - !!! NOTICE !!! - the regex.h distributed with Cygwin is not compatible with etags, alas! -If you want regular expression support, you should delete this notice and - arrange to use the GNU regex.h and regex.c. -# endif -#endif #include /* Define CTAGS to make the program "ctags" compatible with the usual one. === modified file 'lib-src/hexl.c' --- lib-src/hexl.c 2012-06-24 17:39:14 +0000 +++ lib-src/hexl.c 2012-06-26 01:05:39 +0000 @@ -20,9 +20,7 @@ along with this program. If not, see . */ -#ifdef HAVE_CONFIG_H #include -#endif #include #include === modified file 'lib-src/makefile.w32-in' --- lib-src/makefile.w32-in 2012-06-05 17:56:38 +0000 +++ lib-src/makefile.w32-in 2012-06-26 01:05:39 +0000 @@ -24,7 +24,7 @@ .PHONY: make-docfile LOCAL_FLAGS = -DWINDOWSNT -DDOS_NT -DNO_LDAV=1 \ - -DNO_ARCHIVES=1 -DHAVE_CONFIG_H=1 -I../lib \ + -DNO_ARCHIVES=1 -I../lib \ -I../nt/inc -I../src $(EMACS_EXTRA_C_FLAGS) LIBS = $(BASE_LIBS) $(ADVAPI32) === modified file 'lib-src/pop.c' --- lib-src/pop.c 2012-05-02 10:12:13 +0000 +++ lib-src/pop.c 2012-06-26 01:05:39 +0000 @@ -21,11 +21,7 @@ along with GNU Emacs. If not, see . */ -#ifdef HAVE_CONFIG_H #include -#else -#define MAIL_USE_POP -#endif #ifdef MAIL_USE_POP @@ -101,7 +97,7 @@ #endif /* KERBEROS */ #ifndef WINDOWSNT -#if !defined (HAVE_H_ERRNO) || !defined (HAVE_CONFIG_H) +#ifndef HAVE_H_ERRNO extern int h_errno; #endif #endif === modified file 'lib/makefile.w32-in' --- lib/makefile.w32-in 2012-06-24 17:21:20 +0000 +++ lib/makefile.w32-in 2012-06-26 01:05:39 +0000 @@ -20,7 +20,7 @@ .PHONY: $(ALL) -LOCAL_FLAGS = -DHAVE_CONFIG_H=1 -I. -I../nt/inc -I../src +LOCAL_FLAGS = -I. -I../nt/inc -I../src LIBS = GNULIBOBJS = $(BLD)/dtoastr.$(O) \ === modified file 'lwlib/ChangeLog' --- lwlib/ChangeLog 2012-06-25 14:07:04 +0000 +++ lwlib/ChangeLog 2012-06-26 01:05:39 +0000 @@ -1,3 +1,10 @@ +2012-06-26 Paul Eggert + + Clean out last vestiges of the old HAVE_CONFIG_H stuff. + * Makefile.in (ALL_CFLAGS): Remove -DHAVE_CONFIG_H. + * lwlib-Xaw.c, lwlib-Xlw.c, lwlib-Xm.c, lwlib-utils.c, lwlib.c: + * xlwmenu.c: Include unconditionally. + 2012-06-25 Dmitry Antipov * lwlib.c (my_strcasecmp): Rename to lwlib_strcasecmp, which === modified file 'lwlib/Makefile.in' --- lwlib/Makefile.in 2012-04-14 04:37:44 +0000 +++ lwlib/Makefile.in 2012-06-26 01:05:39 +0000 @@ -55,7 +55,7 @@ ALL_CFLAGS= $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \ $(C_SWITCH_MACHINE) \ $(WARN_CFLAGS) $(WERROR_CFLAGS) $(PROFILING_CFLAGS) $(CFLAGS) \ - -DHAVE_CONFIG_H -Demacs -I../src \ + -Demacs -I../src \ -I$(srcdir) -I$(srcdir)/../src -I../lib -I$(srcdir)/../lib .c.o: === modified file 'lwlib/lwlib-Xaw.c' --- lwlib/lwlib-Xaw.c 2012-01-19 07:21:25 +0000 +++ lwlib/lwlib-Xaw.c 2012-06-26 01:05:39 +0000 @@ -20,9 +20,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_CONFIG_H #include -#endif #include #include @@ -148,7 +146,7 @@ { int w = 0, h = 0; char *bp = text; - + while (bp && *bp != '\0') { XGlyphInfo gi; @@ -227,16 +225,16 @@ Widget parent = XtParent (widget); struct widget_xft_data *data = NULL; int nr; - while (parent && !inst) + while (parent && !inst) { inst = lw_get_widget_instance (parent); parent = XtParent (parent); } if (!inst || !inst->xft_data || !inst->xft_data[0].xft_font) return 0; - for (nr = 0; data == NULL && nr < inst->nr_xft_data; ++nr) + for (nr = 0; data == NULL && nr < inst->nr_xft_data; ++nr) { - if (inst->xft_data[nr].widget == widget) + if (inst->xft_data[nr].widget == widget) data = &inst->xft_data[nr]; } @@ -250,7 +248,7 @@ Cardinal *num_params) { struct widget_xft_data *data = find_xft_data (widget); - if (data) + if (data) { char *lbl; /* Since this isn't used for rectangle buttons, use it to for armed. */ @@ -268,11 +266,11 @@ Cardinal *num_params) { struct widget_xft_data *data = find_xft_data (widget); - if (data) + if (data) { Dimension cr; XtVaGetValues (widget, XtNcornerRoundPercent, &cr, NULL); - if (cr == 1) + if (cr == 1) { char *lbl; XtVaSetValues (widget, XtNcornerRoundPercent, 0, NULL); @@ -366,14 +364,14 @@ xaw_destroy_instance (widget_instance *instance) { #ifdef HAVE_XFT - if (instance->xft_data) + if (instance->xft_data) { int i; - for (i = 0; i < instance->nr_xft_data; ++i) + for (i = 0; i < instance->nr_xft_data; ++i) { if (instance->xft_data[i].xft_draw) XftDrawDestroy (instance->xft_data[i].xft_draw); - if (instance->xft_data[i].p != None) + if (instance->xft_data[i].p != None) { XtVaSetValues (instance->xft_data[i].widget, XtNbitmap, None, NULL); @@ -483,7 +481,7 @@ static Boolean actions_initted = False; #ifdef HAVE_XFT -static XtActionsRec button_actions[] = +static XtActionsRec button_actions[] = { { "my_reset", command_reset }, { "my_press", command_press }, @@ -563,7 +561,7 @@ XtVaGetValues (dialog, XtNnumChildren, &num, XtNchildren, &ch, NULL); - for (i = 0; i < num; ++i) + for (i = 0; i < num; ++i) { if (!XtIsSubclass (ch[i], commandWidgetClass) && XtIsSubclass (ch[i], labelWidgetClass)) @@ -574,9 +572,9 @@ } instance->xft_data = 0; instance->nr_xft_data = 0; - if (w) + if (w) { - XtResource rec[] = + XtResource rec[] = { { "font", "Font", XtRString, sizeof(String), 0, XtRString, (XtPointer)"Sans-10" }}; char *fontName = NULL; @@ -590,8 +588,8 @@ else XFreeFont (XtDisplay (dialog), xfn); } - - if (xft_font) + + if (xft_font) { instance->nr_xft_data = left_buttons + right_buttons + 1; instance->xft_data = calloc (instance->nr_xft_data, @@ -639,7 +637,7 @@ { ac = 0; XtSetArg (av [ac], XtNfromHoriz, button); ac++; - if (i == 0) + if (i == 0) { /* Separator to the other buttons. */ XtSetArg (av [ac], XtNhorizDistance, 30); ac++; === modified file 'lwlib/lwlib-Xlw.c' --- lwlib/lwlib-Xlw.c 2012-01-19 07:21:25 +0000 +++ lwlib/lwlib-Xlw.c 2012-06-26 01:05:39 +0000 @@ -20,9 +20,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_CONFIG_H #include -#endif #include #include === modified file 'lwlib/lwlib-Xm.c' --- lwlib/lwlib-Xm.c 2012-01-19 07:21:25 +0000 +++ lwlib/lwlib-Xm.c 2012-06-26 01:05:39 +0000 @@ -20,9 +20,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_CONFIG_H #include -#endif #include #include === modified file 'lwlib/lwlib-utils.c' --- lwlib/lwlib-utils.c 2012-01-19 07:21:25 +0000 +++ lwlib/lwlib-utils.c 2012-06-26 01:05:39 +0000 @@ -20,9 +20,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_CONFIG_H #include -#endif #include #include === modified file 'lwlib/lwlib.c' --- lwlib/lwlib.c 2012-06-25 14:07:04 +0000 +++ lwlib/lwlib.c 2012-06-26 01:05:39 +0000 @@ -20,9 +20,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_CONFIG_H #include -#endif #include #include === modified file 'lwlib/xlwmenu.c' --- lwlib/xlwmenu.c 2012-06-24 17:39:14 +0000 +++ lwlib/xlwmenu.c 2012-06-26 01:05:39 +0000 @@ -22,9 +22,7 @@ /* Created by devin@lucid.com */ -#ifdef HAVE_CONFIG_H #include -#endif #include #include === modified file 'msdos/ChangeLog' --- msdos/ChangeLog 2012-06-11 23:17:11 +0000 +++ msdos/ChangeLog 2012-06-26 01:05:39 +0000 @@ -1,3 +1,8 @@ +2012-06-26 Paul Eggert + + Clean out last vestiges of the old HAVE_CONFIG_H stuff. + * sedlibmk.inp (DEFS): Don't add -DHAVE_CONFIG_H. + 2012-06-11 Glenn Morris * sed2v2.inp (SYSTEM_TYPE): Set it. === modified file 'msdos/sedlibmk.inp' --- msdos/sedlibmk.inp 2012-05-27 13:42:13 +0000 +++ msdos/sedlibmk.inp 2012-06-26 01:05:39 +0000 @@ -136,7 +136,7 @@ /^GNULIB_WARN_CFLAGS *=/s/@GNULIB_WARN_CFLAGS@// /^WARN_CFLAGS *=/s/@WARN_CFLAGS@// /^WERROR_CFLAGS *=/s/@WERROR_CFLAGS@// -/^DEFS *=/s/@[^@\n]*@/-DHAVE_CONFIG_H/ +/^DEFS *=/s/@[^@\n]*@// /^DEPDIR *=/s/@[^@\n]*@/deps/ /^DEPFLAGS *=/s/@[^@\n]*@/-MMD -MF ${DEPDIR}\/$*.d/ /^ECHO_N *=/s/@[^@\n]*@/-n/ === modified file 'src/ChangeLog' --- src/ChangeLog 2012-06-25 14:28:51 +0000 +++ src/ChangeLog 2012-06-26 01:05:39 +0000 @@ -1,3 +1,10 @@ +2012-06-26 Paul Eggert + + Clean out last vestiges of the old HAVE_CONFIG_H stuff. + * Makefile.in (ALL_CFLAGS): + * makefile.w32-in (LOCAL_FLAGS): Remove -DHAVE_CONFIG_H. + * gmalloc.c, regex.c: Include unconditionally. + 2012-06-25 Dmitry Antipov * dispextern.h (xstrcasecmp): Define to library function === modified file 'src/Makefile.in' --- src/Makefile.in 2012-06-22 21:17:42 +0000 +++ src/Makefile.in 2012-06-26 01:05:39 +0000 @@ -303,11 +303,8 @@ ## -Demacs is needed to make some files produce the correct version ## for use in Emacs. ## -## -DHAVE_CONFIG_H is needed for some other files to take advantage of -## the information in `config.h'. -## ## FIXME? MYCPPFLAGS only referenced in etc/DEBUG. -ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I$(srcdir) \ +ALL_CFLAGS=-Demacs $(MYCPPFLAGS) -I. -I$(srcdir) \ -I$(lib) -I$(srcdir)/../lib \ $(C_SWITCH_MACHINE) $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \ $(GNUSTEP_CFLAGS) $(CFLAGS_SOUND) $(RSVG_CFLAGS) $(IMAGEMAGICK_CFLAGS) \ === modified file 'src/gmalloc.c' --- src/gmalloc.c 2012-05-21 15:36:54 +0000 +++ src/gmalloc.c 2012-06-26 01:05:39 +0000 @@ -21,9 +21,7 @@ The author may be reached (Email) at the address mike@ai.mit.edu, or (US mail) as Mike Haertel c/o Free Software Foundation. */ -#ifdef HAVE_CONFIG_H #include -#endif #ifdef HAVE_PTHREAD #define USE_PTHREAD === modified file 'src/makefile.w32-in' --- src/makefile.w32-in 2012-06-24 17:57:06 +0000 +++ src/makefile.w32-in 2012-06-26 01:05:39 +0000 @@ -27,11 +27,7 @@ # Size in MBs of the static heap in temacs.exe. HEAPSIZE = 27 -# -# HAVE_CONFIG_H is required by some generic gnu sources stuck into -# the emacs source tree. -# -LOCAL_FLAGS = -Demacs=1 -DHAVE_CONFIG_H -I../lib -I../nt/inc -DHAVE_NTGUI=1 $(EMACS_EXTRA_C_FLAGS) +LOCAL_FLAGS = -Demacs=1 -I../lib -I../nt/inc -DHAVE_NTGUI=1 $(EMACS_EXTRA_C_FLAGS) SRC = . EMACS = $(BLD)/emacs.exe === modified file 'src/regex.c' --- src/regex.c 2012-06-16 12:24:15 +0000 +++ src/regex.c 2012-06-26 01:05:39 +0000 @@ -46,9 +46,7 @@ # endif #endif -#ifdef HAVE_CONFIG_H -# include -#endif +#include #include ------------------------------------------------------------ revno: 108739 committer: Paul Eggert branch nick: trunk timestamp: Mon 2012-06-25 17:39:36 -0700 message: * Makefile.in (ALL_CFLAGS): Add -I../lib -I${srcdir}/../lib. This is needed for hosts that lack , when Emacs is configured --with-x-toolkit=no. Problem reported by Herbert J. Skuhra for FreeBSD. diff: === modified file 'oldXMenu/ChangeLog' --- oldXMenu/ChangeLog 2012-06-10 13:20:58 +0000 +++ oldXMenu/ChangeLog 2012-06-26 00:39:36 +0000 @@ -1,3 +1,10 @@ +2012-06-26 Paul Eggert + + * Makefile.in (ALL_CFLAGS): Add -I../lib -I${srcdir}/../lib. + This is needed for hosts that lack , when Emacs is + configured --with-x-toolkit=no. Problem reported by Herbert + J. Skuhra for FreeBSD. + 2012-04-18 Paul Eggert configure: new option --enable-gcc-warnings (Bug#11207) === modified file 'oldXMenu/Makefile.in' --- oldXMenu/Makefile.in 2012-04-14 04:37:44 +0000 +++ oldXMenu/Makefile.in 2012-06-26 00:39:36 +0000 @@ -91,7 +91,7 @@ $(C_SWITCH_X_SITE) \ $(WARN_CFLAGS) $(WERROR_CFLAGS) ${PROFILING_CFLAGS} \ $(CPPFLAGS) $(CFLAGS) -DEMACS_BITMAP_FILES \ - -I../src -I${srcdir} -I${srcdir}/../src + -I../src -I../lib -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib .c.o: $(CC) -c ${ALL_CFLAGS} $< ------------------------------------------------------------ revno: 108738 author: Jim Diamond committer: Stefan Monnier branch nick: trunk timestamp: Mon 2012-06-25 19:01:42 -0400 message: * lisp/server.el (server-process-filter): Remember dir in the process's `server-client-directory' properties. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-06-24 15:06:24 +0000 +++ lisp/ChangeLog 2012-06-25 23:01:42 +0000 @@ -1,3 +1,8 @@ +2012-06-25 Jim Diamond (tiny change) + + * server.el (server-process-filter): Remember dir in the + process's `server-client-directory' properties. + 2012-06-24 Chong Yidong * xml.el (xml-parse-tag): Correctly handle comment embedded in === modified file 'lisp/server.el' --- lisp/server.el 2012-04-20 10:37:57 +0000 +++ lisp/server.el 2012-06-25 23:01:42 +0000 @@ -1164,7 +1164,8 @@ (setq dir (pop args-left)) (if coding-system (setq dir (decode-coding-string dir coding-system))) - (setq dir (command-line-normalize-file-name dir))) + (setq dir (command-line-normalize-file-name dir)) + (process-put proc 'server-client-directory dir)) ;; Unknown command. (arg (error "Unknown command: %s" arg)))) ------------------------------------------------------------ revno: 108737 committer: Paul Eggert branch nick: trunk timestamp: Mon 2012-06-25 07:49:15 -0700 message: Merge from gnulib (comment-only change). diff: === modified file 'm4/time_h.m4' --- m4/time_h.m4 2012-05-26 23:14:36 +0000 +++ m4/time_h.m4 2012-06-25 14:49:15 +0000 @@ -2,7 +2,7 @@ # Copyright (C) 2000-2001, 2003-2007, 2009-2012 Free Software Foundation, Inc. -# serial 6 +# serial 7 # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -25,7 +25,7 @@ AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC]) ]) -dnl Define HAVE_STRUCT_TIMESPEC if 'struct timespec' is declared +dnl Check whether 'struct timespec' is declared dnl in time.h, sys/time.h, or pthread.h. AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC], ------------------------------------------------------------ revno: 108736 committer: Dmitry Antipov branch nick: trunk timestamp: Mon 2012-06-25 18:28:51 +0400 message: Fix misspelling dispextern.h in ChangeLog. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-06-25 14:07:04 +0000 +++ src/ChangeLog 2012-06-25 14:28:51 +0000 @@ -1,6 +1,6 @@ 2012-06-25 Dmitry Antipov - * dispextern.c (xstrcasecmp): Define to library function + * dispextern.h (xstrcasecmp): Define to library function strcasecmp if available. * xfaces.c: Do not use xstrcasecmp if strcasecmp is available. ------------------------------------------------------------ revno: 108735 committer: Dmitry Antipov branch nick: trunk timestamp: Mon 2012-06-25 18:07:04 +0400 message: * configure.in (AC_CHECK_FUNCS): Detect library functions strcasecmp and strncasecmp. * lib-src/etags.c (etags_strcasecmp, etags_strncasecmp): Define to library functions strcasecmp and strncasecmp if available. * lwlib/lwlib.c (my_strcasecmp): Rename to lwlib_strcasecmp, which may be defined to library function strcasecmp if available. * src/dispextern.c (xstrcasecmp): Define to library function strcasecmp if available. * src/xfaces.c: Do not use xstrcasecmp if strcasecmp is available. diff: === modified file 'ChangeLog' --- ChangeLog 2012-06-24 17:39:14 +0000 +++ ChangeLog 2012-06-25 14:07:04 +0000 @@ -1,3 +1,8 @@ +2012-06-25 Dmitry Antipov + + * configure.in (AC_CHECK_FUNCS): Detect library functions + strcasecmp and strncasecmp. + 2012-06-24 Paul Eggert Switch from NO_RETURN to C11's _Noreturn (Bug#11750). === modified file 'configure.in' --- configure.in 2012-06-24 17:39:14 +0000 +++ configure.in 2012-06-25 14:07:04 +0000 @@ -2671,6 +2671,7 @@ difftime posix_memalign \ getpwent endpwent getgrent endgrent \ touchlock \ +strcasecmp strncasecmp \ cfmakeraw cfsetspeed copysign __executable_start) dnl Cannot use AC_CHECK_FUNCS === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2012-06-24 17:39:14 +0000 +++ lib-src/ChangeLog 2012-06-25 14:07:04 +0000 @@ -1,3 +1,8 @@ +2012-06-25 Dmitry Antipov + + * etags.c (etags_strcasecmp, etags_strncasecmp): Define to + library functions strcasecmp and strncasecmp if available. + 2012-06-24 Paul Eggert Switch from NO_RETURN to C11's _Noreturn (Bug#11750). === modified file 'lib-src/etags.c' --- lib-src/etags.c 2012-06-24 17:39:14 +0000 +++ lib-src/etags.c 2012-06-25 14:07:04 +0000 @@ -389,8 +389,16 @@ static char *savestr (const char *); static char *etags_strchr (const char *, int); static char *etags_strrchr (const char *, int); +#ifdef HAVE_STRCASECMP +#define etags_strcasecmp(x,y) strcasecmp ((x), (y)) +#else static int etags_strcasecmp (const char *, const char *); +#endif +#ifdef HAVE_STRNCASECMP +#define etags_strncasecmp(x,y,z) strncasecmp ((x), (y), (z)) +#else static int etags_strncasecmp (const char *, const char *, int); +#endif static char *etags_getcwd (void); static char *relative_filename (char *, char *); static char *absolute_filename (char *, char *); @@ -6320,6 +6328,7 @@ return NULL; } +#ifndef HAVE_STRCASECMP /* * Compare two strings, ignoring case for alphabetic characters. * @@ -6338,7 +6347,9 @@ ? lowcase (*s1) - lowcase (*s2) : *s1 - *s2); } +#endif /* HAVE_STRCASECMP */ +#ifndef HAVE_STRNCASECMP /* * Compare two strings, ignoring case for alphabetic characters. * Stop after a given number of characters @@ -6361,6 +6372,7 @@ ? lowcase (*s1) - lowcase (*s2) : *s1 - *s2); } +#endif /* HAVE_STRCASECMP */ /* Skip spaces (end of string is not space), return new pointer. */ static char * === modified file 'lwlib/ChangeLog' --- lwlib/ChangeLog 2012-06-24 17:39:14 +0000 +++ lwlib/ChangeLog 2012-06-25 14:07:04 +0000 @@ -1,3 +1,8 @@ +2012-06-25 Dmitry Antipov + + * lwlib.c (my_strcasecmp): Rename to lwlib_strcasecmp, which + may be defined to library function strcasecmp if available. + 2012-06-24 Paul Eggert Switch from NO_RETURN to C11's _Noreturn (Bug#11750). === modified file 'lwlib/lwlib.c' --- lwlib/lwlib.c 2012-01-19 07:21:25 +0000 +++ lwlib/lwlib.c 2012-06-25 14:07:04 +0000 @@ -75,7 +75,6 @@ widget_value *, int, int *); static void instantiate_widget_instance (widget_instance *); -static int my_strcasecmp (const char *, const char *); static void safe_free_str (char *); static void free_widget_value_tree (widget_value *); static widget_value *copy_widget_value_tree (widget_value *, @@ -115,10 +114,14 @@ return result; } +#ifdef HAVE_STRCASECMP +#define lwlib_strcasecmp(x,y) strcasecmp ((x), (y)) +#else + /* Like strcmp but ignore differences in case. */ static int -my_strcasecmp (const char *s1, const char *s2) +lwlib_strcasecmp (const char *s1, const char *s2) { while (1) { @@ -134,6 +137,7 @@ return 0; } } +#endif /* HAVE_STRCASECMP */ static void safe_free_str (char *s) @@ -731,7 +735,7 @@ { const widget_creation_entry* cur; for (cur = table; cur->type; cur++) - if (!my_strcasecmp (type, cur->type)) + if (!lwlib_strcasecmp (type, cur->type)) return cur->function; return NULL; } === modified file 'src/ChangeLog' --- src/ChangeLog 2012-06-25 10:28:47 +0000 +++ src/ChangeLog 2012-06-25 14:07:04 +0000 @@ -1,3 +1,9 @@ +2012-06-25 Dmitry Antipov + + * dispextern.c (xstrcasecmp): Define to library function + strcasecmp if available. + * xfaces.c: Do not use xstrcasecmp if strcasecmp is available. + 2012-06-25 Andreas Schwab * keyboard.c (menu_bar_items, menu_bar_item, read_key_sequence): === modified file 'src/dispextern.h' --- src/dispextern.h 2012-06-22 21:17:42 +0000 +++ src/dispextern.h 2012-06-25 14:07:04 +0000 @@ -3216,7 +3216,11 @@ char *choose_face_font (struct frame *, Lisp_Object *, Lisp_Object, int *); void prepare_face_for_display (struct frame *, struct face *); +#ifdef HAVE_STRCASECMP +#define xstrcasecmp(x,y) strcasecmp ((x), (y)) +#else int xstrcasecmp (const char *, const char *); +#endif int lookup_named_face (struct frame *, Lisp_Object, int); int lookup_basic_face (struct frame *, int); int smaller_face (struct frame *, int, int); === modified file 'src/xfaces.c' --- src/xfaces.c 2012-06-17 00:32:36 +0000 +++ src/xfaces.c 2012-06-25 14:07:04 +0000 @@ -716,6 +716,7 @@ } #endif /* HAVE_NS */ +#ifndef HAVE_STRCASECMP /* Like strcasecmp/stricmp. Used to compare parts of font names which are in ISO8859-1. */ @@ -737,7 +738,7 @@ return *s2 == 0 ? 0 : -1; return 1; } - +#endif /* HAVE_STRCASECMP */ /* If FRAME is nil, return a pointer to the selected frame. Otherwise, check that FRAME is a live frame, and return a pointer ------------------------------------------------------------ revno: 108734 committer: Andreas Schwab branch nick: emacs timestamp: Mon 2012-06-25 12:28:47 +0200 message: * keyboard.c (menu_bar_items, menu_bar_item, read_key_sequence): Avoid comma operator. * menu.c (push_submenu_start, push_submenu_end) (push_left_right_boundary, push_menu_pane): Likewise. * msdos.c (dos_rawgetc): Likewise. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-06-25 10:16:11 +0000 +++ src/ChangeLog 2012-06-25 10:28:47 +0000 @@ -1,3 +1,11 @@ +2012-06-25 Andreas Schwab + + * keyboard.c (menu_bar_items, menu_bar_item, read_key_sequence): + Avoid comma operator. + * menu.c (push_submenu_start, push_submenu_end) + (push_left_right_boundary, push_menu_pane): Likewise. + * msdos.c (dos_rawgetc): Likewise. + 2012-06-25 Dmitry Antipov * xfns.c (xic_create_fontsetname): Remove redundant calls === modified file 'src/keyboard.c' --- src/keyboard.c 2012-06-24 17:39:14 +0000 +++ src/keyboard.c 2012-06-25 10:28:47 +0000 @@ -7571,10 +7571,10 @@ menu_bar_items_vector = larger_vector (menu_bar_items_vector, 4, -1); /* Add this item. */ - ASET (menu_bar_items_vector, i, Qnil), i++; - ASET (menu_bar_items_vector, i, Qnil), i++; - ASET (menu_bar_items_vector, i, Qnil), i++; - ASET (menu_bar_items_vector, i, Qnil), i++; + ASET (menu_bar_items_vector, i, Qnil); i++; + ASET (menu_bar_items_vector, i, Qnil); i++; + ASET (menu_bar_items_vector, i, Qnil); i++; + ASET (menu_bar_items_vector, i, Qnil); i++; menu_bar_items_index = i; } @@ -7642,11 +7642,11 @@ if (i + 4 > ASIZE (menu_bar_items_vector)) menu_bar_items_vector = larger_vector (menu_bar_items_vector, 4, -1); /* Add this item. */ - ASET (menu_bar_items_vector, i, key), i++; + ASET (menu_bar_items_vector, i, key); i++; ASET (menu_bar_items_vector, i, - AREF (item_properties, ITEM_PROPERTY_NAME)), i++; - ASET (menu_bar_items_vector, i, Fcons (item, Qnil)), i++; - ASET (menu_bar_items_vector, i, make_number (0)), i++; + AREF (item_properties, ITEM_PROPERTY_NAME)); i++; + ASET (menu_bar_items_vector, i, Fcons (item, Qnil)); i++; + ASET (menu_bar_items_vector, i, make_number (0)); i++; menu_bar_items_index = i; } /* We did find an item for this KEY. Add ITEM to its list of maps. */ @@ -9447,7 +9447,8 @@ && current_buffer != starting_buffer) { GROW_RAW_KEYBUF; - ASET (raw_keybuf, raw_keybuf_count, key), raw_keybuf_count++; + ASET (raw_keybuf, raw_keybuf_count, key); + raw_keybuf_count++; keybuf[t++] = key; mock_input = t; Vquit_flag = Qnil; @@ -9525,7 +9526,8 @@ && BUFFERP (XWINDOW (window)->buffer) && XBUFFER (XWINDOW (window)->buffer) != current_buffer) { - ASET (raw_keybuf, raw_keybuf_count, key), raw_keybuf_count++; + ASET (raw_keybuf, raw_keybuf_count, key); + raw_keybuf_count++; keybuf[t] = key; mock_input = t + 1; === modified file 'src/menu.c' --- src/menu.c 2012-06-19 16:56:28 +0000 +++ src/menu.c 2012-06-25 10:28:47 +0000 @@ -197,7 +197,8 @@ push_submenu_start (void) { ensure_menu_items (1); - ASET (menu_items, menu_items_used, Qnil), menu_items_used++; + ASET (menu_items, menu_items_used, Qnil); + menu_items_used++; menu_items_submenu_depth++; } @@ -207,7 +208,8 @@ push_submenu_end (void) { ensure_menu_items (1); - ASET (menu_items, menu_items_used, Qlambda), menu_items_used++; + ASET (menu_items, menu_items_used, Qlambda); + menu_items_used++; menu_items_submenu_depth--; } @@ -219,7 +221,8 @@ push_left_right_boundary (void) { ensure_menu_items (1); - ASET (menu_items, menu_items_used, Qquote), menu_items_used++; + ASET (menu_items, menu_items_used, Qquote); + menu_items_used++; } /* Start a new menu pane in menu_items. @@ -231,9 +234,12 @@ ensure_menu_items (MENU_ITEMS_PANE_LENGTH); if (menu_items_submenu_depth == 0) menu_items_n_panes++; - ASET (menu_items, menu_items_used, Qt), menu_items_used++; - ASET (menu_items, menu_items_used, name), menu_items_used++; - ASET (menu_items, menu_items_used, prefix_vec), menu_items_used++; + ASET (menu_items, menu_items_used, Qt); + menu_items_used++; + ASET (menu_items, menu_items_used, name); + menu_items_used++; + ASET (menu_items, menu_items_used, prefix_vec); + menu_items_used++; } /* Push one menu item into the current pane. NAME is the string to === modified file 'src/msdos.c' --- src/msdos.c 2012-06-22 21:17:42 +0000 +++ src/msdos.c 2012-06-25 10:28:47 +0000 @@ -2466,10 +2466,12 @@ sc = regs.h.ah; total_doskeys += 2; - ASET (recent_doskeys, recent_doskeys_index, make_number (c)), recent_doskeys_index++; + ASET (recent_doskeys, recent_doskeys_index, make_number (c)); + recent_doskeys_index++; if (recent_doskeys_index == NUM_RECENT_DOSKEYS) recent_doskeys_index = 0; - ASET (recent_doskeys, recent_doskeys_index, make_number (sc)), recent_doskeys_index++; + ASET (recent_doskeys, recent_doskeys_index, make_number (sc)); + recent_doskeys_index++; if (recent_doskeys_index == NUM_RECENT_DOSKEYS) recent_doskeys_index = 0; ------------------------------------------------------------ revno: 108733 committer: Glenn Morris branch nick: trunk timestamp: Mon 2012-06-25 06:17:31 -0400 message: Auto-commit of generated files. diff: === modified file 'autogen/config.in' --- autogen/config.in 2012-06-23 10:17:30 +0000 +++ autogen/config.in 2012-06-25 10:17:31 +0000 @@ -1466,13 +1466,6 @@ #include #include -#if defined __GNUC__ && (__GNUC__ > 2 \ - || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5)) -#define NO_RETURN __attribute__ ((__noreturn__)) -#else -#define NO_RETURN /* nothing */ -#endif - #if __GNUC__ >= 3 /* On GCC 3.0 we might get a warning. */ #define NO_INLINE __attribute__((noinline)) #else ------------------------------------------------------------ revno: 108732 committer: Dmitry Antipov branch nick: trunk timestamp: Mon 2012-06-25 14:16:11 +0400 message: * xfns.c (xic_create_fontsetname): Remove redundant calls to memset. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-06-25 07:54:45 +0000 +++ src/ChangeLog 2012-06-25 10:16:11 +0000 @@ -1,3 +1,8 @@ +2012-06-25 Dmitry Antipov + + * xfns.c (xic_create_fontsetname): Remove redundant calls + to memset. + 2012-06-25 Paul Eggert * gtkutil.c (get_utf8_string): Remove redundant assignment. === modified file 'src/xfns.c' --- src/xfns.c 2012-06-25 07:45:49 +0000 +++ src/xfns.c 2012-06-25 10:16:11 +0000 @@ -1881,10 +1881,9 @@ /* Make a fontset name from the base font name. */ if (xic_default_fontset == base_fontname) - { /* There is no base font name, use the default. */ - ptrdiff_t len = strlen (base_fontname) + 2; - fontsetname = xmalloc (len); - memset (fontsetname, 0, len); + { + /* There is no base font name, use the default. */ + fontsetname = xmalloc (strlen (base_fontname) + 2); strcpy (fontsetname, base_fontname); } else @@ -1900,13 +1899,12 @@ for (i = 0; *p; p++) if (*p == '-') i++; if (i != 14) - { /* As the font name doesn't conform to XLFD, we can't + { + /* As the font name doesn't conform to XLFD, we can't modify it to generalize it to allcs and allfamilies. Use the specified font plus the default. */ - ptrdiff_t len = - strlen (base_fontname) + strlen (xic_default_fontset) + 3; - fontsetname = xmalloc (len); - memset (fontsetname, 0, len); + fontsetname = xmalloc (strlen (base_fontname) + + strlen (xic_default_fontset) + 3); strcpy (fontsetname, base_fontname); strcat (fontsetname, sep); strcat (fontsetname, xic_default_fontset); @@ -1956,7 +1954,6 @@ /* Build the font spec that matches all charsets. */ len = p - base_fontname + strlen (allcs) + 1; font_allcs = (char *) alloca (len); - memset (font_allcs, 0, len); memcpy (font_allcs, base_fontname, p - base_fontname); strcat (font_allcs, allcs); @@ -1964,7 +1961,6 @@ add-styles. */ len = p - p1 + strlen (allcs) + strlen (allfamilies) + 1; font_allfamilies = (char *) alloca (len); - memset (font_allfamilies, 0, len); strcpy (font_allfamilies, allfamilies); memcpy (font_allfamilies + strlen (allfamilies), p1, p - p1); strcat (font_allfamilies, allcs); @@ -1972,7 +1968,6 @@ /* Build the font spec that matches all. */ len = p - p2 + strlen (allcs) + strlen (all) + strlen (allfamilies) + 1; font_all = (char *) alloca (len); - memset (font_all, 0, len); strcpy (font_all, allfamilies); strcat (font_all, all); memcpy (font_all + strlen (all) + strlen (allfamilies), p2, p - p2); @@ -1982,7 +1977,6 @@ len = strlen (base_fontname) + strlen (font_allcs) + strlen (font_allfamilies) + strlen (font_all) + 5; fontsetname = xmalloc (len); - memset (fontsetname, 0, len); strcpy (fontsetname, base_fontname); strcat (fontsetname, sep); strcat (fontsetname, font_allcs); ------------------------------------------------------------ revno: 108731 committer: Paul Eggert branch nick: trunk timestamp: Mon 2012-06-25 00:54:45 -0700 message: * gtkutil.c (get_utf8_string): Remove redundant assignment. sprintf already null-terminates its output. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-06-25 07:45:49 +0000 +++ src/ChangeLog 2012-06-25 07:54:45 +0000 @@ -1,5 +1,8 @@ 2012-06-25 Paul Eggert + * gtkutil.c (get_utf8_string): Remove redundant assignment. + sprintf already null-terminates its output. + * xfns.c (x_window): Remove redundant cast. 2012-06-25 Dmitry Antipov === modified file 'src/gtkutil.c' --- src/gtkutil.c 2012-06-22 21:17:42 +0000 +++ src/gtkutil.c 2012-06-25 07:54:45 +0000 @@ -525,7 +525,6 @@ { strncpy (up, (char *)p, bytes_written); sprintf (up + bytes_written, "\\%03o", p[bytes_written]); - up[bytes_written+4] = '\0'; up += bytes_written+4; p += bytes_written+1; g_error_free (err); ------------------------------------------------------------ revno: 108730 committer: Paul Eggert branch nick: trunk timestamp: Mon 2012-06-25 00:45:49 -0700 message: * xfns.c (x_window): Remove redundant cast. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-06-25 04:05:48 +0000 +++ src/ChangeLog 2012-06-25 07:45:49 +0000 @@ -1,3 +1,7 @@ +2012-06-25 Paul Eggert + + * xfns.c (x_window): Remove redundant cast. + 2012-06-25 Dmitry Antipov * xmenu.c (xmenu_show, xdialog_show): Explicit cast from === modified file 'src/xfns.c' --- src/xfns.c 2012-06-16 12:24:15 +0000 +++ src/xfns.c 2012-06-25 07:45:49 +0000 @@ -2503,7 +2503,7 @@ it is safe to free it while the frame exists. It isn't worth the trouble of arranging to free it when the frame is deleted. */ - tem = (char *) xstrdup (shell_position); + tem = xstrdup (shell_position); XtSetArg (gal[gac], XtNgeometry, tem); gac++; XtSetValues (shell_widget, gal, gac); } ------------------------------------------------------------ revno: 108729 committer: Dmitry Antipov branch nick: trunk timestamp: Mon 2012-06-25 08:05:48 +0400 message: * xmenu.c (xmenu_show, xdialog_show): Explicit cast from `const char *' to `char *' to avoid compiler warning. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-06-24 23:14:39 +0000 +++ src/ChangeLog 2012-06-25 04:05:48 +0000 @@ -1,3 +1,8 @@ +2012-06-25 Dmitry Antipov + + * xmenu.c (xmenu_show, xdialog_show): Explicit cast from + `const char *' to `char *' to avoid compiler warning. + 2012-06-24 Paul Eggert * xterm.c (x_term_init): Build proper-sized _XSETTINGS_Snnn string === modified file 'src/xmenu.c' --- src/xmenu.c 2012-06-23 10:47:00 +0000 +++ src/xmenu.c 2012-06-25 04:05:48 +0000 @@ -1729,7 +1729,7 @@ save_wv->next = wv; else first_wv->contents = wv; - wv->name = pane_string; + wv->name = (char *) pane_string; if (keymaps && !NILP (prefix)) wv->name++; wv->value = 0; @@ -2060,7 +2060,7 @@ pane_string = (NILP (pane_name) ? "" : SSDATA (pane_name)); prev_wv = xmalloc_widget_value (); - prev_wv->value = pane_string; + prev_wv->value = (char *) pane_string; if (keymaps && !NILP (prefix)) prev_wv->name++; prev_wv->enabled = 1;