diff options
| author | Paul Eggert | 2011-03-22 18:01:59 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-03-22 18:01:59 -0700 |
| commit | c9c49752e15c105ded153e9ab0a42743f57184e5 (patch) | |
| tree | e395db95d87459082bace9fcf3a2cec0ea3d1aea | |
| parent | 9d0da923ebd2b78abb6e02f0b90cfe9d818eb301 (diff) | |
| parent | b9b4b7cb4c27f9f6ad644168f0e1241e5c0d6eaa (diff) | |
| download | emacs-c9c49752e15c105ded153e9ab0a42743f57184e5.tar.gz emacs-c9c49752e15c105ded153e9ab0a42743f57184e5.zip | |
Fix more problems found by GCC 4.5.2's static checks.
45 files changed, 1923 insertions, 311 deletions
| @@ -1,3 +1,16 @@ | |||
| 1 | 2011-03-23 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Fix more problems found by GCC 4.5.2's static checks. | ||
| 4 | * Makefile.in (GNULIB_MODULES): Add socklen. | ||
| 5 | * configure.in: Do not check for sys/socket.h, since socklen does that. | ||
| 6 | * m4/socklen.m4: New automatically-generated file, from gnulib. | ||
| 7 | |||
| 8 | fakemail: Remove dependency on ignore-value. | ||
| 9 | * Makefile.in (GNULIB_MODULES): Add stdio. | ||
| 10 | * lib/stdio.in.h, m4/stdio_h.m4: New files, automatically | ||
| 11 | imported from gnulib. | ||
| 12 | * .bzrignore: Add lib/stdio.h. | ||
| 13 | |||
| 1 | 2011-03-22 Glenn Morris <rgm@gnu.org> | 14 | 2011-03-22 Glenn Morris <rgm@gnu.org> |
| 2 | 15 | ||
| 3 | * autogen/copy_autogen: Work from ./ or ../. | 16 | * autogen/copy_autogen: Work from ./ or ../. |
diff --git a/Makefile.in b/Makefile.in index 19267f82121..4dd8cff1bbc 100644 --- a/Makefile.in +++ b/Makefile.in | |||
| @@ -332,7 +332,8 @@ DOS_gnulib_comp.m4 = gl-comp.m4 | |||
| 332 | # as per $(gnulib_srcdir)/DEPENDENCIES. | 332 | # as per $(gnulib_srcdir)/DEPENDENCIES. |
| 333 | GNULIB_MODULES = \ | 333 | GNULIB_MODULES = \ |
| 334 | crypto/md5 dtoastr filemode getloadavg getopt-gnu \ | 334 | crypto/md5 dtoastr filemode getloadavg getopt-gnu \ |
| 335 | ignore-value intprops lstat mktime readlink strftime symlink sys_stat | 335 | ignore-value intprops lstat mktime readlink \ |
| 336 | socklen stdio strftime symlink sys_stat | ||
| 336 | GNULIB_TOOL_FLAGS = \ | 337 | GNULIB_TOOL_FLAGS = \ |
| 337 | --import --no-changelog --no-vc-files --makefile-name=gnulib.mk | 338 | --import --no-changelog --no-vc-files --makefile-name=gnulib.mk |
| 338 | sync-from-gnulib: $(gnulib_srcdir) | 339 | sync-from-gnulib: $(gnulib_srcdir) |
diff --git a/configure.in b/configure.in index b38aa976259..faf14fc6bb3 100644 --- a/configure.in +++ b/configure.in | |||
| @@ -1265,7 +1265,6 @@ if test $emacs_cv_struct_exception != yes; then | |||
| 1265 | AC_DEFINE(NO_MATHERR, 1, [Define to 1 if you don't have struct exception in math.h.]) | 1265 | AC_DEFINE(NO_MATHERR, 1, [Define to 1 if you don't have struct exception in math.h.]) |
| 1266 | fi | 1266 | fi |
| 1267 | 1267 | ||
| 1268 | AC_CHECK_HEADERS(sys/socket.h) | ||
| 1269 | AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT | 1268 | AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT |
| 1270 | #if HAVE_SYS_SOCKET_H | 1269 | #if HAVE_SYS_SOCKET_H |
| 1271 | #include <sys/socket.h> | 1270 | #include <sys/socket.h> |
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index bd1a84cf0b9..3df2f6881db 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog | |||
| @@ -1,3 +1,33 @@ | |||
| 1 | 2011-03-23 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | * ebrowse.c: Use size_t, not int, for sizes. | ||
| 4 | This avoids a warning with gcc -Wstrict-overflow, and works | ||
| 5 | better for very large objects. | ||
| 6 | (inbuffer_size): Now size_t. All uses changed. | ||
| 7 | (xmalloc, xrealloc, operator_name, process_file): Use size_t for | ||
| 8 | sizes. Don't bother testing whether a size_t value can be negative. | ||
| 9 | |||
| 10 | * etags.c (Ada_funcs): Redo slightly to avoid overflow warning. | ||
| 11 | |||
| 12 | etags: In Prolog functions, don't assume int fits in size_t. | ||
| 13 | This avoids a warning with gcc -Wstrict-overflow. | ||
| 14 | * etags.c (Prolog_functions, prolog_pr, prolog_atom): Use size_t, | ||
| 15 | not int, to store sizes. | ||
| 16 | (prolog_atom): Return 0, not -1, on error. All callers changed. | ||
| 17 | |||
| 18 | update-game-score: fix bug with -r | ||
| 19 | * update-game-score.c (main): Don't set 'scores' to garbage when | ||
| 20 | -r is specified and scorecount != MAX_SCORES (Bug#8310). This bug | ||
| 21 | was introduced in the 2002-04-10 change, and was found with gcc | ||
| 22 | -Wstrict-overflow (GCC 4.5.2, x86-64). | ||
| 23 | |||
| 24 | fakemail: Remove dependency on ignore-value. | ||
| 25 | This undoes some of the recent fakemail-related changes. | ||
| 26 | It is made possible due to recent changes to gnulib's stdio module. | ||
| 27 | * Makefile.in (fakemail${EXEEXT}): Do not depend on ignore-value.h. | ||
| 28 | * fakemail.c: Do not include ignore-value.h. | ||
| 29 | (put_line): Do not use ignore_value. | ||
| 30 | |||
| 1 | 2011-03-03 Drake Wilson <drake@begriffli.ch> (tiny change) | 31 | 2011-03-03 Drake Wilson <drake@begriffli.ch> (tiny change) |
| 2 | 32 | ||
| 3 | * emacsclient.c (longopts): Add quiet. | 33 | * emacsclient.c (longopts): Add quiet. |
diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in index d622233efb4..f671b0844ce 100644 --- a/lib-src/Makefile.in +++ b/lib-src/Makefile.in | |||
| @@ -353,7 +353,7 @@ movemail.o: ${srcdir}/movemail.c ../src/config.h | |||
| 353 | pop.o: ${srcdir}/pop.c ${srcdir}/../lib/min-max.h ../src/config.h | 353 | pop.o: ${srcdir}/pop.c ${srcdir}/../lib/min-max.h ../src/config.h |
| 354 | $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c | 354 | $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c |
| 355 | 355 | ||
| 356 | fakemail${EXEEXT}: ${srcdir}/fakemail.c ${srcdir}/../lib/ignore-value.h ../src/config.h | 356 | fakemail${EXEEXT}: ${srcdir}/fakemail.c ../src/config.h |
| 357 | $(CC) ${ALL_CFLAGS} ${srcdir}/fakemail.c $(LOADLIBES) -o fakemail | 357 | $(CC) ${ALL_CFLAGS} ${srcdir}/fakemail.c $(LOADLIBES) -o fakemail |
| 358 | 358 | ||
| 359 | emacsclient${EXEEXT}: ${srcdir}/emacsclient.c ../src/config.h | 359 | emacsclient${EXEEXT}: ${srcdir}/emacsclient.c ../src/config.h |
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c index 113b6fdfe40..7871a804997 100644 --- a/lib-src/ebrowse.c +++ b/lib-src/ebrowse.c | |||
| @@ -378,7 +378,7 @@ int max_regexp = 50; | |||
| 378 | 378 | ||
| 379 | char *inbuffer; | 379 | char *inbuffer; |
| 380 | char *in; | 380 | char *in; |
| 381 | int inbuffer_size; | 381 | size_t inbuffer_size; |
| 382 | 382 | ||
| 383 | /* Return the current buffer position in the input file. */ | 383 | /* Return the current buffer position in the input file. */ |
| 384 | 384 | ||
| @@ -492,7 +492,7 @@ yyerror (const char *format, const char *s) | |||
| 492 | available. */ | 492 | available. */ |
| 493 | 493 | ||
| 494 | static void * | 494 | static void * |
| 495 | xmalloc (int nbytes) | 495 | xmalloc (size_t nbytes) |
| 496 | { | 496 | { |
| 497 | void *p = malloc (nbytes); | 497 | void *p = malloc (nbytes); |
| 498 | if (p == NULL) | 498 | if (p == NULL) |
| @@ -507,7 +507,7 @@ xmalloc (int nbytes) | |||
| 507 | /* Like realloc but print an error and exit if out of memory. */ | 507 | /* Like realloc but print an error and exit if out of memory. */ |
| 508 | 508 | ||
| 509 | static void * | 509 | static void * |
| 510 | xrealloc (void *p, int sz) | 510 | xrealloc (void *p, size_t sz) |
| 511 | { | 511 | { |
| 512 | p = realloc (p, sz); | 512 | p = realloc (p, sz); |
| 513 | if (p == NULL) | 513 | if (p == NULL) |
| @@ -2792,10 +2792,10 @@ parse_classname (void) | |||
| 2792 | static char * | 2792 | static char * |
| 2793 | operator_name (int *sc) | 2793 | operator_name (int *sc) |
| 2794 | { | 2794 | { |
| 2795 | static int id_size = 0; | 2795 | static size_t id_size = 0; |
| 2796 | static char *id = NULL; | 2796 | static char *id = NULL; |
| 2797 | const char *s; | 2797 | const char *s; |
| 2798 | int len; | 2798 | size_t len; |
| 2799 | 2799 | ||
| 2800 | MATCH (); | 2800 | MATCH (); |
| 2801 | 2801 | ||
| @@ -2811,7 +2811,7 @@ operator_name (int *sc) | |||
| 2811 | len = strlen (s) + 10; | 2811 | len = strlen (s) + 10; |
| 2812 | if (len > id_size) | 2812 | if (len > id_size) |
| 2813 | { | 2813 | { |
| 2814 | int new_size = max (len, 2 * id_size); | 2814 | size_t new_size = max (len, 2 * id_size); |
| 2815 | id = (char *) xrealloc (id, new_size); | 2815 | id = (char *) xrealloc (id, new_size); |
| 2816 | id_size = new_size; | 2816 | id_size = new_size; |
| 2817 | } | 2817 | } |
| @@ -2832,7 +2832,7 @@ operator_name (int *sc) | |||
| 2832 | } | 2832 | } |
| 2833 | else | 2833 | else |
| 2834 | { | 2834 | { |
| 2835 | int tokens_matched = 0; | 2835 | size_t tokens_matched = 0; |
| 2836 | 2836 | ||
| 2837 | len = 20; | 2837 | len = 20; |
| 2838 | if (len > id_size) | 2838 | if (len > id_size) |
| @@ -2853,7 +2853,7 @@ operator_name (int *sc) | |||
| 2853 | len += strlen (s) + 2; | 2853 | len += strlen (s) + 2; |
| 2854 | if (len > id_size) | 2854 | if (len > id_size) |
| 2855 | { | 2855 | { |
| 2856 | int new_size = max (len, 2 * id_size); | 2856 | size_t new_size = max (len, 2 * id_size); |
| 2857 | id = (char *) xrealloc (id, new_size); | 2857 | id = (char *) xrealloc (id, new_size); |
| 2858 | id_size = new_size; | 2858 | id_size = new_size; |
| 2859 | } | 2859 | } |
| @@ -3550,7 +3550,7 @@ process_file (char *file) | |||
| 3550 | fp = open_file (file); | 3550 | fp = open_file (file); |
| 3551 | if (fp) | 3551 | if (fp) |
| 3552 | { | 3552 | { |
| 3553 | int nread, nbytes; | 3553 | size_t nread, nbytes; |
| 3554 | 3554 | ||
| 3555 | /* Give a progress indication if needed. */ | 3555 | /* Give a progress indication if needed. */ |
| 3556 | if (f_very_verbose) | 3556 | if (f_very_verbose) |
| @@ -3574,12 +3574,10 @@ process_file (char *file) | |||
| 3574 | } | 3574 | } |
| 3575 | 3575 | ||
| 3576 | nbytes = fread (inbuffer + nread, 1, READ_CHUNK_SIZE, fp); | 3576 | nbytes = fread (inbuffer + nread, 1, READ_CHUNK_SIZE, fp); |
| 3577 | if (nbytes <= 0) | 3577 | if (nbytes == 0) |
| 3578 | break; | 3578 | break; |
| 3579 | nread += nbytes; | 3579 | nread += nbytes; |
| 3580 | } | 3580 | } |
| 3581 | if (nread < 0) | ||
| 3582 | nread = 0; | ||
| 3583 | inbuffer[nread] = '\0'; | 3581 | inbuffer[nread] = '\0'; |
| 3584 | 3582 | ||
| 3585 | /* Reinitialize scanner and parser for the new input file. */ | 3583 | /* Reinitialize scanner and parser for the new input file. */ |
diff --git a/lib-src/etags.c b/lib-src/etags.c index 385e4cc9721..6cb321fe75e 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c | |||
| @@ -4198,7 +4198,7 @@ Ada_funcs (FILE *inf) | |||
| 4198 | /* Skip a string i.e. "abcd". */ | 4198 | /* Skip a string i.e. "abcd". */ |
| 4199 | if (inquote || (*dbp == '"')) | 4199 | if (inquote || (*dbp == '"')) |
| 4200 | { | 4200 | { |
| 4201 | dbp = etags_strchr ((inquote) ? dbp : dbp+1, '"'); | 4201 | dbp = etags_strchr (dbp + !inquote, '"'); |
| 4202 | if (dbp != NULL) | 4202 | if (dbp != NULL) |
| 4203 | { | 4203 | { |
| 4204 | inquote = FALSE; | 4204 | inquote = FALSE; |
| @@ -5254,16 +5254,16 @@ HTML_labels (FILE *inf) | |||
| 5254 | * Original code by Sunichirou Sugou (1989) | 5254 | * Original code by Sunichirou Sugou (1989) |
| 5255 | * Rewritten by Anders Lindgren (1996) | 5255 | * Rewritten by Anders Lindgren (1996) |
| 5256 | */ | 5256 | */ |
| 5257 | static int prolog_pr (char *, char *); | 5257 | static size_t prolog_pr (char *, char *); |
| 5258 | static void prolog_skip_comment (linebuffer *, FILE *); | 5258 | static void prolog_skip_comment (linebuffer *, FILE *); |
| 5259 | static int prolog_atom (char *, int); | 5259 | static size_t prolog_atom (char *, size_t); |
| 5260 | 5260 | ||
| 5261 | static void | 5261 | static void |
| 5262 | Prolog_functions (FILE *inf) | 5262 | Prolog_functions (FILE *inf) |
| 5263 | { | 5263 | { |
| 5264 | char *cp, *last; | 5264 | char *cp, *last; |
| 5265 | int len; | 5265 | size_t len; |
| 5266 | int allocated; | 5266 | size_t allocated; |
| 5267 | 5267 | ||
| 5268 | allocated = 0; | 5268 | allocated = 0; |
| 5269 | len = 0; | 5269 | len = 0; |
| @@ -5320,16 +5320,16 @@ prolog_skip_comment (linebuffer *plb, FILE *inf) | |||
| 5320 | * Return the size of the name of the predicate or rule, or 0 if no | 5320 | * Return the size of the name of the predicate or rule, or 0 if no |
| 5321 | * header was found. | 5321 | * header was found. |
| 5322 | */ | 5322 | */ |
| 5323 | static int | 5323 | static size_t |
| 5324 | prolog_pr (char *s, char *last) | 5324 | prolog_pr (char *s, char *last) |
| 5325 | 5325 | ||
| 5326 | /* Name of last clause. */ | 5326 | /* Name of last clause. */ |
| 5327 | { | 5327 | { |
| 5328 | int pos; | 5328 | size_t pos; |
| 5329 | int len; | 5329 | size_t len; |
| 5330 | 5330 | ||
| 5331 | pos = prolog_atom (s, 0); | 5331 | pos = prolog_atom (s, 0); |
| 5332 | if (pos < 1) | 5332 | if (! pos) |
| 5333 | return 0; | 5333 | return 0; |
| 5334 | 5334 | ||
| 5335 | len = pos; | 5335 | len = pos; |
| @@ -5339,7 +5339,7 @@ prolog_pr (char *s, char *last) | |||
| 5339 | || (s[pos] == '(' && (pos += 1)) | 5339 | || (s[pos] == '(' && (pos += 1)) |
| 5340 | || (s[pos] == ':' && s[pos + 1] == '-' && (pos += 2))) | 5340 | || (s[pos] == ':' && s[pos + 1] == '-' && (pos += 2))) |
| 5341 | && (last == NULL /* save only the first clause */ | 5341 | && (last == NULL /* save only the first clause */ |
| 5342 | || len != (int)strlen (last) | 5342 | || len != strlen (last) |
| 5343 | || !strneq (s, last, len))) | 5343 | || !strneq (s, last, len))) |
| 5344 | { | 5344 | { |
| 5345 | make_tag (s, len, TRUE, s, pos, lineno, linecharno); | 5345 | make_tag (s, len, TRUE, s, pos, lineno, linecharno); |
| @@ -5351,17 +5351,17 @@ prolog_pr (char *s, char *last) | |||
| 5351 | 5351 | ||
| 5352 | /* | 5352 | /* |
| 5353 | * Consume a Prolog atom. | 5353 | * Consume a Prolog atom. |
| 5354 | * Return the number of bytes consumed, or -1 if there was an error. | 5354 | * Return the number of bytes consumed, or 0 if there was an error. |
| 5355 | * | 5355 | * |
| 5356 | * A prolog atom, in this context, could be one of: | 5356 | * A prolog atom, in this context, could be one of: |
| 5357 | * - An alphanumeric sequence, starting with a lower case letter. | 5357 | * - An alphanumeric sequence, starting with a lower case letter. |
| 5358 | * - A quoted arbitrary string. Single quotes can escape themselves. | 5358 | * - A quoted arbitrary string. Single quotes can escape themselves. |
| 5359 | * Backslash quotes everything. | 5359 | * Backslash quotes everything. |
| 5360 | */ | 5360 | */ |
| 5361 | static int | 5361 | static size_t |
| 5362 | prolog_atom (char *s, int pos) | 5362 | prolog_atom (char *s, size_t pos) |
| 5363 | { | 5363 | { |
| 5364 | int origpos; | 5364 | size_t origpos; |
| 5365 | 5365 | ||
| 5366 | origpos = pos; | 5366 | origpos = pos; |
| 5367 | 5367 | ||
| @@ -5390,11 +5390,11 @@ prolog_atom (char *s, int pos) | |||
| 5390 | } | 5390 | } |
| 5391 | else if (s[pos] == '\0') | 5391 | else if (s[pos] == '\0') |
| 5392 | /* Multiline quoted atoms are ignored. */ | 5392 | /* Multiline quoted atoms are ignored. */ |
| 5393 | return -1; | 5393 | return 0; |
| 5394 | else if (s[pos] == '\\') | 5394 | else if (s[pos] == '\\') |
| 5395 | { | 5395 | { |
| 5396 | if (s[pos+1] == '\0') | 5396 | if (s[pos+1] == '\0') |
| 5397 | return -1; | 5397 | return 0; |
| 5398 | pos += 2; | 5398 | pos += 2; |
| 5399 | } | 5399 | } |
| 5400 | else | 5400 | else |
| @@ -5403,7 +5403,7 @@ prolog_atom (char *s, int pos) | |||
| 5403 | return pos - origpos; | 5403 | return pos - origpos; |
| 5404 | } | 5404 | } |
| 5405 | else | 5405 | else |
| 5406 | return -1; | 5406 | return 0; |
| 5407 | } | 5407 | } |
| 5408 | 5408 | ||
| 5409 | 5409 | ||
diff --git a/lib-src/fakemail.c b/lib-src/fakemail.c index 780a104b405..940d6219425 100644 --- a/lib-src/fakemail.c +++ b/lib-src/fakemail.c | |||
| @@ -62,8 +62,6 @@ main () | |||
| 62 | 62 | ||
| 63 | /* This is to declare cuserid. */ | 63 | /* This is to declare cuserid. */ |
| 64 | #include <unistd.h> | 64 | #include <unistd.h> |
| 65 | |||
| 66 | #include <ignore-value.h> | ||
| 67 | 65 | ||
| 68 | /* Type definitions */ | 66 | /* Type definitions */ |
| 69 | 67 | ||
| @@ -500,7 +498,7 @@ put_line (const char *string) | |||
| 500 | } | 498 | } |
| 501 | } | 499 | } |
| 502 | /* Output that much, then break the line. */ | 500 | /* Output that much, then break the line. */ |
| 503 | ignore_value (fwrite (s, 1, breakpos - s, rem->handle)); | 501 | fwrite (s, 1, breakpos - s, rem->handle); |
| 504 | column = 8; | 502 | column = 8; |
| 505 | 503 | ||
| 506 | /* Skip whitespace and prepare to print more addresses. */ | 504 | /* Skip whitespace and prepare to print more addresses. */ |
diff --git a/lib-src/update-game-score.c b/lib-src/update-game-score.c index 70b79a64f91..e95e2ce259d 100644 --- a/lib-src/update-game-score.c +++ b/lib-src/update-game-score.c | |||
| @@ -242,13 +242,15 @@ main (int argc, char **argv) | |||
| 242 | push_score (&scores, &scorecount, newscore, user_id, newdata); | 242 | push_score (&scores, &scorecount, newscore, user_id, newdata); |
| 243 | sort_scores (scores, scorecount, reverse); | 243 | sort_scores (scores, scorecount, reverse); |
| 244 | /* Limit the number of scores. If we're using reverse sorting, then | 244 | /* Limit the number of scores. If we're using reverse sorting, then |
| 245 | we should increment the beginning of the array, to skip over the | 245 | also increment the beginning of the array, to skip over the |
| 246 | *smallest* scores. Otherwise, we just decrement the number of | 246 | *smallest* scores. Otherwise, just decrementing the number of |
| 247 | scores, since the smallest will be at the end. */ | 247 | scores suffices, since the smallest is at the end. */ |
| 248 | if (scorecount > MAX_SCORES) | 248 | if (scorecount > MAX_SCORES) |
| 249 | scorecount -= (scorecount - MAX_SCORES); | 249 | { |
| 250 | if (reverse) | 250 | if (reverse) |
| 251 | scores += (scorecount - MAX_SCORES); | 251 | scores += (scorecount - MAX_SCORES); |
| 252 | scorecount = MAX_SCORES; | ||
| 253 | } | ||
| 252 | if (write_scores (scorefile, scores, scorecount) < 0) | 254 | if (write_scores (scorefile, scores, scorecount) < 0) |
| 253 | { | 255 | { |
| 254 | unlock_file (scorefile, lockstate); | 256 | unlock_file (scorefile, lockstate); |
diff --git a/lib/gnulib.mk b/lib/gnulib.mk index cd6a1d00c15..030f95b7a68 100644 --- a/lib/gnulib.mk +++ b/lib/gnulib.mk | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | # the same distribution terms as the rest of that program. | 9 | # the same distribution terms as the rest of that program. |
| 10 | # | 10 | # |
| 11 | # Generated by gnulib-tool. | 11 | # Generated by gnulib-tool. |
| 12 | # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value intprops lstat mktime readlink strftime symlink sys_stat | 12 | # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value intprops lstat mktime readlink socklen stdio strftime symlink sys_stat |
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | MOSTLYCLEANFILES += core *.stackdump | 15 | MOSTLYCLEANFILES += core *.stackdump |
| @@ -280,6 +280,117 @@ EXTRA_DIST += stdint.in.h | |||
| 280 | 280 | ||
| 281 | ## end gnulib module stdint | 281 | ## end gnulib module stdint |
| 282 | 282 | ||
| 283 | ## begin gnulib module stdio | ||
| 284 | |||
| 285 | BUILT_SOURCES += stdio.h | ||
| 286 | |||
| 287 | # We need the following in order to create <stdio.h> when the system | ||
| 288 | # doesn't have one that works with the given compiler. | ||
| 289 | stdio.h: stdio.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) | ||
| 290 | $(AM_V_GEN)rm -f $@-t $@ && \ | ||
| 291 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ | ||
| 292 | sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ | ||
| 293 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ | ||
| 294 | -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ | ||
| 295 | -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \ | ||
| 296 | -e 's|@''GNULIB_DPRINTF''@|$(GNULIB_DPRINTF)|g' \ | ||
| 297 | -e 's|@''GNULIB_FCLOSE''@|$(GNULIB_FCLOSE)|g' \ | ||
| 298 | -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \ | ||
| 299 | -e 's|@''GNULIB_FOPEN''@|$(GNULIB_FOPEN)|g' \ | ||
| 300 | -e 's|@''GNULIB_FPRINTF''@|$(GNULIB_FPRINTF)|g' \ | ||
| 301 | -e 's|@''GNULIB_FPRINTF_POSIX''@|$(GNULIB_FPRINTF_POSIX)|g' \ | ||
| 302 | -e 's|@''GNULIB_FPURGE''@|$(GNULIB_FPURGE)|g' \ | ||
| 303 | -e 's|@''GNULIB_FPUTC''@|$(GNULIB_FPUTC)|g' \ | ||
| 304 | -e 's|@''GNULIB_FPUTS''@|$(GNULIB_FPUTS)|g' \ | ||
| 305 | -e 's|@''GNULIB_FREOPEN''@|$(GNULIB_FREOPEN)|g' \ | ||
| 306 | -e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \ | ||
| 307 | -e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \ | ||
| 308 | -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \ | ||
| 309 | -e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \ | ||
| 310 | -e 's|@''GNULIB_FWRITE''@|$(GNULIB_FWRITE)|g' \ | ||
| 311 | -e 's|@''GNULIB_GETDELIM''@|$(GNULIB_GETDELIM)|g' \ | ||
| 312 | -e 's|@''GNULIB_GETLINE''@|$(GNULIB_GETLINE)|g' \ | ||
| 313 | -e 's|@''GNULIB_OBSTACK_PRINTF''@|$(GNULIB_OBSTACK_PRINTF)|g' \ | ||
| 314 | -e 's|@''GNULIB_OBSTACK_PRINTF_POSIX''@|$(GNULIB_OBSTACK_PRINTF_POSIX)|g' \ | ||
| 315 | -e 's|@''GNULIB_PERROR''@|$(GNULIB_PERROR)|g' \ | ||
| 316 | -e 's|@''GNULIB_POPEN''@|$(GNULIB_POPEN)|g' \ | ||
| 317 | -e 's|@''GNULIB_PRINTF''@|$(GNULIB_PRINTF)|g' \ | ||
| 318 | -e 's|@''GNULIB_PRINTF_POSIX''@|$(GNULIB_PRINTF_POSIX)|g' \ | ||
| 319 | -e 's|@''GNULIB_PUTC''@|$(GNULIB_PUTC)|g' \ | ||
| 320 | -e 's|@''GNULIB_PUTCHAR''@|$(GNULIB_PUTCHAR)|g' \ | ||
| 321 | -e 's|@''GNULIB_PUTS''@|$(GNULIB_PUTS)|g' \ | ||
| 322 | -e 's|@''GNULIB_REMOVE''@|$(GNULIB_REMOVE)|g' \ | ||
| 323 | -e 's|@''GNULIB_RENAME''@|$(GNULIB_RENAME)|g' \ | ||
| 324 | -e 's|@''GNULIB_RENAMEAT''@|$(GNULIB_RENAMEAT)|g' \ | ||
| 325 | -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \ | ||
| 326 | -e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \ | ||
| 327 | -e 's|@''GNULIB_STDIO_H_SIGPIPE''@|$(GNULIB_STDIO_H_SIGPIPE)|g' \ | ||
| 328 | -e 's|@''GNULIB_TMPFILE''@|$(GNULIB_TMPFILE)|g' \ | ||
| 329 | -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \ | ||
| 330 | -e 's|@''GNULIB_VDPRINTF''@|$(GNULIB_VDPRINTF)|g' \ | ||
| 331 | -e 's|@''GNULIB_VFPRINTF''@|$(GNULIB_VFPRINTF)|g' \ | ||
| 332 | -e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \ | ||
| 333 | -e 's|@''GNULIB_VPRINTF''@|$(GNULIB_VPRINTF)|g' \ | ||
| 334 | -e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \ | ||
| 335 | -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \ | ||
| 336 | -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \ | ||
| 337 | < $(srcdir)/stdio.in.h | \ | ||
| 338 | sed -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \ | ||
| 339 | -e 's|@''HAVE_DECL_FSEEKO''@|$(HAVE_DECL_FSEEKO)|g' \ | ||
| 340 | -e 's|@''HAVE_DECL_FTELLO''@|$(HAVE_DECL_FTELLO)|g' \ | ||
| 341 | -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \ | ||
| 342 | -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \ | ||
| 343 | -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \ | ||
| 344 | -e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \ | ||
| 345 | -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \ | ||
| 346 | -e 's|@''HAVE_DPRINTF''@|$(HAVE_DPRINTF)|g' \ | ||
| 347 | -e 's|@''HAVE_FSEEKO''@|$(HAVE_FSEEKO)|g' \ | ||
| 348 | -e 's|@''HAVE_FTELLO''@|$(HAVE_FTELLO)|g' \ | ||
| 349 | -e 's|@''HAVE_RENAMEAT''@|$(HAVE_RENAMEAT)|g' \ | ||
| 350 | -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \ | ||
| 351 | -e 's|@''HAVE_VDPRINTF''@|$(HAVE_VDPRINTF)|g' \ | ||
| 352 | -e 's|@''REPLACE_DPRINTF''@|$(REPLACE_DPRINTF)|g' \ | ||
| 353 | -e 's|@''REPLACE_FCLOSE''@|$(REPLACE_FCLOSE)|g' \ | ||
| 354 | -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \ | ||
| 355 | -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \ | ||
| 356 | -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \ | ||
| 357 | -e 's|@''REPLACE_FPURGE''@|$(REPLACE_FPURGE)|g' \ | ||
| 358 | -e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \ | ||
| 359 | -e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \ | ||
| 360 | -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \ | ||
| 361 | -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \ | ||
| 362 | -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \ | ||
| 363 | -e 's|@''REPLACE_GETDELIM''@|$(REPLACE_GETDELIM)|g' \ | ||
| 364 | -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \ | ||
| 365 | -e 's|@''REPLACE_OBSTACK_PRINTF''@|$(REPLACE_OBSTACK_PRINTF)|g' \ | ||
| 366 | -e 's|@''REPLACE_PERROR''@|$(REPLACE_PERROR)|g' \ | ||
| 367 | -e 's|@''REPLACE_POPEN''@|$(REPLACE_POPEN)|g' \ | ||
| 368 | -e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \ | ||
| 369 | -e 's|@''REPLACE_REMOVE''@|$(REPLACE_REMOVE)|g' \ | ||
| 370 | -e 's|@''REPLACE_RENAME''@|$(REPLACE_RENAME)|g' \ | ||
| 371 | -e 's|@''REPLACE_RENAMEAT''@|$(REPLACE_RENAMEAT)|g' \ | ||
| 372 | -e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \ | ||
| 373 | -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \ | ||
| 374 | -e 's|@''REPLACE_STDIO_WRITE_FUNCS''@|$(REPLACE_STDIO_WRITE_FUNCS)|g' \ | ||
| 375 | -e 's|@''REPLACE_TMPFILE''@|$(REPLACE_TMPFILE)|g' \ | ||
| 376 | -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \ | ||
| 377 | -e 's|@''REPLACE_VDPRINTF''@|$(REPLACE_VDPRINTF)|g' \ | ||
| 378 | -e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \ | ||
| 379 | -e 's|@''REPLACE_VPRINTF''@|$(REPLACE_VPRINTF)|g' \ | ||
| 380 | -e 's|@''REPLACE_VSNPRINTF''@|$(REPLACE_VSNPRINTF)|g' \ | ||
| 381 | -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \ | ||
| 382 | -e 's|@''ASM_SYMBOL_PREFIX''@|$(ASM_SYMBOL_PREFIX)|g' \ | ||
| 383 | -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ | ||
| 384 | -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ | ||
| 385 | -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ | ||
| 386 | } > $@-t && \ | ||
| 387 | mv $@-t $@ | ||
| 388 | MOSTLYCLEANFILES += stdio.h stdio.h-t | ||
| 389 | |||
| 390 | EXTRA_DIST += stdio.in.h | ||
| 391 | |||
| 392 | ## end gnulib module stdio | ||
| 393 | |||
| 283 | ## begin gnulib module stdlib | 394 | ## begin gnulib module stdlib |
| 284 | 395 | ||
| 285 | BUILT_SOURCES += stdlib.h | 396 | BUILT_SOURCES += stdlib.h |
diff --git a/lib/stdio.in.h b/lib/stdio.in.h new file mode 100644 index 00000000000..dd31ce29ed1 --- /dev/null +++ b/lib/stdio.in.h | |||
| @@ -0,0 +1,1119 @@ | |||
| 1 | /* A GNU-like <stdio.h>. | ||
| 2 | |||
| 3 | Copyright (C) 2004, 2007-2011 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | This program is free software; you can redistribute it and/or modify | ||
| 6 | it under the terms of the GNU General Public License as published by | ||
| 7 | the Free Software Foundation; either version 3, or (at your option) | ||
| 8 | any later version. | ||
| 9 | |||
| 10 | This program is distributed in the hope that it will be useful, | ||
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | GNU General Public License for more details. | ||
| 14 | |||
| 15 | You should have received a copy of the GNU General Public License | ||
| 16 | along with this program; if not, write to the Free Software Foundation, | ||
| 17 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | ||
| 18 | |||
| 19 | #if __GNUC__ >= 3 | ||
| 20 | @PRAGMA_SYSTEM_HEADER@ | ||
| 21 | #endif | ||
| 22 | @PRAGMA_COLUMNS@ | ||
| 23 | |||
| 24 | #if defined __need_FILE || defined __need___FILE || defined _GL_ALREADY_INCLUDING_STDIO_H | ||
| 25 | /* Special invocation convention: | ||
| 26 | - Inside glibc header files. | ||
| 27 | - On OSF/1 5.1 we have a sequence of nested includes | ||
| 28 | <stdio.h> -> <getopt.h> -> <ctype.h> -> <sys/localedef.h> -> | ||
| 29 | <sys/lc_core.h> -> <nl_types.h> -> <mesg.h> -> <stdio.h>. | ||
| 30 | In this situation, the functions are not yet declared, therefore we cannot | ||
| 31 | provide the C++ aliases. */ | ||
| 32 | |||
| 33 | #@INCLUDE_NEXT@ @NEXT_STDIO_H@ | ||
| 34 | |||
| 35 | #else | ||
| 36 | /* Normal invocation convention. */ | ||
| 37 | |||
| 38 | #ifndef _GL_STDIO_H | ||
| 39 | |||
| 40 | #define _GL_ALREADY_INCLUDING_STDIO_H | ||
| 41 | |||
| 42 | /* The include_next requires a split double-inclusion guard. */ | ||
| 43 | #@INCLUDE_NEXT@ @NEXT_STDIO_H@ | ||
| 44 | |||
| 45 | #undef _GL_ALREADY_INCLUDING_STDIO_H | ||
| 46 | |||
| 47 | #ifndef _GL_STDIO_H | ||
| 48 | #define _GL_STDIO_H | ||
| 49 | |||
| 50 | /* Get va_list. Needed on many systems, including glibc 2.8. */ | ||
| 51 | #include <stdarg.h> | ||
| 52 | |||
| 53 | #include <stddef.h> | ||
| 54 | |||
| 55 | /* Get off_t and ssize_t. Needed on many systems, including glibc 2.8 | ||
| 56 | and eglibc 2.11.2. */ | ||
| 57 | #include <sys/types.h> | ||
| 58 | |||
| 59 | /* The __attribute__ feature is available in gcc versions 2.5 and later. | ||
| 60 | The __-protected variants of the attributes 'format' and 'printf' are | ||
| 61 | accepted by gcc versions 2.6.4 (effectively 2.7) and later. | ||
| 62 | We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because | ||
| 63 | gnulib and libintl do '#define printf __printf__' when they override | ||
| 64 | the 'printf' function. */ | ||
| 65 | #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) | ||
| 66 | # define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) | ||
| 67 | #else | ||
| 68 | # define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ | ||
| 69 | #endif | ||
| 70 | #define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \ | ||
| 71 | _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument)) | ||
| 72 | |||
| 73 | /* Solaris 10 declares renameat in <unistd.h>, not in <stdio.h>. */ | ||
| 74 | /* But in any case avoid namespace pollution on glibc systems. */ | ||
| 75 | #if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __sun \ | ||
| 76 | && ! defined __GLIBC__ | ||
| 77 | # include <unistd.h> | ||
| 78 | #endif | ||
| 79 | |||
| 80 | |||
| 81 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ | ||
| 82 | |||
| 83 | /* The definition of _GL_ARG_NONNULL is copied here. */ | ||
| 84 | |||
| 85 | /* The definition of _GL_WARN_ON_USE is copied here. */ | ||
| 86 | |||
| 87 | /* Macros for stringification. */ | ||
| 88 | #define _GL_STDIO_STRINGIZE(token) #token | ||
| 89 | #define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token) | ||
| 90 | |||
| 91 | |||
| 92 | #if @GNULIB_DPRINTF@ | ||
| 93 | # if @REPLACE_DPRINTF@ | ||
| 94 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 95 | # define dprintf rpl_dprintf | ||
| 96 | # endif | ||
| 97 | _GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *format, ...) | ||
| 98 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) | ||
| 99 | _GL_ARG_NONNULL ((2))); | ||
| 100 | _GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *format, ...)); | ||
| 101 | # else | ||
| 102 | # if !@HAVE_DPRINTF@ | ||
| 103 | _GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *format, ...) | ||
| 104 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) | ||
| 105 | _GL_ARG_NONNULL ((2))); | ||
| 106 | # endif | ||
| 107 | _GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *format, ...)); | ||
| 108 | # endif | ||
| 109 | _GL_CXXALIASWARN (dprintf); | ||
| 110 | #elif defined GNULIB_POSIXCHECK | ||
| 111 | # undef dprintf | ||
| 112 | # if HAVE_RAW_DECL_DPRINTF | ||
| 113 | _GL_WARN_ON_USE (dprintf, "dprintf is unportable - " | ||
| 114 | "use gnulib module dprintf for portability"); | ||
| 115 | # endif | ||
| 116 | #endif | ||
| 117 | |||
| 118 | #if @GNULIB_FCLOSE@ | ||
| 119 | /* Close STREAM and its underlying file descriptor. */ | ||
| 120 | # if @REPLACE_FCLOSE@ | ||
| 121 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 122 | # define fclose rpl_fclose | ||
| 123 | # endif | ||
| 124 | _GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1))); | ||
| 125 | _GL_CXXALIAS_RPL (fclose, int, (FILE *stream)); | ||
| 126 | # else | ||
| 127 | _GL_CXXALIAS_SYS (fclose, int, (FILE *stream)); | ||
| 128 | # endif | ||
| 129 | _GL_CXXALIASWARN (fclose); | ||
| 130 | #elif defined GNULIB_POSIXCHECK | ||
| 131 | # undef fclose | ||
| 132 | /* Assume fclose is always declared. */ | ||
| 133 | _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - " | ||
| 134 | "use gnulib module fclose for portable POSIX compliance"); | ||
| 135 | #endif | ||
| 136 | |||
| 137 | #if @GNULIB_FFLUSH@ | ||
| 138 | /* Flush all pending data on STREAM according to POSIX rules. Both | ||
| 139 | output and seekable input streams are supported. | ||
| 140 | Note! LOSS OF DATA can occur if fflush is applied on an input stream | ||
| 141 | that is _not_seekable_ or on an update stream that is _not_seekable_ | ||
| 142 | and in which the most recent operation was input. Seekability can | ||
| 143 | be tested with lseek(fileno(fp),0,SEEK_CUR). */ | ||
| 144 | # if @REPLACE_FFLUSH@ | ||
| 145 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 146 | # define fflush rpl_fflush | ||
| 147 | # endif | ||
| 148 | _GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream)); | ||
| 149 | _GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream)); | ||
| 150 | # else | ||
| 151 | _GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream)); | ||
| 152 | # endif | ||
| 153 | _GL_CXXALIASWARN (fflush); | ||
| 154 | #elif defined GNULIB_POSIXCHECK | ||
| 155 | # undef fflush | ||
| 156 | /* Assume fflush is always declared. */ | ||
| 157 | _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - " | ||
| 158 | "use gnulib module fflush for portable POSIX compliance"); | ||
| 159 | #endif | ||
| 160 | |||
| 161 | /* It is very rare that the developer ever has full control of stdin, | ||
| 162 | so any use of gets warrants an unconditional warning. Assume it is | ||
| 163 | always declared, since it is required by C89. */ | ||
| 164 | #undef gets | ||
| 165 | _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); | ||
| 166 | |||
| 167 | #if @GNULIB_FOPEN@ | ||
| 168 | # if @REPLACE_FOPEN@ | ||
| 169 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 170 | # undef fopen | ||
| 171 | # define fopen rpl_fopen | ||
| 172 | # endif | ||
| 173 | _GL_FUNCDECL_RPL (fopen, FILE *, (const char *filename, const char *mode) | ||
| 174 | _GL_ARG_NONNULL ((1, 2))); | ||
| 175 | _GL_CXXALIAS_RPL (fopen, FILE *, (const char *filename, const char *mode)); | ||
| 176 | # else | ||
| 177 | _GL_CXXALIAS_SYS (fopen, FILE *, (const char *filename, const char *mode)); | ||
| 178 | # endif | ||
| 179 | _GL_CXXALIASWARN (fopen); | ||
| 180 | #elif defined GNULIB_POSIXCHECK | ||
| 181 | # undef fopen | ||
| 182 | /* Assume fopen is always declared. */ | ||
| 183 | _GL_WARN_ON_USE (fopen, "fopen on Win32 platforms is not POSIX compatible - " | ||
| 184 | "use gnulib module fopen for portability"); | ||
| 185 | #endif | ||
| 186 | |||
| 187 | #if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@ | ||
| 188 | # if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \ | ||
| 189 | || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@) | ||
| 190 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 191 | # define fprintf rpl_fprintf | ||
| 192 | # endif | ||
| 193 | # define GNULIB_overrides_fprintf 1 | ||
| 194 | _GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...) | ||
| 195 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) | ||
| 196 | _GL_ARG_NONNULL ((1, 2))); | ||
| 197 | _GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...)); | ||
| 198 | # else | ||
| 199 | _GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...)); | ||
| 200 | # endif | ||
| 201 | _GL_CXXALIASWARN (fprintf); | ||
| 202 | #endif | ||
| 203 | #if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK | ||
| 204 | # if !GNULIB_overrides_fprintf | ||
| 205 | # undef fprintf | ||
| 206 | # endif | ||
| 207 | /* Assume fprintf is always declared. */ | ||
| 208 | _GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - " | ||
| 209 | "use gnulib module fprintf-posix for portable " | ||
| 210 | "POSIX compliance"); | ||
| 211 | #endif | ||
| 212 | |||
| 213 | #if @GNULIB_FPURGE@ | ||
| 214 | /* Discard all pending buffered I/O data on STREAM. | ||
| 215 | STREAM must not be wide-character oriented. | ||
| 216 | When discarding pending output, the file position is set back to where it | ||
| 217 | was before the write calls. When discarding pending input, the file | ||
| 218 | position is advanced to match the end of the previously read input. | ||
| 219 | Return 0 if successful. Upon error, return -1 and set errno. */ | ||
| 220 | # if @REPLACE_FPURGE@ | ||
| 221 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 222 | # define fpurge rpl_fpurge | ||
| 223 | # endif | ||
| 224 | _GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1))); | ||
| 225 | _GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream)); | ||
| 226 | # else | ||
| 227 | # if !@HAVE_DECL_FPURGE@ | ||
| 228 | _GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1))); | ||
| 229 | # endif | ||
| 230 | _GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream)); | ||
| 231 | # endif | ||
| 232 | _GL_CXXALIASWARN (fpurge); | ||
| 233 | #elif defined GNULIB_POSIXCHECK | ||
| 234 | # undef fpurge | ||
| 235 | # if HAVE_RAW_DECL_FPURGE | ||
| 236 | _GL_WARN_ON_USE (fpurge, "fpurge is not always present - " | ||
| 237 | "use gnulib module fpurge for portability"); | ||
| 238 | # endif | ||
| 239 | #endif | ||
| 240 | |||
| 241 | #if @GNULIB_FPUTC@ | ||
| 242 | # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ | ||
| 243 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 244 | # undef fputc | ||
| 245 | # define fputc rpl_fputc | ||
| 246 | # endif | ||
| 247 | _GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2))); | ||
| 248 | _GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream)); | ||
| 249 | # else | ||
| 250 | _GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream)); | ||
| 251 | # endif | ||
| 252 | _GL_CXXALIASWARN (fputc); | ||
| 253 | #endif | ||
| 254 | |||
| 255 | #if @GNULIB_FPUTS@ | ||
| 256 | # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ | ||
| 257 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 258 | # undef fputs | ||
| 259 | # define fputs rpl_fputs | ||
| 260 | # endif | ||
| 261 | _GL_FUNCDECL_RPL (fputs, int, (const char *string, FILE *stream) | ||
| 262 | _GL_ARG_NONNULL ((1, 2))); | ||
| 263 | _GL_CXXALIAS_RPL (fputs, int, (const char *string, FILE *stream)); | ||
| 264 | # else | ||
| 265 | _GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream)); | ||
| 266 | # endif | ||
| 267 | _GL_CXXALIASWARN (fputs); | ||
| 268 | #endif | ||
| 269 | |||
| 270 | #if @GNULIB_FREOPEN@ | ||
| 271 | # if @REPLACE_FREOPEN@ | ||
| 272 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 273 | # undef freopen | ||
| 274 | # define freopen rpl_freopen | ||
| 275 | # endif | ||
| 276 | _GL_FUNCDECL_RPL (freopen, FILE *, | ||
| 277 | (const char *filename, const char *mode, FILE *stream) | ||
| 278 | _GL_ARG_NONNULL ((2, 3))); | ||
| 279 | _GL_CXXALIAS_RPL (freopen, FILE *, | ||
| 280 | (const char *filename, const char *mode, FILE *stream)); | ||
| 281 | # else | ||
| 282 | _GL_CXXALIAS_SYS (freopen, FILE *, | ||
| 283 | (const char *filename, const char *mode, FILE *stream)); | ||
| 284 | # endif | ||
| 285 | _GL_CXXALIASWARN (freopen); | ||
| 286 | #elif defined GNULIB_POSIXCHECK | ||
| 287 | # undef freopen | ||
| 288 | /* Assume freopen is always declared. */ | ||
| 289 | _GL_WARN_ON_USE (freopen, | ||
| 290 | "freopen on Win32 platforms is not POSIX compatible - " | ||
| 291 | "use gnulib module freopen for portability"); | ||
| 292 | #endif | ||
| 293 | |||
| 294 | |||
| 295 | /* Set up the following warnings, based on which modules are in use. | ||
| 296 | GNU Coding Standards discourage the use of fseek, since it imposes | ||
| 297 | an arbitrary limitation on some 32-bit hosts. Remember that the | ||
| 298 | fseek module depends on the fseeko module, so we only have three | ||
| 299 | cases to consider: | ||
| 300 | |||
| 301 | 1. The developer is not using either module. Issue a warning under | ||
| 302 | GNULIB_POSIXCHECK for both functions, to remind them that both | ||
| 303 | functions have bugs on some systems. _GL_NO_LARGE_FILES has no | ||
| 304 | impact on this warning. | ||
| 305 | |||
| 306 | 2. The developer is using both modules. They may be unaware of the | ||
| 307 | arbitrary limitations of fseek, so issue a warning under | ||
| 308 | GNULIB_POSIXCHECK. On the other hand, they may be using both | ||
| 309 | modules intentionally, so the developer can define | ||
| 310 | _GL_NO_LARGE_FILES in the compilation units where the use of fseek | ||
| 311 | is safe, to silence the warning. | ||
| 312 | |||
| 313 | 3. The developer is using the fseeko module, but not fseek. Gnulib | ||
| 314 | guarantees that fseek will still work around platform bugs in that | ||
| 315 | case, but we presume that the developer is aware of the pitfalls of | ||
| 316 | fseek and was trying to avoid it, so issue a warning even when | ||
| 317 | GNULIB_POSIXCHECK is undefined. Again, _GL_NO_LARGE_FILES can be | ||
| 318 | defined to silence the warning in particular compilation units. | ||
| 319 | In C++ compilations with GNULIB_NAMESPACE, in order to avoid that | ||
| 320 | fseek gets defined as a macro, it is recommended that the developer | ||
| 321 | uses the fseek module, even if he is not calling the fseek function. | ||
| 322 | |||
| 323 | Most gnulib clients that perform stream operations should fall into | ||
| 324 | category 3. */ | ||
| 325 | |||
| 326 | #if @GNULIB_FSEEK@ | ||
| 327 | # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES | ||
| 328 | # define _GL_FSEEK_WARN /* Category 2, above. */ | ||
| 329 | # undef fseek | ||
| 330 | # endif | ||
| 331 | # if @REPLACE_FSEEK@ | ||
| 332 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 333 | # undef fseek | ||
| 334 | # define fseek rpl_fseek | ||
| 335 | # endif | ||
| 336 | _GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence) | ||
| 337 | _GL_ARG_NONNULL ((1))); | ||
| 338 | _GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence)); | ||
| 339 | # else | ||
| 340 | _GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence)); | ||
| 341 | # endif | ||
| 342 | _GL_CXXALIASWARN (fseek); | ||
| 343 | #endif | ||
| 344 | |||
| 345 | #if @GNULIB_FSEEKO@ | ||
| 346 | # if !@GNULIB_FSEEK@ && !defined _GL_NO_LARGE_FILES | ||
| 347 | # define _GL_FSEEK_WARN /* Category 3, above. */ | ||
| 348 | # undef fseek | ||
| 349 | # endif | ||
| 350 | # if @REPLACE_FSEEKO@ | ||
| 351 | /* Provide an fseeko function that is aware of a preceding fflush(), and which | ||
| 352 | detects pipes. */ | ||
| 353 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 354 | # undef fseeko | ||
| 355 | # define fseeko rpl_fseeko | ||
| 356 | # endif | ||
| 357 | _GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence) | ||
| 358 | _GL_ARG_NONNULL ((1))); | ||
| 359 | _GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)); | ||
| 360 | # else | ||
| 361 | # if ! @HAVE_DECL_FSEEKO@ | ||
| 362 | _GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence) | ||
| 363 | _GL_ARG_NONNULL ((1))); | ||
| 364 | # endif | ||
| 365 | _GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)); | ||
| 366 | # endif | ||
| 367 | _GL_CXXALIASWARN (fseeko); | ||
| 368 | # if (@REPLACE_FSEEKO@ || !@HAVE_FSEEKO@) && !@GNULIB_FSEEK@ | ||
| 369 | /* Provide an fseek function that is consistent with fseeko. */ | ||
| 370 | /* In order to avoid that fseek gets defined as a macro here, the | ||
| 371 | developer can request the 'fseek' module. */ | ||
| 372 | # if !GNULIB_defined_fseek_function | ||
| 373 | # undef fseek | ||
| 374 | # define fseek rpl_fseek | ||
| 375 | static inline int _GL_ARG_NONNULL ((1)) | ||
| 376 | rpl_fseek (FILE *fp, long offset, int whence) | ||
| 377 | { | ||
| 378 | # if @REPLACE_FSEEKO@ | ||
| 379 | return rpl_fseeko (fp, offset, whence); | ||
| 380 | # else | ||
| 381 | return fseeko (fp, offset, whence); | ||
| 382 | # endif | ||
| 383 | } | ||
| 384 | # define GNULIB_defined_fseek_function 1 | ||
| 385 | # endif | ||
| 386 | # endif | ||
| 387 | #elif defined GNULIB_POSIXCHECK | ||
| 388 | # define _GL_FSEEK_WARN /* Category 1, above. */ | ||
| 389 | # undef fseek | ||
| 390 | # undef fseeko | ||
| 391 | # if HAVE_RAW_DECL_FSEEKO | ||
| 392 | _GL_WARN_ON_USE (fseeko, "fseeko is unportable - " | ||
| 393 | "use gnulib module fseeko for portability"); | ||
| 394 | # endif | ||
| 395 | #endif | ||
| 396 | |||
| 397 | #ifdef _GL_FSEEK_WARN | ||
| 398 | # undef _GL_FSEEK_WARN | ||
| 399 | /* Here, either fseek is undefined (but C89 guarantees that it is | ||
| 400 | declared), or it is defined as rpl_fseek (declared above). */ | ||
| 401 | _GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB " | ||
| 402 | "on 32-bit platforms - " | ||
| 403 | "use fseeko function for handling of large files"); | ||
| 404 | #endif | ||
| 405 | |||
| 406 | |||
| 407 | /* ftell, ftello. See the comments on fseek/fseeko. */ | ||
| 408 | |||
| 409 | #if @GNULIB_FTELL@ | ||
| 410 | # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES | ||
| 411 | # define _GL_FTELL_WARN /* Category 2, above. */ | ||
| 412 | # undef ftell | ||
| 413 | # endif | ||
| 414 | # if @REPLACE_FTELL@ | ||
| 415 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 416 | # undef ftell | ||
| 417 | # define ftell rpl_ftell | ||
| 418 | # endif | ||
| 419 | _GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1))); | ||
| 420 | _GL_CXXALIAS_RPL (ftell, long, (FILE *fp)); | ||
| 421 | # else | ||
| 422 | _GL_CXXALIAS_SYS (ftell, long, (FILE *fp)); | ||
| 423 | # endif | ||
| 424 | _GL_CXXALIASWARN (ftell); | ||
| 425 | #endif | ||
| 426 | |||
| 427 | #if @GNULIB_FTELLO@ | ||
| 428 | # if !@GNULIB_FTELL@ && !defined _GL_NO_LARGE_FILES | ||
| 429 | # define _GL_FTELL_WARN /* Category 3, above. */ | ||
| 430 | # undef ftell | ||
| 431 | # endif | ||
| 432 | # if @REPLACE_FTELLO@ | ||
| 433 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 434 | # undef ftello | ||
| 435 | # define ftello rpl_ftello | ||
| 436 | # endif | ||
| 437 | _GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); | ||
| 438 | _GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp)); | ||
| 439 | # else | ||
| 440 | # if ! @HAVE_DECL_FTELLO@ | ||
| 441 | _GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); | ||
| 442 | # endif | ||
| 443 | _GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp)); | ||
| 444 | # endif | ||
| 445 | _GL_CXXALIASWARN (ftello); | ||
| 446 | # if (@REPLACE_FTELLO@ || !@HAVE_FTELLO@) && !@GNULIB_FTELL@ | ||
| 447 | /* Provide an ftell function that is consistent with ftello. */ | ||
| 448 | /* In order to avoid that ftell gets defined as a macro here, the | ||
| 449 | developer can request the 'ftell' module. */ | ||
| 450 | # if !GNULIB_defined_ftell_function | ||
| 451 | # undef ftell | ||
| 452 | # define ftell rpl_ftell | ||
| 453 | static inline long _GL_ARG_NONNULL ((1)) | ||
| 454 | rpl_ftell (FILE *f) | ||
| 455 | { | ||
| 456 | # if @REPLACE_FTELLO@ | ||
| 457 | return rpl_ftello (f); | ||
| 458 | # else | ||
| 459 | return ftello (f); | ||
| 460 | # endif | ||
| 461 | } | ||
| 462 | # define GNULIB_defined_ftell_function 1 | ||
| 463 | # endif | ||
| 464 | # endif | ||
| 465 | #elif defined GNULIB_POSIXCHECK | ||
| 466 | # define _GL_FTELL_WARN /* Category 1, above. */ | ||
| 467 | # undef ftell | ||
| 468 | # undef ftello | ||
| 469 | # if HAVE_RAW_DECL_FTELLO | ||
| 470 | _GL_WARN_ON_USE (ftello, "ftello is unportable - " | ||
| 471 | "use gnulib module ftello for portability"); | ||
| 472 | # endif | ||
| 473 | #endif | ||
| 474 | |||
| 475 | #ifdef _GL_FTELL_WARN | ||
| 476 | # undef _GL_FTELL_WARN | ||
| 477 | /* Here, either ftell is undefined (but C89 guarantees that it is | ||
| 478 | declared), or it is defined as rpl_ftell (declared above). */ | ||
| 479 | _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB " | ||
| 480 | "on 32-bit platforms - " | ||
| 481 | "use ftello function for handling of large files"); | ||
| 482 | #endif | ||
| 483 | |||
| 484 | |||
| 485 | #if @GNULIB_FWRITE@ | ||
| 486 | # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ | ||
| 487 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 488 | # undef fwrite | ||
| 489 | # define fwrite rpl_fwrite | ||
| 490 | # endif | ||
| 491 | _GL_FUNCDECL_RPL (fwrite, size_t, | ||
| 492 | (const void *ptr, size_t s, size_t n, FILE *stream) | ||
| 493 | _GL_ARG_NONNULL ((1, 4))); | ||
| 494 | _GL_CXXALIAS_RPL (fwrite, size_t, | ||
| 495 | (const void *ptr, size_t s, size_t n, FILE *stream)); | ||
| 496 | # else | ||
| 497 | _GL_CXXALIAS_SYS (fwrite, size_t, | ||
| 498 | (const void *ptr, size_t s, size_t n, FILE *stream)); | ||
| 499 | |||
| 500 | /* Work around glibc bug 11959 | ||
| 501 | <http://sources.redhat.com/bugzilla/show_bug.cgi?id=11959>, | ||
| 502 | which sometimes causes an unwanted diagnostic for fwrite calls. | ||
| 503 | This affects only function declaration attributes, so it's not | ||
| 504 | needed for C++. */ | ||
| 505 | # if !defined __cplusplus && 0 < __USE_FORTIFY_LEVEL | ||
| 506 | static inline size_t _GL_ARG_NONNULL ((1, 4)) | ||
| 507 | rpl_fwrite (const void *ptr, size_t s, size_t n, FILE *stream) | ||
| 508 | { | ||
| 509 | size_t r = fwrite (ptr, s, n, stream); | ||
| 510 | (void) r; | ||
| 511 | return r; | ||
| 512 | } | ||
| 513 | # undef fwrite | ||
| 514 | # define fwrite rpl_fwrite | ||
| 515 | # endif | ||
| 516 | # endif | ||
| 517 | _GL_CXXALIASWARN (fwrite); | ||
| 518 | #endif | ||
| 519 | |||
| 520 | #if @GNULIB_GETDELIM@ | ||
| 521 | /* Read input, up to (and including) the next occurrence of DELIMITER, from | ||
| 522 | STREAM, store it in *LINEPTR (and NUL-terminate it). | ||
| 523 | *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE | ||
| 524 | bytes of space. It is realloc'd as necessary. | ||
| 525 | Return the number of bytes read and stored at *LINEPTR (not including the | ||
| 526 | NUL terminator), or -1 on error or EOF. */ | ||
| 527 | # if @REPLACE_GETDELIM@ | ||
| 528 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 529 | # undef getdelim | ||
| 530 | # define getdelim rpl_getdelim | ||
| 531 | # endif | ||
| 532 | _GL_FUNCDECL_RPL (getdelim, ssize_t, | ||
| 533 | (char **lineptr, size_t *linesize, int delimiter, | ||
| 534 | FILE *stream) | ||
| 535 | _GL_ARG_NONNULL ((1, 2, 4))); | ||
| 536 | _GL_CXXALIAS_RPL (getdelim, ssize_t, | ||
| 537 | (char **lineptr, size_t *linesize, int delimiter, | ||
| 538 | FILE *stream)); | ||
| 539 | # else | ||
| 540 | # if !@HAVE_DECL_GETDELIM@ | ||
| 541 | _GL_FUNCDECL_SYS (getdelim, ssize_t, | ||
| 542 | (char **lineptr, size_t *linesize, int delimiter, | ||
| 543 | FILE *stream) | ||
| 544 | _GL_ARG_NONNULL ((1, 2, 4))); | ||
| 545 | # endif | ||
| 546 | _GL_CXXALIAS_SYS (getdelim, ssize_t, | ||
| 547 | (char **lineptr, size_t *linesize, int delimiter, | ||
| 548 | FILE *stream)); | ||
| 549 | # endif | ||
| 550 | _GL_CXXALIASWARN (getdelim); | ||
| 551 | #elif defined GNULIB_POSIXCHECK | ||
| 552 | # undef getdelim | ||
| 553 | # if HAVE_RAW_DECL_GETDELIM | ||
| 554 | _GL_WARN_ON_USE (getdelim, "getdelim is unportable - " | ||
| 555 | "use gnulib module getdelim for portability"); | ||
| 556 | # endif | ||
| 557 | #endif | ||
| 558 | |||
| 559 | #if @GNULIB_GETLINE@ | ||
| 560 | /* Read a line, up to (and including) the next newline, from STREAM, store it | ||
| 561 | in *LINEPTR (and NUL-terminate it). | ||
| 562 | *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE | ||
| 563 | bytes of space. It is realloc'd as necessary. | ||
| 564 | Return the number of bytes read and stored at *LINEPTR (not including the | ||
| 565 | NUL terminator), or -1 on error or EOF. */ | ||
| 566 | # if @REPLACE_GETLINE@ | ||
| 567 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 568 | # undef getline | ||
| 569 | # define getline rpl_getline | ||
| 570 | # endif | ||
| 571 | _GL_FUNCDECL_RPL (getline, ssize_t, | ||
| 572 | (char **lineptr, size_t *linesize, FILE *stream) | ||
| 573 | _GL_ARG_NONNULL ((1, 2, 3))); | ||
| 574 | _GL_CXXALIAS_RPL (getline, ssize_t, | ||
| 575 | (char **lineptr, size_t *linesize, FILE *stream)); | ||
| 576 | # else | ||
| 577 | # if !@HAVE_DECL_GETLINE@ | ||
| 578 | _GL_FUNCDECL_SYS (getline, ssize_t, | ||
| 579 | (char **lineptr, size_t *linesize, FILE *stream) | ||
| 580 | _GL_ARG_NONNULL ((1, 2, 3))); | ||
| 581 | # endif | ||
| 582 | _GL_CXXALIAS_SYS (getline, ssize_t, | ||
| 583 | (char **lineptr, size_t *linesize, FILE *stream)); | ||
| 584 | # endif | ||
| 585 | # if @HAVE_DECL_GETLINE@ | ||
| 586 | _GL_CXXALIASWARN (getline); | ||
| 587 | # endif | ||
| 588 | #elif defined GNULIB_POSIXCHECK | ||
| 589 | # undef getline | ||
| 590 | # if HAVE_RAW_DECL_GETLINE | ||
| 591 | _GL_WARN_ON_USE (getline, "getline is unportable - " | ||
| 592 | "use gnulib module getline for portability"); | ||
| 593 | # endif | ||
| 594 | #endif | ||
| 595 | |||
| 596 | #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@ | ||
| 597 | struct obstack; | ||
| 598 | /* Grow an obstack with formatted output. Return the number of | ||
| 599 | bytes added to OBS. No trailing nul byte is added, and the | ||
| 600 | object should be closed with obstack_finish before use. Upon | ||
| 601 | memory allocation error, call obstack_alloc_failed_handler. Upon | ||
| 602 | other error, return -1. */ | ||
| 603 | # if @REPLACE_OBSTACK_PRINTF@ | ||
| 604 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 605 | # define obstack_printf rpl_obstack_printf | ||
| 606 | # endif | ||
| 607 | _GL_FUNCDECL_RPL (obstack_printf, int, | ||
| 608 | (struct obstack *obs, const char *format, ...) | ||
| 609 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) | ||
| 610 | _GL_ARG_NONNULL ((1, 2))); | ||
| 611 | _GL_CXXALIAS_RPL (obstack_printf, int, | ||
| 612 | (struct obstack *obs, const char *format, ...)); | ||
| 613 | # else | ||
| 614 | # if !@HAVE_DECL_OBSTACK_PRINTF@ | ||
| 615 | _GL_FUNCDECL_SYS (obstack_printf, int, | ||
| 616 | (struct obstack *obs, const char *format, ...) | ||
| 617 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) | ||
| 618 | _GL_ARG_NONNULL ((1, 2))); | ||
| 619 | # endif | ||
| 620 | _GL_CXXALIAS_SYS (obstack_printf, int, | ||
| 621 | (struct obstack *obs, const char *format, ...)); | ||
| 622 | # endif | ||
| 623 | _GL_CXXALIASWARN (obstack_printf); | ||
| 624 | # if @REPLACE_OBSTACK_PRINTF@ | ||
| 625 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 626 | # define obstack_vprintf rpl_obstack_vprintf | ||
| 627 | # endif | ||
| 628 | _GL_FUNCDECL_RPL (obstack_vprintf, int, | ||
| 629 | (struct obstack *obs, const char *format, va_list args) | ||
| 630 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) | ||
| 631 | _GL_ARG_NONNULL ((1, 2))); | ||
| 632 | _GL_CXXALIAS_RPL (obstack_vprintf, int, | ||
| 633 | (struct obstack *obs, const char *format, va_list args)); | ||
| 634 | # else | ||
| 635 | # if !@HAVE_DECL_OBSTACK_PRINTF@ | ||
| 636 | _GL_FUNCDECL_SYS (obstack_vprintf, int, | ||
| 637 | (struct obstack *obs, const char *format, va_list args) | ||
| 638 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) | ||
| 639 | _GL_ARG_NONNULL ((1, 2))); | ||
| 640 | # endif | ||
| 641 | _GL_CXXALIAS_SYS (obstack_vprintf, int, | ||
| 642 | (struct obstack *obs, const char *format, va_list args)); | ||
| 643 | # endif | ||
| 644 | _GL_CXXALIASWARN (obstack_vprintf); | ||
| 645 | #endif | ||
| 646 | |||
| 647 | #if @GNULIB_PERROR@ | ||
| 648 | /* Print a message to standard error, describing the value of ERRNO, | ||
| 649 | (if STRING is not NULL and not empty) prefixed with STRING and ": ", | ||
| 650 | and terminated with a newline. */ | ||
| 651 | # if @REPLACE_PERROR@ | ||
| 652 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 653 | # define perror rpl_perror | ||
| 654 | # endif | ||
| 655 | _GL_FUNCDECL_RPL (perror, void, (const char *string)); | ||
| 656 | _GL_CXXALIAS_RPL (perror, void, (const char *string)); | ||
| 657 | # else | ||
| 658 | _GL_CXXALIAS_SYS (perror, void, (const char *string)); | ||
| 659 | # endif | ||
| 660 | _GL_CXXALIASWARN (perror); | ||
| 661 | #elif defined GNULIB_POSIXCHECK | ||
| 662 | # undef perror | ||
| 663 | /* Assume perror is always declared. */ | ||
| 664 | _GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - " | ||
| 665 | "use gnulib module perror for portability"); | ||
| 666 | #endif | ||
| 667 | |||
| 668 | #if @GNULIB_POPEN@ | ||
| 669 | # if @REPLACE_POPEN@ | ||
| 670 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 671 | # undef popen | ||
| 672 | # define popen rpl_popen | ||
| 673 | # endif | ||
| 674 | _GL_FUNCDECL_RPL (popen, FILE *, (const char *cmd, const char *mode) | ||
| 675 | _GL_ARG_NONNULL ((1, 2))); | ||
| 676 | _GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode)); | ||
| 677 | # else | ||
| 678 | _GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode)); | ||
| 679 | # endif | ||
| 680 | _GL_CXXALIASWARN (popen); | ||
| 681 | #elif defined GNULIB_POSIXCHECK | ||
| 682 | # undef popen | ||
| 683 | # if HAVE_RAW_DECL_POPEN | ||
| 684 | _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - " | ||
| 685 | "use gnulib module popen or pipe for more portability"); | ||
| 686 | # endif | ||
| 687 | #endif | ||
| 688 | |||
| 689 | #if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@ | ||
| 690 | # if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \ | ||
| 691 | || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@) | ||
| 692 | # if defined __GNUC__ | ||
| 693 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 694 | /* Don't break __attribute__((format(printf,M,N))). */ | ||
| 695 | # define printf __printf__ | ||
| 696 | # endif | ||
| 697 | _GL_FUNCDECL_RPL_1 (__printf__, int, | ||
| 698 | (const char *format, ...) | ||
| 699 | __asm__ (@ASM_SYMBOL_PREFIX@ | ||
| 700 | _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) | ||
| 701 | _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2) | ||
| 702 | _GL_ARG_NONNULL ((1))); | ||
| 703 | _GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...)); | ||
| 704 | # else | ||
| 705 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 706 | # define printf rpl_printf | ||
| 707 | # endif | ||
| 708 | _GL_FUNCDECL_RPL (printf, int, | ||
| 709 | (const char *format, ...) | ||
| 710 | _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2) | ||
| 711 | _GL_ARG_NONNULL ((1))); | ||
| 712 | _GL_CXXALIAS_RPL (printf, int, (const char *format, ...)); | ||
| 713 | # endif | ||
| 714 | # define GNULIB_overrides_printf 1 | ||
| 715 | # else | ||
| 716 | _GL_CXXALIAS_SYS (printf, int, (const char *format, ...)); | ||
| 717 | # endif | ||
| 718 | _GL_CXXALIASWARN (printf); | ||
| 719 | #endif | ||
| 720 | #if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK | ||
| 721 | # if !GNULIB_overrides_printf | ||
| 722 | # undef printf | ||
| 723 | # endif | ||
| 724 | /* Assume printf is always declared. */ | ||
| 725 | _GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - " | ||
| 726 | "use gnulib module printf-posix for portable " | ||
| 727 | "POSIX compliance"); | ||
| 728 | #endif | ||
| 729 | |||
| 730 | #if @GNULIB_PUTC@ | ||
| 731 | # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ | ||
| 732 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 733 | # undef putc | ||
| 734 | # define putc rpl_fputc | ||
| 735 | # endif | ||
| 736 | _GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2))); | ||
| 737 | _GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream)); | ||
| 738 | # else | ||
| 739 | _GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream)); | ||
| 740 | # endif | ||
| 741 | _GL_CXXALIASWARN (putc); | ||
| 742 | #endif | ||
| 743 | |||
| 744 | #if @GNULIB_PUTCHAR@ | ||
| 745 | # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ | ||
| 746 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 747 | # undef putchar | ||
| 748 | # define putchar rpl_putchar | ||
| 749 | # endif | ||
| 750 | _GL_FUNCDECL_RPL (putchar, int, (int c)); | ||
| 751 | _GL_CXXALIAS_RPL (putchar, int, (int c)); | ||
| 752 | # else | ||
| 753 | _GL_CXXALIAS_SYS (putchar, int, (int c)); | ||
| 754 | # endif | ||
| 755 | _GL_CXXALIASWARN (putchar); | ||
| 756 | #endif | ||
| 757 | |||
| 758 | #if @GNULIB_PUTS@ | ||
| 759 | # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ | ||
| 760 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 761 | # undef puts | ||
| 762 | # define puts rpl_puts | ||
| 763 | # endif | ||
| 764 | _GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1))); | ||
| 765 | _GL_CXXALIAS_RPL (puts, int, (const char *string)); | ||
| 766 | # else | ||
| 767 | _GL_CXXALIAS_SYS (puts, int, (const char *string)); | ||
| 768 | # endif | ||
| 769 | _GL_CXXALIASWARN (puts); | ||
| 770 | #endif | ||
| 771 | |||
| 772 | #if @GNULIB_REMOVE@ | ||
| 773 | # if @REPLACE_REMOVE@ | ||
| 774 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 775 | # undef remove | ||
| 776 | # define remove rpl_remove | ||
| 777 | # endif | ||
| 778 | _GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1))); | ||
| 779 | _GL_CXXALIAS_RPL (remove, int, (const char *name)); | ||
| 780 | # else | ||
| 781 | _GL_CXXALIAS_SYS (remove, int, (const char *name)); | ||
| 782 | # endif | ||
| 783 | _GL_CXXALIASWARN (remove); | ||
| 784 | #elif defined GNULIB_POSIXCHECK | ||
| 785 | # undef remove | ||
| 786 | /* Assume remove is always declared. */ | ||
| 787 | _GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - " | ||
| 788 | "use gnulib module remove for more portability"); | ||
| 789 | #endif | ||
| 790 | |||
| 791 | #if @GNULIB_RENAME@ | ||
| 792 | # if @REPLACE_RENAME@ | ||
| 793 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 794 | # undef rename | ||
| 795 | # define rename rpl_rename | ||
| 796 | # endif | ||
| 797 | _GL_FUNCDECL_RPL (rename, int, | ||
| 798 | (const char *old_filename, const char *new_filename) | ||
| 799 | _GL_ARG_NONNULL ((1, 2))); | ||
| 800 | _GL_CXXALIAS_RPL (rename, int, | ||
| 801 | (const char *old_filename, const char *new_filename)); | ||
| 802 | # else | ||
| 803 | _GL_CXXALIAS_SYS (rename, int, | ||
| 804 | (const char *old_filename, const char *new_filename)); | ||
| 805 | # endif | ||
| 806 | _GL_CXXALIASWARN (rename); | ||
| 807 | #elif defined GNULIB_POSIXCHECK | ||
| 808 | # undef rename | ||
| 809 | /* Assume rename is always declared. */ | ||
| 810 | _GL_WARN_ON_USE (rename, "rename is buggy on some platforms - " | ||
| 811 | "use gnulib module rename for more portability"); | ||
| 812 | #endif | ||
| 813 | |||
| 814 | #if @GNULIB_RENAMEAT@ | ||
| 815 | # if @REPLACE_RENAMEAT@ | ||
| 816 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 817 | # undef renameat | ||
| 818 | # define renameat rpl_renameat | ||
| 819 | # endif | ||
| 820 | _GL_FUNCDECL_RPL (renameat, int, | ||
| 821 | (int fd1, char const *file1, int fd2, char const *file2) | ||
| 822 | _GL_ARG_NONNULL ((2, 4))); | ||
| 823 | _GL_CXXALIAS_RPL (renameat, int, | ||
| 824 | (int fd1, char const *file1, int fd2, char const *file2)); | ||
| 825 | # else | ||
| 826 | # if !@HAVE_RENAMEAT@ | ||
| 827 | _GL_FUNCDECL_SYS (renameat, int, | ||
| 828 | (int fd1, char const *file1, int fd2, char const *file2) | ||
| 829 | _GL_ARG_NONNULL ((2, 4))); | ||
| 830 | # endif | ||
| 831 | _GL_CXXALIAS_SYS (renameat, int, | ||
| 832 | (int fd1, char const *file1, int fd2, char const *file2)); | ||
| 833 | # endif | ||
| 834 | _GL_CXXALIASWARN (renameat); | ||
| 835 | #elif defined GNULIB_POSIXCHECK | ||
| 836 | # undef renameat | ||
| 837 | # if HAVE_RAW_DECL_RENAMEAT | ||
| 838 | _GL_WARN_ON_USE (renameat, "renameat is not portable - " | ||
| 839 | "use gnulib module renameat for portability"); | ||
| 840 | # endif | ||
| 841 | #endif | ||
| 842 | |||
| 843 | #if @GNULIB_SNPRINTF@ | ||
| 844 | # if @REPLACE_SNPRINTF@ | ||
| 845 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 846 | # define snprintf rpl_snprintf | ||
| 847 | # endif | ||
| 848 | _GL_FUNCDECL_RPL (snprintf, int, | ||
| 849 | (char *str, size_t size, const char *format, ...) | ||
| 850 | _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4) | ||
| 851 | _GL_ARG_NONNULL ((3))); | ||
| 852 | _GL_CXXALIAS_RPL (snprintf, int, | ||
| 853 | (char *str, size_t size, const char *format, ...)); | ||
| 854 | # else | ||
| 855 | # if !@HAVE_DECL_SNPRINTF@ | ||
| 856 | _GL_FUNCDECL_SYS (snprintf, int, | ||
| 857 | (char *str, size_t size, const char *format, ...) | ||
| 858 | _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4) | ||
| 859 | _GL_ARG_NONNULL ((3))); | ||
| 860 | # endif | ||
| 861 | _GL_CXXALIAS_SYS (snprintf, int, | ||
| 862 | (char *str, size_t size, const char *format, ...)); | ||
| 863 | # endif | ||
| 864 | _GL_CXXALIASWARN (snprintf); | ||
| 865 | #elif defined GNULIB_POSIXCHECK | ||
| 866 | # undef snprintf | ||
| 867 | # if HAVE_RAW_DECL_SNPRINTF | ||
| 868 | _GL_WARN_ON_USE (snprintf, "snprintf is unportable - " | ||
| 869 | "use gnulib module snprintf for portability"); | ||
| 870 | # endif | ||
| 871 | #endif | ||
| 872 | |||
| 873 | /* Some people would argue that sprintf should be handled like gets | ||
| 874 | (for example, OpenBSD issues a link warning for both functions), | ||
| 875 | since both can cause security holes due to buffer overruns. | ||
| 876 | However, we believe that sprintf can be used safely, and is more | ||
| 877 | efficient than snprintf in those safe cases; and as proof of our | ||
| 878 | belief, we use sprintf in several gnulib modules. So this header | ||
| 879 | intentionally avoids adding a warning to sprintf except when | ||
| 880 | GNULIB_POSIXCHECK is defined. */ | ||
| 881 | |||
| 882 | #if @GNULIB_SPRINTF_POSIX@ | ||
| 883 | # if @REPLACE_SPRINTF@ | ||
| 884 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 885 | # define sprintf rpl_sprintf | ||
| 886 | # endif | ||
| 887 | _GL_FUNCDECL_RPL (sprintf, int, (char *str, const char *format, ...) | ||
| 888 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) | ||
| 889 | _GL_ARG_NONNULL ((1, 2))); | ||
| 890 | _GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...)); | ||
| 891 | # else | ||
| 892 | _GL_CXXALIAS_SYS (sprintf, int, (char *str, const char *format, ...)); | ||
| 893 | # endif | ||
| 894 | _GL_CXXALIASWARN (sprintf); | ||
| 895 | #elif defined GNULIB_POSIXCHECK | ||
| 896 | # undef sprintf | ||
| 897 | /* Assume sprintf is always declared. */ | ||
| 898 | _GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - " | ||
| 899 | "use gnulib module sprintf-posix for portable " | ||
| 900 | "POSIX compliance"); | ||
| 901 | #endif | ||
| 902 | |||
| 903 | #if @GNULIB_TMPFILE@ | ||
| 904 | # if @REPLACE_TMPFILE@ | ||
| 905 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 906 | # define tmpfile rpl_tmpfile | ||
| 907 | # endif | ||
| 908 | _GL_FUNCDECL_RPL (tmpfile, FILE *, (void)); | ||
| 909 | _GL_CXXALIAS_RPL (tmpfile, FILE *, (void)); | ||
| 910 | # else | ||
| 911 | _GL_CXXALIAS_SYS (tmpfile, FILE *, (void)); | ||
| 912 | # endif | ||
| 913 | _GL_CXXALIASWARN (tmpfile); | ||
| 914 | #elif defined GNULIB_POSIXCHECK | ||
| 915 | # undef tmpfile | ||
| 916 | # if HAVE_RAW_DECL_TMPFILE | ||
| 917 | _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - " | ||
| 918 | "use gnulib module tmpfile for portability"); | ||
| 919 | # endif | ||
| 920 | #endif | ||
| 921 | |||
| 922 | #if @GNULIB_VASPRINTF@ | ||
| 923 | /* Write formatted output to a string dynamically allocated with malloc(). | ||
| 924 | If the memory allocation succeeds, store the address of the string in | ||
| 925 | *RESULT and return the number of resulting bytes, excluding the trailing | ||
| 926 | NUL. Upon memory allocation error, or some other error, return -1. */ | ||
| 927 | # if @REPLACE_VASPRINTF@ | ||
| 928 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 929 | # define asprintf rpl_asprintf | ||
| 930 | # endif | ||
| 931 | _GL_FUNCDECL_RPL (asprintf, int, | ||
| 932 | (char **result, const char *format, ...) | ||
| 933 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) | ||
| 934 | _GL_ARG_NONNULL ((1, 2))); | ||
| 935 | _GL_CXXALIAS_RPL (asprintf, int, | ||
| 936 | (char **result, const char *format, ...)); | ||
| 937 | # else | ||
| 938 | # if !@HAVE_VASPRINTF@ | ||
| 939 | _GL_FUNCDECL_SYS (asprintf, int, | ||
| 940 | (char **result, const char *format, ...) | ||
| 941 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) | ||
| 942 | _GL_ARG_NONNULL ((1, 2))); | ||
| 943 | # endif | ||
| 944 | _GL_CXXALIAS_SYS (asprintf, int, | ||
| 945 | (char **result, const char *format, ...)); | ||
| 946 | # endif | ||
| 947 | _GL_CXXALIASWARN (asprintf); | ||
| 948 | # if @REPLACE_VASPRINTF@ | ||
| 949 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 950 | # define vasprintf rpl_vasprintf | ||
| 951 | # endif | ||
| 952 | _GL_FUNCDECL_RPL (vasprintf, int, | ||
| 953 | (char **result, const char *format, va_list args) | ||
| 954 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) | ||
| 955 | _GL_ARG_NONNULL ((1, 2))); | ||
| 956 | _GL_CXXALIAS_RPL (vasprintf, int, | ||
| 957 | (char **result, const char *format, va_list args)); | ||
| 958 | # else | ||
| 959 | # if !@HAVE_VASPRINTF@ | ||
| 960 | _GL_FUNCDECL_SYS (vasprintf, int, | ||
| 961 | (char **result, const char *format, va_list args) | ||
| 962 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) | ||
| 963 | _GL_ARG_NONNULL ((1, 2))); | ||
| 964 | # endif | ||
| 965 | _GL_CXXALIAS_SYS (vasprintf, int, | ||
| 966 | (char **result, const char *format, va_list args)); | ||
| 967 | # endif | ||
| 968 | _GL_CXXALIASWARN (vasprintf); | ||
| 969 | #endif | ||
| 970 | |||
| 971 | #if @GNULIB_VDPRINTF@ | ||
| 972 | # if @REPLACE_VDPRINTF@ | ||
| 973 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 974 | # define vdprintf rpl_vdprintf | ||
| 975 | # endif | ||
| 976 | _GL_FUNCDECL_RPL (vdprintf, int, (int fd, const char *format, va_list args) | ||
| 977 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) | ||
| 978 | _GL_ARG_NONNULL ((2))); | ||
| 979 | _GL_CXXALIAS_RPL (vdprintf, int, (int fd, const char *format, va_list args)); | ||
| 980 | # else | ||
| 981 | # if !@HAVE_VDPRINTF@ | ||
| 982 | _GL_FUNCDECL_SYS (vdprintf, int, (int fd, const char *format, va_list args) | ||
| 983 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) | ||
| 984 | _GL_ARG_NONNULL ((2))); | ||
| 985 | # endif | ||
| 986 | /* Need to cast, because on Solaris, the third parameter will likely be | ||
| 987 | __va_list args. */ | ||
| 988 | _GL_CXXALIAS_SYS_CAST (vdprintf, int, | ||
| 989 | (int fd, const char *format, va_list args)); | ||
| 990 | # endif | ||
| 991 | _GL_CXXALIASWARN (vdprintf); | ||
| 992 | #elif defined GNULIB_POSIXCHECK | ||
| 993 | # undef vdprintf | ||
| 994 | # if HAVE_RAW_DECL_VDPRINTF | ||
| 995 | _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - " | ||
| 996 | "use gnulib module vdprintf for portability"); | ||
| 997 | # endif | ||
| 998 | #endif | ||
| 999 | |||
| 1000 | #if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@ | ||
| 1001 | # if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \ | ||
| 1002 | || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@) | ||
| 1003 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 1004 | # define vfprintf rpl_vfprintf | ||
| 1005 | # endif | ||
| 1006 | # define GNULIB_overrides_vfprintf 1 | ||
| 1007 | _GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args) | ||
| 1008 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) | ||
| 1009 | _GL_ARG_NONNULL ((1, 2))); | ||
| 1010 | _GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)); | ||
| 1011 | # else | ||
| 1012 | /* Need to cast, because on Solaris, the third parameter is | ||
| 1013 | __va_list args | ||
| 1014 | and GCC's fixincludes did not change this to __gnuc_va_list. */ | ||
| 1015 | _GL_CXXALIAS_SYS_CAST (vfprintf, int, | ||
| 1016 | (FILE *fp, const char *format, va_list args)); | ||
| 1017 | # endif | ||
| 1018 | _GL_CXXALIASWARN (vfprintf); | ||
| 1019 | #endif | ||
| 1020 | #if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK | ||
| 1021 | # if !GNULIB_overrides_vfprintf | ||
| 1022 | # undef vfprintf | ||
| 1023 | # endif | ||
| 1024 | /* Assume vfprintf is always declared. */ | ||
| 1025 | _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - " | ||
| 1026 | "use gnulib module vfprintf-posix for portable " | ||
| 1027 | "POSIX compliance"); | ||
| 1028 | #endif | ||
| 1029 | |||
| 1030 | #if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@ | ||
| 1031 | # if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \ | ||
| 1032 | || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@) | ||
| 1033 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 1034 | # define vprintf rpl_vprintf | ||
| 1035 | # endif | ||
| 1036 | # define GNULIB_overrides_vprintf 1 | ||
| 1037 | _GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args) | ||
| 1038 | _GL_ATTRIBUTE_FORMAT_PRINTF (1, 0) | ||
| 1039 | _GL_ARG_NONNULL ((1))); | ||
| 1040 | _GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args)); | ||
| 1041 | # else | ||
| 1042 | /* Need to cast, because on Solaris, the second parameter is | ||
| 1043 | __va_list args | ||
| 1044 | and GCC's fixincludes did not change this to __gnuc_va_list. */ | ||
| 1045 | _GL_CXXALIAS_SYS_CAST (vprintf, int, (const char *format, va_list args)); | ||
| 1046 | # endif | ||
| 1047 | _GL_CXXALIASWARN (vprintf); | ||
| 1048 | #endif | ||
| 1049 | #if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK | ||
| 1050 | # if !GNULIB_overrides_vprintf | ||
| 1051 | # undef vprintf | ||
| 1052 | # endif | ||
| 1053 | /* Assume vprintf is always declared. */ | ||
| 1054 | _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - " | ||
| 1055 | "use gnulib module vprintf-posix for portable " | ||
| 1056 | "POSIX compliance"); | ||
| 1057 | #endif | ||
| 1058 | |||
| 1059 | #if @GNULIB_VSNPRINTF@ | ||
| 1060 | # if @REPLACE_VSNPRINTF@ | ||
| 1061 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 1062 | # define vsnprintf rpl_vsnprintf | ||
| 1063 | # endif | ||
| 1064 | _GL_FUNCDECL_RPL (vsnprintf, int, | ||
| 1065 | (char *str, size_t size, const char *format, va_list args) | ||
| 1066 | _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) | ||
| 1067 | _GL_ARG_NONNULL ((3))); | ||
| 1068 | _GL_CXXALIAS_RPL (vsnprintf, int, | ||
| 1069 | (char *str, size_t size, const char *format, va_list args)); | ||
| 1070 | # else | ||
| 1071 | # if !@HAVE_DECL_VSNPRINTF@ | ||
| 1072 | _GL_FUNCDECL_SYS (vsnprintf, int, | ||
| 1073 | (char *str, size_t size, const char *format, va_list args) | ||
| 1074 | _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) | ||
| 1075 | _GL_ARG_NONNULL ((3))); | ||
| 1076 | # endif | ||
| 1077 | _GL_CXXALIAS_SYS (vsnprintf, int, | ||
| 1078 | (char *str, size_t size, const char *format, va_list args)); | ||
| 1079 | # endif | ||
| 1080 | _GL_CXXALIASWARN (vsnprintf); | ||
| 1081 | #elif defined GNULIB_POSIXCHECK | ||
| 1082 | # undef vsnprintf | ||
| 1083 | # if HAVE_RAW_DECL_VSNPRINTF | ||
| 1084 | _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - " | ||
| 1085 | "use gnulib module vsnprintf for portability"); | ||
| 1086 | # endif | ||
| 1087 | #endif | ||
| 1088 | |||
| 1089 | #if @GNULIB_VSPRINTF_POSIX@ | ||
| 1090 | # if @REPLACE_VSPRINTF@ | ||
| 1091 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 1092 | # define vsprintf rpl_vsprintf | ||
| 1093 | # endif | ||
| 1094 | _GL_FUNCDECL_RPL (vsprintf, int, | ||
| 1095 | (char *str, const char *format, va_list args) | ||
| 1096 | _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) | ||
| 1097 | _GL_ARG_NONNULL ((1, 2))); | ||
| 1098 | _GL_CXXALIAS_RPL (vsprintf, int, | ||
| 1099 | (char *str, const char *format, va_list args)); | ||
| 1100 | # else | ||
| 1101 | /* Need to cast, because on Solaris, the third parameter is | ||
| 1102 | __va_list args | ||
| 1103 | and GCC's fixincludes did not change this to __gnuc_va_list. */ | ||
| 1104 | _GL_CXXALIAS_SYS_CAST (vsprintf, int, | ||
| 1105 | (char *str, const char *format, va_list args)); | ||
| 1106 | # endif | ||
| 1107 | _GL_CXXALIASWARN (vsprintf); | ||
| 1108 | #elif defined GNULIB_POSIXCHECK | ||
| 1109 | # undef vsprintf | ||
| 1110 | /* Assume vsprintf is always declared. */ | ||
| 1111 | _GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - " | ||
| 1112 | "use gnulib module vsprintf-posix for portable " | ||
| 1113 | "POSIX compliance"); | ||
| 1114 | #endif | ||
| 1115 | |||
| 1116 | |||
| 1117 | #endif /* _GL_STDIO_H */ | ||
| 1118 | #endif /* _GL_STDIO_H */ | ||
| 1119 | #endif | ||
diff --git a/lib/strftime.c b/lib/strftime.c index 0a02b507744..acebc9adfad 100644 --- a/lib/strftime.c +++ b/lib/strftime.c | |||
| @@ -172,15 +172,16 @@ extern char *tzname[]; | |||
| 172 | #define add(n, f) \ | 172 | #define add(n, f) \ |
| 173 | do \ | 173 | do \ |
| 174 | { \ | 174 | { \ |
| 175 | int _n = (n); \ | 175 | size_t _n = (n); \ |
| 176 | int _delta = width - _n; \ | 176 | size_t _w = (width < 0 ? 0 : width); \ |
| 177 | int _incr = _n + (_delta > 0 ? _delta : 0); \ | 177 | size_t _incr = _n < _w ? _w : _n; \ |
| 178 | if ((size_t) _incr >= maxsize - i) \ | 178 | if (_incr >= maxsize - i) \ |
| 179 | return 0; \ | 179 | return 0; \ |
| 180 | if (p) \ | 180 | if (p) \ |
| 181 | { \ | 181 | { \ |
| 182 | if (digits == 0 && _delta > 0) \ | 182 | if (digits == 0 && _n < _w) \ |
| 183 | { \ | 183 | { \ |
| 184 | size_t _delta = width - _n; \ | ||
| 184 | if (pad == L_('0')) \ | 185 | if (pad == L_('0')) \ |
| 185 | memset_zero (p, _delta); \ | 186 | memset_zero (p, _delta); \ |
| 186 | else \ | 187 | else \ |
diff --git a/m4/gl-comp.m4 b/m4/gl-comp.m4 index 8bf5a64a5f9..af3cae75abb 100644 --- a/m4/gl-comp.m4 +++ b/m4/gl-comp.m4 | |||
| @@ -45,10 +45,12 @@ AC_DEFUN([gl_EARLY], | |||
| 45 | # Code from module mktime: | 45 | # Code from module mktime: |
| 46 | # Code from module multiarch: | 46 | # Code from module multiarch: |
| 47 | # Code from module readlink: | 47 | # Code from module readlink: |
| 48 | # Code from module socklen: | ||
| 48 | # Code from module stat: | 49 | # Code from module stat: |
| 49 | # Code from module stdbool: | 50 | # Code from module stdbool: |
| 50 | # Code from module stddef: | 51 | # Code from module stddef: |
| 51 | # Code from module stdint: | 52 | # Code from module stdint: |
| 53 | # Code from module stdio: | ||
| 52 | # Code from module stdlib: | 54 | # Code from module stdlib: |
| 53 | # Code from module strftime: | 55 | # Code from module strftime: |
| 54 | # Code from module symlink: | 56 | # Code from module symlink: |
| @@ -111,6 +113,8 @@ AC_DEFUN([gl_INIT], | |||
| 111 | # Code from module readlink: | 113 | # Code from module readlink: |
| 112 | gl_FUNC_READLINK | 114 | gl_FUNC_READLINK |
| 113 | gl_UNISTD_MODULE_INDICATOR([readlink]) | 115 | gl_UNISTD_MODULE_INDICATOR([readlink]) |
| 116 | # Code from module socklen: | ||
| 117 | gl_TYPE_SOCKLEN_T | ||
| 114 | # Code from module stat: | 118 | # Code from module stat: |
| 115 | gl_FUNC_STAT | 119 | gl_FUNC_STAT |
| 116 | gl_SYS_STAT_MODULE_INDICATOR([stat]) | 120 | gl_SYS_STAT_MODULE_INDICATOR([stat]) |
| @@ -120,6 +124,8 @@ AC_DEFUN([gl_INIT], | |||
| 120 | gl_STDDEF_H | 124 | gl_STDDEF_H |
| 121 | # Code from module stdint: | 125 | # Code from module stdint: |
| 122 | gl_STDINT_H | 126 | gl_STDINT_H |
| 127 | # Code from module stdio: | ||
| 128 | gl_STDIO_H | ||
| 123 | # Code from module stdlib: | 129 | # Code from module stdlib: |
| 124 | gl_STDLIB_H | 130 | gl_STDLIB_H |
| 125 | # Code from module strftime: | 131 | # Code from module strftime: |
| @@ -305,6 +311,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 305 | lib/stdbool.in.h | 311 | lib/stdbool.in.h |
| 306 | lib/stddef.in.h | 312 | lib/stddef.in.h |
| 307 | lib/stdint.in.h | 313 | lib/stdint.in.h |
| 314 | lib/stdio.in.h | ||
| 308 | lib/stdlib.in.h | 315 | lib/stdlib.in.h |
| 309 | lib/strftime.c | 316 | lib/strftime.c |
| 310 | lib/strftime.h | 317 | lib/strftime.h |
| @@ -327,11 +334,13 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 327 | m4/mktime.m4 | 334 | m4/mktime.m4 |
| 328 | m4/multiarch.m4 | 335 | m4/multiarch.m4 |
| 329 | m4/readlink.m4 | 336 | m4/readlink.m4 |
| 337 | m4/socklen.m4 | ||
| 330 | m4/st_dm_mode.m4 | 338 | m4/st_dm_mode.m4 |
| 331 | m4/stat.m4 | 339 | m4/stat.m4 |
| 332 | m4/stdbool.m4 | 340 | m4/stdbool.m4 |
| 333 | m4/stddef_h.m4 | 341 | m4/stddef_h.m4 |
| 334 | m4/stdint.m4 | 342 | m4/stdint.m4 |
| 343 | m4/stdio_h.m4 | ||
| 335 | m4/stdlib_h.m4 | 344 | m4/stdlib_h.m4 |
| 336 | m4/strftime.m4 | 345 | m4/strftime.m4 |
| 337 | m4/symlink.m4 | 346 | m4/symlink.m4 |
diff --git a/m4/socklen.m4 b/m4/socklen.m4 new file mode 100644 index 00000000000..44751544485 --- /dev/null +++ b/m4/socklen.m4 | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | # socklen.m4 serial 10 | ||
| 2 | dnl Copyright (C) 2005-2007, 2009-2011 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | ||
| 4 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 5 | dnl with or without modifications, as long as this notice is preserved. | ||
| 6 | |||
| 7 | dnl From Albert Chin, Windows fixes from Simon Josefsson. | ||
| 8 | |||
| 9 | dnl Check for socklen_t: historically on BSD it is an int, and in | ||
| 10 | dnl POSIX 1g it is a type of its own, but some platforms use different | ||
| 11 | dnl types for the argument to getsockopt, getpeername, etc.: | ||
| 12 | dnl HP-UX 10.20, IRIX 6.5, OSF/1 4.0, Interix 3.5, BeOS. | ||
| 13 | dnl So we have to test to find something that will work. | ||
| 14 | |||
| 15 | AC_DEFUN([gl_TYPE_SOCKLEN_T], | ||
| 16 | [AC_REQUIRE([gl_CHECK_SOCKET_HEADERS])dnl | ||
| 17 | AC_CHECK_TYPE([socklen_t], , | ||
| 18 | [AC_MSG_CHECKING([for socklen_t equivalent]) | ||
| 19 | AC_CACHE_VAL([gl_cv_socklen_t_equiv], | ||
| 20 | [# Systems have either "struct sockaddr *" or | ||
| 21 | # "void *" as the second argument to getpeername | ||
| 22 | gl_cv_socklen_t_equiv= | ||
| 23 | for arg2 in "struct sockaddr" void; do | ||
| 24 | for t in int size_t "unsigned int" "long int" "unsigned long int"; do | ||
| 25 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( | ||
| 26 | [[#include <sys/types.h> | ||
| 27 | #include <sys/socket.h> | ||
| 28 | |||
| 29 | int getpeername (int, $arg2 *, $t *);]], | ||
| 30 | [[$t len; | ||
| 31 | getpeername (0, 0, &len);]])], | ||
| 32 | [gl_cv_socklen_t_equiv="$t"]) | ||
| 33 | test "$gl_cv_socklen_t_equiv" != "" && break | ||
| 34 | done | ||
| 35 | test "$gl_cv_socklen_t_equiv" != "" && break | ||
| 36 | done | ||
| 37 | ]) | ||
| 38 | if test "$gl_cv_socklen_t_equiv" = ""; then | ||
| 39 | AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) | ||
| 40 | fi | ||
| 41 | AC_MSG_RESULT([$gl_cv_socklen_t_equiv]) | ||
| 42 | AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv], | ||
| 43 | [type to use in place of socklen_t if not defined])], | ||
| 44 | [gl_SOCKET_HEADERS])]) | ||
| 45 | |||
| 46 | dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find | ||
| 47 | dnl it there too. But on Cygwin, wc2tcpip.h must not be included. Users | ||
| 48 | dnl of this module should use the same include pattern as gl_SOCKET_HEADERS. | ||
| 49 | dnl When you change this macro, keep also in sync: | ||
| 50 | dnl - gl_CHECK_SOCKET_HEADERS, | ||
| 51 | dnl - the Include section of modules/socklen. | ||
| 52 | AC_DEFUN([gl_SOCKET_HEADERS], | ||
| 53 | [ | ||
| 54 | /* <sys/types.h> is not needed according to POSIX, but the | ||
| 55 | <sys/socket.h> in i386-unknown-freebsd4.10 and | ||
| 56 | powerpc-apple-darwin5.5 required it. */ | ||
| 57 | #include <sys/types.h> | ||
| 58 | #if HAVE_SYS_SOCKET_H | ||
| 59 | # include <sys/socket.h> | ||
| 60 | #elif HAVE_WS2TCPIP_H | ||
| 61 | # include <ws2tcpip.h> | ||
| 62 | #endif | ||
| 63 | ]) | ||
| 64 | |||
| 65 | dnl Tests for the existence of the header for socket facilities. | ||
| 66 | dnl Defines the C macros HAVE_SYS_SOCKET_H, HAVE_WS2TCPIP_H. | ||
| 67 | dnl This macro must match gl_SOCKET_HEADERS. | ||
| 68 | AC_DEFUN([gl_CHECK_SOCKET_HEADERS], | ||
| 69 | [AC_CHECK_HEADERS_ONCE([sys/socket.h]) | ||
| 70 | if test $ac_cv_header_sys_socket_h = no; then | ||
| 71 | dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make | ||
| 72 | dnl the check for those headers unconditional; yet cygwin reports | ||
| 73 | dnl that the headers are present but cannot be compiled (since on | ||
| 74 | dnl cygwin, all socket information should come from sys/socket.h). | ||
| 75 | AC_CHECK_HEADERS([ws2tcpip.h]) | ||
| 76 | fi | ||
| 77 | ]) | ||
diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4 new file mode 100644 index 00000000000..7f3ae56295f --- /dev/null +++ b/m4/stdio_h.m4 | |||
| @@ -0,0 +1,140 @@ | |||
| 1 | # stdio_h.m4 serial 33 | ||
| 2 | dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | ||
| 4 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 5 | dnl with or without modifications, as long as this notice is preserved. | ||
| 6 | |||
| 7 | AC_DEFUN([gl_STDIO_H], | ||
| 8 | [ | ||
| 9 | AC_REQUIRE([gl_STDIO_H_DEFAULTS]) | ||
| 10 | AC_REQUIRE([AC_C_INLINE]) | ||
| 11 | gl_NEXT_HEADERS([stdio.h]) | ||
| 12 | dnl No need to create extra modules for these functions. Everyone who uses | ||
| 13 | dnl <stdio.h> likely needs them. | ||
| 14 | GNULIB_FPRINTF=1 | ||
| 15 | GNULIB_PRINTF=1 | ||
| 16 | GNULIB_VFPRINTF=1 | ||
| 17 | GNULIB_VPRINTF=1 | ||
| 18 | GNULIB_FPUTC=1 | ||
| 19 | GNULIB_PUTC=1 | ||
| 20 | GNULIB_PUTCHAR=1 | ||
| 21 | GNULIB_FPUTS=1 | ||
| 22 | GNULIB_PUTS=1 | ||
| 23 | GNULIB_FWRITE=1 | ||
| 24 | dnl This ifdef is just an optimization, to avoid performing a configure | ||
| 25 | dnl check whose result is not used. It does not make the test of | ||
| 26 | dnl GNULIB_STDIO_H_SIGPIPE or GNULIB_SIGPIPE redundant. | ||
| 27 | m4_ifdef([gl_SIGNAL_SIGPIPE], [ | ||
| 28 | gl_SIGNAL_SIGPIPE | ||
| 29 | if test $gl_cv_header_signal_h_SIGPIPE != yes; then | ||
| 30 | REPLACE_STDIO_WRITE_FUNCS=1 | ||
| 31 | AC_LIBOBJ([stdio-write]) | ||
| 32 | fi | ||
| 33 | ]) | ||
| 34 | |||
| 35 | dnl Check for declarations of anything we want to poison if the | ||
| 36 | dnl corresponding gnulib module is not in use, and which is not | ||
| 37 | dnl guaranteed by C89. | ||
| 38 | gl_WARN_ON_USE_PREPARE([[#include <stdio.h> | ||
| 39 | ]], [dprintf fpurge fseeko ftello getdelim getline popen renameat | ||
| 40 | snprintf tmpfile vdprintf vsnprintf]) | ||
| 41 | ]) | ||
| 42 | |||
| 43 | AC_DEFUN([gl_STDIO_MODULE_INDICATOR], | ||
| 44 | [ | ||
| 45 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. | ||
| 46 | AC_REQUIRE([gl_STDIO_H_DEFAULTS]) | ||
| 47 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | ||
| 48 | dnl Define it also as a C macro, for the benefit of the unit tests. | ||
| 49 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) | ||
| 50 | ]) | ||
| 51 | |||
| 52 | AC_DEFUN([gl_STDIO_H_DEFAULTS], | ||
| 53 | [ | ||
| 54 | GNULIB_DPRINTF=0; AC_SUBST([GNULIB_DPRINTF]) | ||
| 55 | GNULIB_FCLOSE=0; AC_SUBST([GNULIB_FCLOSE]) | ||
| 56 | GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH]) | ||
| 57 | GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN]) | ||
| 58 | GNULIB_FPRINTF=0; AC_SUBST([GNULIB_FPRINTF]) | ||
| 59 | GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX]) | ||
| 60 | GNULIB_FPURGE=0; AC_SUBST([GNULIB_FPURGE]) | ||
| 61 | GNULIB_FPUTC=0; AC_SUBST([GNULIB_FPUTC]) | ||
| 62 | GNULIB_FPUTS=0; AC_SUBST([GNULIB_FPUTS]) | ||
| 63 | GNULIB_FREOPEN=0; AC_SUBST([GNULIB_FREOPEN]) | ||
| 64 | GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK]) | ||
| 65 | GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO]) | ||
| 66 | GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL]) | ||
| 67 | GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO]) | ||
| 68 | GNULIB_FWRITE=0; AC_SUBST([GNULIB_FWRITE]) | ||
| 69 | GNULIB_GETDELIM=0; AC_SUBST([GNULIB_GETDELIM]) | ||
| 70 | GNULIB_GETLINE=0; AC_SUBST([GNULIB_GETLINE]) | ||
| 71 | GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF]) | ||
| 72 | GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX]) | ||
| 73 | GNULIB_PERROR=0; AC_SUBST([GNULIB_PERROR]) | ||
| 74 | GNULIB_POPEN=0; AC_SUBST([GNULIB_POPEN]) | ||
| 75 | GNULIB_PRINTF=0; AC_SUBST([GNULIB_PRINTF]) | ||
| 76 | GNULIB_PRINTF_POSIX=0; AC_SUBST([GNULIB_PRINTF_POSIX]) | ||
| 77 | GNULIB_PUTC=0; AC_SUBST([GNULIB_PUTC]) | ||
| 78 | GNULIB_PUTCHAR=0; AC_SUBST([GNULIB_PUTCHAR]) | ||
| 79 | GNULIB_PUTS=0; AC_SUBST([GNULIB_PUTS]) | ||
| 80 | GNULIB_REMOVE=0; AC_SUBST([GNULIB_REMOVE]) | ||
| 81 | GNULIB_RENAME=0; AC_SUBST([GNULIB_RENAME]) | ||
| 82 | GNULIB_RENAMEAT=0; AC_SUBST([GNULIB_RENAMEAT]) | ||
| 83 | GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF]) | ||
| 84 | GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX]) | ||
| 85 | GNULIB_STDIO_H_SIGPIPE=0; AC_SUBST([GNULIB_STDIO_H_SIGPIPE]) | ||
| 86 | GNULIB_TMPFILE=0; AC_SUBST([GNULIB_TMPFILE]) | ||
| 87 | GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF]) | ||
| 88 | GNULIB_VDPRINTF=0; AC_SUBST([GNULIB_VDPRINTF]) | ||
| 89 | GNULIB_VFPRINTF=0; AC_SUBST([GNULIB_VFPRINTF]) | ||
| 90 | GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX]) | ||
| 91 | GNULIB_VPRINTF=0; AC_SUBST([GNULIB_VPRINTF]) | ||
| 92 | GNULIB_VPRINTF_POSIX=0; AC_SUBST([GNULIB_VPRINTF_POSIX]) | ||
| 93 | GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF]) | ||
| 94 | GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX]) | ||
| 95 | dnl Assume proper GNU behavior unless another module says otherwise. | ||
| 96 | HAVE_DECL_FPURGE=1; AC_SUBST([HAVE_DECL_FPURGE]) | ||
| 97 | HAVE_DECL_FSEEKO=1; AC_SUBST([HAVE_DECL_FSEEKO]) | ||
| 98 | HAVE_DECL_FTELLO=1; AC_SUBST([HAVE_DECL_FTELLO]) | ||
| 99 | HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM]) | ||
| 100 | HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE]) | ||
| 101 | HAVE_DECL_OBSTACK_PRINTF=1; AC_SUBST([HAVE_DECL_OBSTACK_PRINTF]) | ||
| 102 | HAVE_DECL_SNPRINTF=1; AC_SUBST([HAVE_DECL_SNPRINTF]) | ||
| 103 | HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF]) | ||
| 104 | HAVE_DPRINTF=1; AC_SUBST([HAVE_DPRINTF]) | ||
| 105 | HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO]) | ||
| 106 | HAVE_FTELLO=1; AC_SUBST([HAVE_FTELLO]) | ||
| 107 | HAVE_RENAMEAT=1; AC_SUBST([HAVE_RENAMEAT]) | ||
| 108 | HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF]) | ||
| 109 | HAVE_VDPRINTF=1; AC_SUBST([HAVE_VDPRINTF]) | ||
| 110 | REPLACE_DPRINTF=0; AC_SUBST([REPLACE_DPRINTF]) | ||
| 111 | REPLACE_FCLOSE=0; AC_SUBST([REPLACE_FCLOSE]) | ||
| 112 | REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH]) | ||
| 113 | REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN]) | ||
| 114 | REPLACE_FPRINTF=0; AC_SUBST([REPLACE_FPRINTF]) | ||
| 115 | REPLACE_FPURGE=0; AC_SUBST([REPLACE_FPURGE]) | ||
| 116 | REPLACE_FREOPEN=0; AC_SUBST([REPLACE_FREOPEN]) | ||
| 117 | REPLACE_FSEEK=0; AC_SUBST([REPLACE_FSEEK]) | ||
| 118 | REPLACE_FSEEKO=0; AC_SUBST([REPLACE_FSEEKO]) | ||
| 119 | REPLACE_FTELL=0; AC_SUBST([REPLACE_FTELL]) | ||
| 120 | REPLACE_FTELLO=0; AC_SUBST([REPLACE_FTELLO]) | ||
| 121 | REPLACE_GETDELIM=0; AC_SUBST([REPLACE_GETDELIM]) | ||
| 122 | REPLACE_GETLINE=0; AC_SUBST([REPLACE_GETLINE]) | ||
| 123 | REPLACE_OBSTACK_PRINTF=0; AC_SUBST([REPLACE_OBSTACK_PRINTF]) | ||
| 124 | REPLACE_PERROR=0; AC_SUBST([REPLACE_PERROR]) | ||
| 125 | REPLACE_POPEN=0; AC_SUBST([REPLACE_POPEN]) | ||
| 126 | REPLACE_PRINTF=0; AC_SUBST([REPLACE_PRINTF]) | ||
| 127 | REPLACE_REMOVE=0; AC_SUBST([REPLACE_REMOVE]) | ||
| 128 | REPLACE_RENAME=0; AC_SUBST([REPLACE_RENAME]) | ||
| 129 | REPLACE_RENAMEAT=0; AC_SUBST([REPLACE_RENAMEAT]) | ||
| 130 | REPLACE_SNPRINTF=0; AC_SUBST([REPLACE_SNPRINTF]) | ||
| 131 | REPLACE_SPRINTF=0; AC_SUBST([REPLACE_SPRINTF]) | ||
| 132 | REPLACE_STDIO_WRITE_FUNCS=0; AC_SUBST([REPLACE_STDIO_WRITE_FUNCS]) | ||
| 133 | REPLACE_TMPFILE=0; AC_SUBST([REPLACE_TMPFILE]) | ||
| 134 | REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF]) | ||
| 135 | REPLACE_VDPRINTF=0; AC_SUBST([REPLACE_VDPRINTF]) | ||
| 136 | REPLACE_VFPRINTF=0; AC_SUBST([REPLACE_VFPRINTF]) | ||
| 137 | REPLACE_VPRINTF=0; AC_SUBST([REPLACE_VPRINTF]) | ||
| 138 | REPLACE_VSNPRINTF=0; AC_SUBST([REPLACE_VSNPRINTF]) | ||
| 139 | REPLACE_VSPRINTF=0; AC_SUBST([REPLACE_VSPRINTF]) | ||
| 140 | ]) | ||
diff --git a/src/ChangeLog b/src/ChangeLog index f489a233683..a4312efceb9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,130 @@ | |||
| 1 | 2011-03-23 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Fix more problems found by GCC 4.5.2's static checks. | ||
| 4 | |||
| 5 | * coding.c (encode_coding_raw_text): Avoid unnecessary test | ||
| 6 | the first time through the loop, since we know p0 < p1 then. | ||
| 7 | This also avoids a gcc -Wstrict-overflow warning. | ||
| 8 | |||
| 9 | * lisp.h (SAFE_ALLOCA, SAFE_ALLOCA_LISP): Avoid 'int' overflow | ||
| 10 | leading to a memory leak, possible in functions like | ||
| 11 | load_charset_map_from_file that can allocate an unbounded number | ||
| 12 | of objects (Bug#8318). | ||
| 13 | |||
| 14 | * xmenu.c (set_frame_menubar): Use EMACS_UINT, not int, for indexes | ||
| 15 | that could (at least in theory) be that large. | ||
| 16 | |||
| 17 | * xdisp.c (message_log_check_duplicate): Return unsigned long, not int. | ||
| 18 | This is less likely to overflow, and avoids undefined behavior if | ||
| 19 | overflow does occur. All callers changed. Use strtoul to scan | ||
| 20 | for the unsigned long integer. | ||
| 21 | (pint2hrstr): Simplify and tune code slightly. | ||
| 22 | This also avoids a (bogus) GCC warning with gcc -Wstrict-overflow. | ||
| 23 | |||
| 24 | * scroll.c (do_scrolling): Work around GCC bug 48228. | ||
| 25 | See <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48228>. | ||
| 26 | |||
| 27 | * frame.c (Fmodify_frame_parameters): Simplify loop counter. | ||
| 28 | This also avoids a warning with gcc -Wstrict-overflow. | ||
| 29 | (validate_x_resource_name): Simplify count usage. | ||
| 30 | This also avoids a warning with gcc -Wstrict-overflow. | ||
| 31 | |||
| 32 | * fileio.c (Fcopy_file): Report error if fchown or fchmod | ||
| 33 | fail (Bug#8306). | ||
| 34 | |||
| 35 | * emacs.c (Fdaemon_initialized): Do not ignore I/O errors (Bug#8303). | ||
| 36 | |||
| 37 | * process.c (Fmake_network_process): Use socklen_t, not int, | ||
| 38 | where POSIX says socklen_t is required in portable programs. | ||
| 39 | This fixes a porting bug on hosts like 64-bit HP-UX, where | ||
| 40 | socklen_t is wider than int (Bug#8277). | ||
| 41 | (Fmake_network_process, server_accept_connection): | ||
| 42 | (wait_reading_process_output, read_process_output): | ||
| 43 | Likewise. | ||
| 44 | |||
| 45 | * process.c: Rename or move locals to avoid shadowing. | ||
| 46 | (list_processes_1, Fmake_network_process): | ||
| 47 | (read_process_output_error_handler, exec_sentinel_error_handler): | ||
| 48 | Rename or move locals. | ||
| 49 | (Fmake_network_process): Define label "retry_connect" only if needed. | ||
| 50 | (Fnetwork_interface_info): Fix pointer signedness. | ||
| 51 | (process_send_signal): Add cast to avoid pointer signedness problem. | ||
| 52 | (FIRST_PROC_DESC, IF_NON_BLOCKING_CONNECT): Remove unused macros. | ||
| 53 | (create_process): Use 'volatile' to avoid vfork clobbering (Bug#8298). | ||
| 54 | |||
| 55 | Make tparam.h and terminfo.c consistent. | ||
| 56 | * cm.c (tputs, tgoto, BC, UP): Remove extern decls. Include | ||
| 57 | tparam.h instead, since it declares them. | ||
| 58 | * cm.h (PC): Remove extern decl; tparam.h now does this. | ||
| 59 | * deps.mk (cm.o, terminfo.o): Depend on tparam.h. | ||
| 60 | * terminfo.c: Include tparam.h, to check interfaces. | ||
| 61 | (tparm): Make 1st arg a const pointer in decl. Put it at top level. | ||
| 62 | (tparam): Adjust signature to match interface in tparam.h; | ||
| 63 | this removes some undefined behavior. Check that outstring and len | ||
| 64 | are zero, which they always are with Emacs. | ||
| 65 | * tparam.h (PC, BC, UP): New extern decls. | ||
| 66 | |||
| 67 | * xftfont.c (xftfont_shape): Now static, and defined only if needed. | ||
| 68 | (xftfont_open): Rename locals to avoid shadowing. | ||
| 69 | |||
| 70 | * ftfont.c (ftfont_resolve_generic_family): Fix pointer signedness. | ||
| 71 | (ftfont_otf_capability, ftfont_shape): Omit decls if not needed. | ||
| 72 | (OTF_TAG_SYM): Omit macro if not needed. | ||
| 73 | (ftfont_list): Remove unused local. | ||
| 74 | (get_adstyle_property, ftfont_pattern_entity): | ||
| 75 | (ftfont_lookup_cache, ftfont_open, ftfont_anchor_point): | ||
| 76 | Rename locals to avoid shadowing. | ||
| 77 | |||
| 78 | * xfont.c (xfont_list_family): Mark var as initialized. | ||
| 79 | |||
| 80 | * xml.c (make_dom): Now static. | ||
| 81 | |||
| 82 | * composite.c (composition_compute_stop_pos): Rename local to | ||
| 83 | avoid shadowing. | ||
| 84 | (composition_reseat_it): Remove unused locals. | ||
| 85 | (find_automatic_composition, composition_adjust_point): Likewise. | ||
| 86 | (composition_update_it): Mark var as initialized. | ||
| 87 | (find_automatic_composition): Mark vars as initialized, | ||
| 88 | with a FIXME (Bug#8290). | ||
| 89 | |||
| 90 | character.h: Rename locals to avoid shadowing. | ||
| 91 | * character.h (PREV_CHAR_BOUNDARY, FETCH_STRING_CHAR_ADVANCE): | ||
| 92 | (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE, FETCH_CHAR_ADVANCE): | ||
| 93 | (FETCH_CHAR_ADVANCE_NO_CHECK, INC_POS, DEC_POS, BUF_INC_POS): | ||
| 94 | (BUF_DEC_POS): Be more systematic about renaming local temporaries | ||
| 95 | to avoid shadowing. | ||
| 96 | |||
| 97 | * textprop.c (property_change_between_p): Remove; unused. | ||
| 98 | |||
| 99 | * intervals.c (interval_start_pos): Now static. | ||
| 100 | |||
| 101 | * intervals.h (CHECK_TOTAL_LENGTH): Avoid empty "else". | ||
| 102 | |||
| 103 | * atimer.c (start_atimer, append_atimer_lists, set_alarm): Rename | ||
| 104 | locals to avoid shadowing. | ||
| 105 | |||
| 106 | * sound.c (wav_play, au_play, Fplay_sound_internal): | ||
| 107 | Fix pointer signedness. | ||
| 108 | (alsa_choose_format): Remove unused local var. | ||
| 109 | (wav_play): Initialize a variable to 0, to prevent undefined | ||
| 110 | behavior (Bug#8278). | ||
| 111 | |||
| 112 | * region-cache.c (insert_cache_boundary): Redo var to avoid shadowing. | ||
| 113 | |||
| 114 | * region-cache.h (pp_cache): New decl, for gcc -Wmissing-prototypes. | ||
| 115 | |||
| 116 | * callproc.c (Fcall_process): Use 'volatile' to avoid vfork | ||
| 117 | clobbering (Bug#8298). | ||
| 118 | * sysdep.c (sys_subshell): Likewise. | ||
| 119 | Previously, the sys_subshell 'volatile' was incorrectly IF_LINTted out. | ||
| 120 | |||
| 121 | * lisp.h (child_setup): Now NO_RETURN unless DOS_NT. | ||
| 122 | This should get cleaned up, so that child_setup has the | ||
| 123 | same signature on all platforms. | ||
| 124 | |||
| 125 | * callproc.c (call_process_cleanup): Now static. | ||
| 126 | (relocate_fd): Rename locals to avoid shadowing. | ||
| 127 | |||
| 1 | 2011-03-22 Chong Yidong <cyd@stupidchicken.com> | 128 | 2011-03-22 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 129 | ||
| 3 | * xterm.c (x_clear_frame): Remove XClearWindow call. This appears | 130 | * xterm.c (x_clear_frame): Remove XClearWindow call. This appears |
diff --git a/src/atimer.c b/src/atimer.c index 309a4eaee4f..e10add961eb 100644 --- a/src/atimer.c +++ b/src/atimer.c | |||
| @@ -86,7 +86,7 @@ SIGTYPE alarm_signal_handler (int signo); | |||
| 86 | to cancel_atimer; don't free it yourself. */ | 86 | to cancel_atimer; don't free it yourself. */ |
| 87 | 87 | ||
| 88 | struct atimer * | 88 | struct atimer * |
| 89 | start_atimer (enum atimer_type type, EMACS_TIME time, atimer_callback fn, | 89 | start_atimer (enum atimer_type type, EMACS_TIME timestamp, atimer_callback fn, |
| 90 | void *client_data) | 90 | void *client_data) |
| 91 | { | 91 | { |
| 92 | struct atimer *t; | 92 | struct atimer *t; |
| @@ -94,10 +94,10 @@ start_atimer (enum atimer_type type, EMACS_TIME time, atimer_callback fn, | |||
| 94 | /* Round TIME up to the next full second if we don't have | 94 | /* Round TIME up to the next full second if we don't have |
| 95 | itimers. */ | 95 | itimers. */ |
| 96 | #ifndef HAVE_SETITIMER | 96 | #ifndef HAVE_SETITIMER |
| 97 | if (EMACS_USECS (time) != 0) | 97 | if (EMACS_USECS (timestamp) != 0) |
| 98 | { | 98 | { |
| 99 | EMACS_SET_USECS (time, 0); | 99 | EMACS_SET_USECS (timestamp, 0); |
| 100 | EMACS_SET_SECS (time, EMACS_SECS (time) + 1); | 100 | EMACS_SET_SECS (timestamp, EMACS_SECS (timestamp) + 1); |
| 101 | } | 101 | } |
| 102 | #endif /* not HAVE_SETITIMER */ | 102 | #endif /* not HAVE_SETITIMER */ |
| 103 | 103 | ||
| @@ -123,18 +123,18 @@ start_atimer (enum atimer_type type, EMACS_TIME time, atimer_callback fn, | |||
| 123 | switch (type) | 123 | switch (type) |
| 124 | { | 124 | { |
| 125 | case ATIMER_ABSOLUTE: | 125 | case ATIMER_ABSOLUTE: |
| 126 | t->expiration = time; | 126 | t->expiration = timestamp; |
| 127 | break; | 127 | break; |
| 128 | 128 | ||
| 129 | case ATIMER_RELATIVE: | 129 | case ATIMER_RELATIVE: |
| 130 | EMACS_GET_TIME (t->expiration); | 130 | EMACS_GET_TIME (t->expiration); |
| 131 | EMACS_ADD_TIME (t->expiration, t->expiration, time); | 131 | EMACS_ADD_TIME (t->expiration, t->expiration, timestamp); |
| 132 | break; | 132 | break; |
| 133 | 133 | ||
| 134 | case ATIMER_CONTINUOUS: | 134 | case ATIMER_CONTINUOUS: |
| 135 | EMACS_GET_TIME (t->expiration); | 135 | EMACS_GET_TIME (t->expiration); |
| 136 | EMACS_ADD_TIME (t->expiration, t->expiration, time); | 136 | EMACS_ADD_TIME (t->expiration, t->expiration, timestamp); |
| 137 | t->interval = time; | 137 | t->interval = timestamp; |
| 138 | break; | 138 | break; |
| 139 | } | 139 | } |
| 140 | 140 | ||
| @@ -187,24 +187,24 @@ cancel_atimer (struct atimer *timer) | |||
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | 189 | ||
| 190 | /* Append two lists of atimers LIST1 and LIST2 and return the | 190 | /* Append two lists of atimers LIST_1 and LIST_2 and return the |
| 191 | result list. */ | 191 | result list. */ |
| 192 | 192 | ||
| 193 | static struct atimer * | 193 | static struct atimer * |
| 194 | append_atimer_lists (struct atimer *list1, struct atimer *list2) | 194 | append_atimer_lists (struct atimer *list_1, struct atimer *list_2) |
| 195 | { | 195 | { |
| 196 | if (list1 == NULL) | 196 | if (list_1 == NULL) |
| 197 | return list2; | 197 | return list_2; |
| 198 | else if (list2 == NULL) | 198 | else if (list_2 == NULL) |
| 199 | return list1; | 199 | return list_1; |
| 200 | else | 200 | else |
| 201 | { | 201 | { |
| 202 | struct atimer *p; | 202 | struct atimer *p; |
| 203 | 203 | ||
| 204 | for (p = list1; p->next; p = p->next) | 204 | for (p = list_1; p->next; p = p->next) |
| 205 | ; | 205 | ; |
| 206 | p->next = list2; | 206 | p->next = list_2; |
| 207 | return list1; | 207 | return list_1; |
| 208 | } | 208 | } |
| 209 | } | 209 | } |
| 210 | 210 | ||
| @@ -287,28 +287,28 @@ set_alarm (void) | |||
| 287 | { | 287 | { |
| 288 | if (atimers) | 288 | if (atimers) |
| 289 | { | 289 | { |
| 290 | EMACS_TIME now, time; | 290 | EMACS_TIME now, timestamp; |
| 291 | #ifdef HAVE_SETITIMER | 291 | #ifdef HAVE_SETITIMER |
| 292 | struct itimerval it; | 292 | struct itimerval it; |
| 293 | #endif | 293 | #endif |
| 294 | 294 | ||
| 295 | /* Determine s/us till the next timer is ripe. */ | 295 | /* Determine s/us till the next timer is ripe. */ |
| 296 | EMACS_GET_TIME (now); | 296 | EMACS_GET_TIME (now); |
| 297 | EMACS_SUB_TIME (time, atimers->expiration, now); | 297 | EMACS_SUB_TIME (timestamp, atimers->expiration, now); |
| 298 | 298 | ||
| 299 | #ifdef HAVE_SETITIMER | 299 | #ifdef HAVE_SETITIMER |
| 300 | /* Don't set the interval to 0; this disables the timer. */ | 300 | /* Don't set the interval to 0; this disables the timer. */ |
| 301 | if (EMACS_TIME_LE (atimers->expiration, now)) | 301 | if (EMACS_TIME_LE (atimers->expiration, now)) |
| 302 | { | 302 | { |
| 303 | EMACS_SET_SECS (time, 0); | 303 | EMACS_SET_SECS (timestamp, 0); |
| 304 | EMACS_SET_USECS (time, 1000); | 304 | EMACS_SET_USECS (timestamp, 1000); |
| 305 | } | 305 | } |
| 306 | 306 | ||
| 307 | memset (&it, 0, sizeof it); | 307 | memset (&it, 0, sizeof it); |
| 308 | it.it_value = time; | 308 | it.it_value = timestamp; |
| 309 | setitimer (ITIMER_REAL, &it, 0); | 309 | setitimer (ITIMER_REAL, &it, 0); |
| 310 | #else /* not HAVE_SETITIMER */ | 310 | #else /* not HAVE_SETITIMER */ |
| 311 | alarm (max (EMACS_SECS (time), 1)); | 311 | alarm (max (EMACS_SECS (timestamp), 1)); |
| 312 | #endif /* not HAVE_SETITIMER */ | 312 | #endif /* not HAVE_SETITIMER */ |
| 313 | } | 313 | } |
| 314 | } | 314 | } |
| @@ -442,4 +442,3 @@ init_atimer (void) | |||
| 442 | /* pending_signals is initialized in init_keyboard.*/ | 442 | /* pending_signals is initialized in init_keyboard.*/ |
| 443 | signal (SIGALRM, alarm_signal_handler); | 443 | signal (SIGALRM, alarm_signal_handler); |
| 444 | } | 444 | } |
| 445 | |||
diff --git a/src/callproc.c b/src/callproc.c index c53a92bbaf8..75f239d1be2 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -107,7 +107,7 @@ call_process_kill (Lisp_Object fdpid) | |||
| 107 | return Qnil; | 107 | return Qnil; |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | Lisp_Object | 110 | static Lisp_Object |
| 111 | call_process_cleanup (Lisp_Object arg) | 111 | call_process_cleanup (Lisp_Object arg) |
| 112 | { | 112 | { |
| 113 | Lisp_Object fdpid = Fcdr (arg); | 113 | Lisp_Object fdpid = Fcdr (arg); |
| @@ -180,7 +180,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 180 | (int nargs, register Lisp_Object *args) | 180 | (int nargs, register Lisp_Object *args) |
| 181 | { | 181 | { |
| 182 | Lisp_Object infile, buffer, current_dir, path; | 182 | Lisp_Object infile, buffer, current_dir, path; |
| 183 | int display_p; | 183 | volatile int display_p_volatile; |
| 184 | int fd[2]; | 184 | int fd[2]; |
| 185 | int filefd; | 185 | int filefd; |
| 186 | register int pid; | 186 | register int pid; |
| @@ -190,6 +190,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 190 | int bufsize = CALLPROC_BUFFER_SIZE_MIN; | 190 | int bufsize = CALLPROC_BUFFER_SIZE_MIN; |
| 191 | int count = SPECPDL_INDEX (); | 191 | int count = SPECPDL_INDEX (); |
| 192 | 192 | ||
| 193 | const unsigned char **volatile new_argv_volatile; | ||
| 193 | register const unsigned char **new_argv; | 194 | register const unsigned char **new_argv; |
| 194 | /* File to use for stderr in the child. | 195 | /* File to use for stderr in the child. |
| 195 | t means use same as standard output. */ | 196 | t means use same as standard output. */ |
| @@ -343,7 +344,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 343 | UNGCPRO; | 344 | UNGCPRO; |
| 344 | } | 345 | } |
| 345 | 346 | ||
| 346 | display_p = INTERACTIVE && nargs >= 4 && !NILP (args[3]); | 347 | display_p_volatile = INTERACTIVE && nargs >= 4 && !NILP (args[3]); |
| 347 | 348 | ||
| 348 | filefd = emacs_open (SSDATA (infile), O_RDONLY, 0); | 349 | filefd = emacs_open (SSDATA (infile), O_RDONLY, 0); |
| 349 | if (filefd < 0) | 350 | if (filefd < 0) |
| @@ -371,7 +372,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 371 | && SREF (path, 1) == ':') | 372 | && SREF (path, 1) == ':') |
| 372 | path = Fsubstring (path, make_number (2), Qnil); | 373 | path = Fsubstring (path, make_number (2), Qnil); |
| 373 | 374 | ||
| 374 | new_argv = (const unsigned char **) | 375 | new_argv_volatile = new_argv = (const unsigned char **) |
| 375 | alloca (max (2, nargs - 2) * sizeof (char *)); | 376 | alloca (max (2, nargs - 2) * sizeof (char *)); |
| 376 | if (nargs > 4) | 377 | if (nargs > 4) |
| 377 | { | 378 | { |
| @@ -542,6 +543,8 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 542 | 543 | ||
| 543 | pid = vfork (); | 544 | pid = vfork (); |
| 544 | 545 | ||
| 546 | new_argv = new_argv_volatile; | ||
| 547 | |||
| 545 | if (pid == 0) | 548 | if (pid == 0) |
| 546 | { | 549 | { |
| 547 | if (fd[0] >= 0) | 550 | if (fd[0] >= 0) |
| @@ -673,6 +676,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 673 | int first = 1; | 676 | int first = 1; |
| 674 | EMACS_INT total_read = 0; | 677 | EMACS_INT total_read = 0; |
| 675 | int carryover = 0; | 678 | int carryover = 0; |
| 679 | int display_p = display_p_volatile; | ||
| 676 | int display_on_the_fly = display_p; | 680 | int display_on_the_fly = display_p; |
| 677 | struct coding_system saved_coding; | 681 | struct coding_system saved_coding; |
| 678 | 682 | ||
| @@ -1272,12 +1276,12 @@ relocate_fd (int fd, int minfd) | |||
| 1272 | #endif | 1276 | #endif |
| 1273 | if (new == -1) | 1277 | if (new == -1) |
| 1274 | { | 1278 | { |
| 1275 | const char *message1 = "Error while setting up child: "; | 1279 | const char *message_1 = "Error while setting up child: "; |
| 1276 | const char *errmessage = strerror (errno); | 1280 | const char *errmessage = strerror (errno); |
| 1277 | const char *message2 = "\n"; | 1281 | const char *message_2 = "\n"; |
| 1278 | emacs_write (2, message1, strlen (message1)); | 1282 | emacs_write (2, message_1, strlen (message_1)); |
| 1279 | emacs_write (2, errmessage, strlen (errmessage)); | 1283 | emacs_write (2, errmessage, strlen (errmessage)); |
| 1280 | emacs_write (2, message2, strlen (message2)); | 1284 | emacs_write (2, message_2, strlen (message_2)); |
| 1281 | _exit (1); | 1285 | _exit (1); |
| 1282 | } | 1286 | } |
| 1283 | emacs_close (fd); | 1287 | emacs_close (fd); |
diff --git a/src/character.h b/src/character.h index 4c468e14d2c..91020cadedc 100644 --- a/src/character.h +++ b/src/character.h | |||
| @@ -278,11 +278,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 278 | do { \ | 278 | do { \ |
| 279 | if ((p) > (limit)) \ | 279 | if ((p) > (limit)) \ |
| 280 | { \ | 280 | { \ |
| 281 | const unsigned char *pcb = (p); \ | 281 | const unsigned char *chp = (p); \ |
| 282 | do { \ | 282 | do { \ |
| 283 | pcb--; \ | 283 | chp--; \ |
| 284 | } while (pcb >= limit && ! CHAR_HEAD_P (*pcb)); \ | 284 | } while (chp >= limit && ! CHAR_HEAD_P (*chp)); \ |
| 285 | (p) = (BYTES_BY_CHAR_HEAD (*pcb) == (p) - pcb) ? pcb : (p) - 1; \ | 285 | (p) = (BYTES_BY_CHAR_HEAD (*chp) == (p) - chp) ? chp : (p) - 1; \ |
| 286 | } \ | 286 | } \ |
| 287 | } while (0) | 287 | } while (0) |
| 288 | 288 | ||
| @@ -353,11 +353,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 353 | CHARIDX++; \ | 353 | CHARIDX++; \ |
| 354 | if (STRING_MULTIBYTE (STRING)) \ | 354 | if (STRING_MULTIBYTE (STRING)) \ |
| 355 | { \ | 355 | { \ |
| 356 | unsigned char *string_ptr = &SDATA (STRING)[BYTEIDX]; \ | 356 | unsigned char *chp = &SDATA (STRING)[BYTEIDX]; \ |
| 357 | int string_len; \ | 357 | int chlen; \ |
| 358 | \ | 358 | \ |
| 359 | OUTPUT = STRING_CHAR_AND_LENGTH (string_ptr, string_len); \ | 359 | OUTPUT = STRING_CHAR_AND_LENGTH (chp, chlen); \ |
| 360 | BYTEIDX += string_len; \ | 360 | BYTEIDX += chlen; \ |
| 361 | } \ | 361 | } \ |
| 362 | else \ | 362 | else \ |
| 363 | { \ | 363 | { \ |
| @@ -376,11 +376,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 376 | CHARIDX++; \ | 376 | CHARIDX++; \ |
| 377 | if (STRING_MULTIBYTE (STRING)) \ | 377 | if (STRING_MULTIBYTE (STRING)) \ |
| 378 | { \ | 378 | { \ |
| 379 | unsigned char *ptr = &SDATA (STRING)[BYTEIDX]; \ | 379 | unsigned char *chp = &SDATA (STRING)[BYTEIDX]; \ |
| 380 | int ptrlen; \ | 380 | int chlen; \ |
| 381 | \ | 381 | \ |
| 382 | OUTPUT = STRING_CHAR_AND_LENGTH (ptr, ptrlen); \ | 382 | OUTPUT = STRING_CHAR_AND_LENGTH (chp, chlen); \ |
| 383 | BYTEIDX += ptrlen; \ | 383 | BYTEIDX += chlen; \ |
| 384 | } \ | 384 | } \ |
| 385 | else \ | 385 | else \ |
| 386 | { \ | 386 | { \ |
| @@ -416,11 +416,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 416 | CHARIDX++; \ | 416 | CHARIDX++; \ |
| 417 | if (!NILP (BVAR (current_buffer, enable_multibyte_characters))) \ | 417 | if (!NILP (BVAR (current_buffer, enable_multibyte_characters))) \ |
| 418 | { \ | 418 | { \ |
| 419 | unsigned char *ptr = BYTE_POS_ADDR (BYTEIDX); \ | 419 | unsigned char *chp = BYTE_POS_ADDR (BYTEIDX); \ |
| 420 | int string_len; \ | 420 | int chlen; \ |
| 421 | \ | 421 | \ |
| 422 | OUTPUT= STRING_CHAR_AND_LENGTH (ptr, string_len); \ | 422 | OUTPUT= STRING_CHAR_AND_LENGTH (chp, chlen); \ |
| 423 | BYTEIDX += string_len; \ | 423 | BYTEIDX += chlen; \ |
| 424 | } \ | 424 | } \ |
| 425 | else \ | 425 | else \ |
| 426 | { \ | 426 | { \ |
| @@ -436,11 +436,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 436 | #define FETCH_CHAR_ADVANCE_NO_CHECK(OUTPUT, CHARIDX, BYTEIDX) \ | 436 | #define FETCH_CHAR_ADVANCE_NO_CHECK(OUTPUT, CHARIDX, BYTEIDX) \ |
| 437 | do \ | 437 | do \ |
| 438 | { \ | 438 | { \ |
| 439 | unsigned char *ptr = BYTE_POS_ADDR (BYTEIDX); \ | 439 | unsigned char *chp = BYTE_POS_ADDR (BYTEIDX); \ |
| 440 | int len; \ | 440 | int chlen; \ |
| 441 | \ | 441 | \ |
| 442 | OUTPUT = STRING_CHAR_AND_LENGTH (ptr, len); \ | 442 | OUTPUT = STRING_CHAR_AND_LENGTH (chp, chlen); \ |
| 443 | BYTEIDX += len; \ | 443 | BYTEIDX += chlen; \ |
| 444 | CHARIDX++; \ | 444 | CHARIDX++; \ |
| 445 | } \ | 445 | } \ |
| 446 | while (0) | 446 | while (0) |
| @@ -451,8 +451,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 451 | 451 | ||
| 452 | #define INC_POS(pos_byte) \ | 452 | #define INC_POS(pos_byte) \ |
| 453 | do { \ | 453 | do { \ |
| 454 | unsigned char *ptr = BYTE_POS_ADDR (pos_byte); \ | 454 | unsigned char *chp = BYTE_POS_ADDR (pos_byte); \ |
| 455 | pos_byte += BYTES_BY_CHAR_HEAD (*ptr); \ | 455 | pos_byte += BYTES_BY_CHAR_HEAD (*chp); \ |
| 456 | } while (0) | 456 | } while (0) |
| 457 | 457 | ||
| 458 | 458 | ||
| @@ -461,16 +461,16 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 461 | 461 | ||
| 462 | #define DEC_POS(pos_byte) \ | 462 | #define DEC_POS(pos_byte) \ |
| 463 | do { \ | 463 | do { \ |
| 464 | unsigned char *ptr; \ | 464 | unsigned char *chp; \ |
| 465 | \ | 465 | \ |
| 466 | pos_byte--; \ | 466 | pos_byte--; \ |
| 467 | if (pos_byte < GPT_BYTE) \ | 467 | if (pos_byte < GPT_BYTE) \ |
| 468 | ptr = BEG_ADDR + pos_byte - BEG_BYTE; \ | 468 | chp = BEG_ADDR + pos_byte - BEG_BYTE; \ |
| 469 | else \ | 469 | else \ |
| 470 | ptr = BEG_ADDR + GAP_SIZE + pos_byte - BEG_BYTE; \ | 470 | chp = BEG_ADDR + GAP_SIZE + pos_byte - BEG_BYTE; \ |
| 471 | while (!CHAR_HEAD_P (*ptr)) \ | 471 | while (!CHAR_HEAD_P (*chp)) \ |
| 472 | { \ | 472 | { \ |
| 473 | ptr--; \ | 473 | chp--; \ |
| 474 | pos_byte--; \ | 474 | pos_byte--; \ |
| 475 | } \ | 475 | } \ |
| 476 | } while (0) | 476 | } while (0) |
| @@ -510,8 +510,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 510 | 510 | ||
| 511 | #define BUF_INC_POS(buf, pos_byte) \ | 511 | #define BUF_INC_POS(buf, pos_byte) \ |
| 512 | do { \ | 512 | do { \ |
| 513 | unsigned char *bbp = BUF_BYTE_ADDRESS (buf, pos_byte); \ | 513 | unsigned char *chp = BUF_BYTE_ADDRESS (buf, pos_byte); \ |
| 514 | pos_byte += BYTES_BY_CHAR_HEAD (*bbp); \ | 514 | pos_byte += BYTES_BY_CHAR_HEAD (*chp); \ |
| 515 | } while (0) | 515 | } while (0) |
| 516 | 516 | ||
| 517 | 517 | ||
| @@ -520,15 +520,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 520 | 520 | ||
| 521 | #define BUF_DEC_POS(buf, pos_byte) \ | 521 | #define BUF_DEC_POS(buf, pos_byte) \ |
| 522 | do { \ | 522 | do { \ |
| 523 | unsigned char *p; \ | 523 | unsigned char *chp; \ |
| 524 | pos_byte--; \ | 524 | pos_byte--; \ |
| 525 | if (pos_byte < BUF_GPT_BYTE (buf)) \ | 525 | if (pos_byte < BUF_GPT_BYTE (buf)) \ |
| 526 | p = BUF_BEG_ADDR (buf) + pos_byte - BEG_BYTE; \ | 526 | chp = BUF_BEG_ADDR (buf) + pos_byte - BEG_BYTE; \ |
| 527 | else \ | 527 | else \ |
| 528 | p = BUF_BEG_ADDR (buf) + BUF_GAP_SIZE (buf) + pos_byte - BEG_BYTE;\ | 528 | chp = BUF_BEG_ADDR (buf) + BUF_GAP_SIZE (buf) + pos_byte - BEG_BYTE;\ |
| 529 | while (!CHAR_HEAD_P (*p)) \ | 529 | while (!CHAR_HEAD_P (*chp)) \ |
| 530 | { \ | 530 | { \ |
| 531 | p--; \ | 531 | chp--; \ |
| 532 | pos_byte--; \ | 532 | pos_byte--; \ |
| 533 | } \ | 533 | } \ |
| 534 | } while (0) | 534 | } while (0) |
| @@ -27,19 +27,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 27 | #include "cm.h" | 27 | #include "cm.h" |
| 28 | #include "termhooks.h" | 28 | #include "termhooks.h" |
| 29 | #include "termchar.h" | 29 | #include "termchar.h" |
| 30 | 30 | #include "tparam.h" | |
| 31 | |||
| 32 | /* For now, don't try to include termcap.h. On some systems, | ||
| 33 | configure finds a non-standard termcap.h that the main build | ||
| 34 | won't find. */ | ||
| 35 | extern void tputs (const char *, int, int (*)(int)); | ||
| 36 | extern char *tgoto (const char *, int, int); | ||
| 37 | 31 | ||
| 38 | #define BIG 9999 /* 9999 good on VAXen. For 16 bit machines | 32 | #define BIG 9999 /* 9999 good on VAXen. For 16 bit machines |
| 39 | use about 2000.... */ | 33 | use about 2000.... */ |
| 40 | 34 | ||
| 41 | extern char *BC, *UP; | ||
| 42 | |||
| 43 | int cost; /* sums up costs */ | 35 | int cost; /* sums up costs */ |
| 44 | 36 | ||
| 45 | /* ARGSUSED */ | 37 | /* ARGSUSED */ |
| @@ -96,8 +96,6 @@ struct cm | |||
| 96 | int cc_vabs; | 96 | int cc_vabs; |
| 97 | }; | 97 | }; |
| 98 | 98 | ||
| 99 | extern char PC; /* Pad character */ | ||
| 100 | |||
| 101 | /* Shorthand */ | 99 | /* Shorthand */ |
| 102 | #ifndef NoCMShortHand | 100 | #ifndef NoCMShortHand |
| 103 | #define curY(tty) (tty)->Wcm->cm_curY | 101 | #define curY(tty) (tty)->Wcm->cm_curY |
diff --git a/src/coding.c b/src/coding.c index 0c2836c19f6..0596d16bf46 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -5266,11 +5266,12 @@ encode_coding_raw_text (struct coding_system *coding) | |||
| 5266 | unsigned char str[MAX_MULTIBYTE_LENGTH], *p0 = str, *p1 = str; | 5266 | unsigned char str[MAX_MULTIBYTE_LENGTH], *p0 = str, *p1 = str; |
| 5267 | 5267 | ||
| 5268 | CHAR_STRING_ADVANCE (c, p1); | 5268 | CHAR_STRING_ADVANCE (c, p1); |
| 5269 | while (p0 < p1) | 5269 | do |
| 5270 | { | 5270 | { |
| 5271 | EMIT_ONE_BYTE (*p0); | 5271 | EMIT_ONE_BYTE (*p0); |
| 5272 | p0++; | 5272 | p0++; |
| 5273 | } | 5273 | } |
| 5274 | while (p0 < p1); | ||
| 5274 | } | 5275 | } |
| 5275 | } | 5276 | } |
| 5276 | else | 5277 | else |
diff --git a/src/composite.c b/src/composite.c index 0b0602bf283..bc5644a4612 100644 --- a/src/composite.c +++ b/src/composite.c | |||
| @@ -1115,7 +1115,7 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos, | |||
| 1115 | if (! NILP (val)) | 1115 | if (! NILP (val)) |
| 1116 | { | 1116 | { |
| 1117 | Lisp_Object elt; | 1117 | Lisp_Object elt; |
| 1118 | int ridx, back, len; | 1118 | int ridx, back, blen; |
| 1119 | 1119 | ||
| 1120 | for (ridx = 0; CONSP (val); val = XCDR (val), ridx++) | 1120 | for (ridx = 0; CONSP (val); val = XCDR (val), ridx++) |
| 1121 | { | 1121 | { |
| @@ -1132,17 +1132,17 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos, | |||
| 1132 | bpos = (NILP (string) ? CHAR_TO_BYTE (cpos) | 1132 | bpos = (NILP (string) ? CHAR_TO_BYTE (cpos) |
| 1133 | : string_char_to_byte (string, cpos)); | 1133 | : string_char_to_byte (string, cpos)); |
| 1134 | if (STRINGP (AREF (elt, 0))) | 1134 | if (STRINGP (AREF (elt, 0))) |
| 1135 | len = fast_looking_at (AREF (elt, 0), cpos, bpos, | 1135 | blen = fast_looking_at (AREF (elt, 0), cpos, bpos, |
| 1136 | start + 1, limit, string); | 1136 | start + 1, limit, string); |
| 1137 | else | 1137 | else |
| 1138 | len = 1; | 1138 | blen = 1; |
| 1139 | if (len > 0) | 1139 | if (blen > 0) |
| 1140 | { | 1140 | { |
| 1141 | /* Make CPOS point to the last character of | 1141 | /* Make CPOS point to the last character of |
| 1142 | match. Note that LEN is byte-length. */ | 1142 | match. Note that BLEN is byte-length. */ |
| 1143 | if (len > 1) | 1143 | if (blen > 1) |
| 1144 | { | 1144 | { |
| 1145 | bpos += len; | 1145 | bpos += blen; |
| 1146 | if (NILP (string)) | 1146 | if (NILP (string)) |
| 1147 | cpos = BYTE_TO_CHAR (bpos) - 1; | 1147 | cpos = BYTE_TO_CHAR (bpos) - 1; |
| 1148 | else | 1148 | else |
| @@ -1248,8 +1248,8 @@ composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_I | |||
| 1248 | else if (w) | 1248 | else if (w) |
| 1249 | { | 1249 | { |
| 1250 | Lisp_Object lgstring = Qnil; | 1250 | Lisp_Object lgstring = Qnil; |
| 1251 | Lisp_Object val, elt, re; | 1251 | Lisp_Object val, elt; |
| 1252 | int len, i; | 1252 | int i; |
| 1253 | 1253 | ||
| 1254 | val = CHAR_TABLE_REF (Vcomposition_function_table, cmp_it->ch); | 1254 | val = CHAR_TABLE_REF (Vcomposition_function_table, cmp_it->ch); |
| 1255 | for (i = 0; i < cmp_it->rule_idx; i++, val = XCDR (val)); | 1255 | for (i = 0; i < cmp_it->rule_idx; i++, val = XCDR (val)); |
| @@ -1364,7 +1364,7 @@ composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_I | |||
| 1364 | int | 1364 | int |
| 1365 | composition_update_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_INT bytepos, Lisp_Object string) | 1365 | composition_update_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_INT bytepos, Lisp_Object string) |
| 1366 | { | 1366 | { |
| 1367 | int i, c; | 1367 | int i, c IF_LINT (= 0); |
| 1368 | 1368 | ||
| 1369 | if (cmp_it->ch < 0) | 1369 | if (cmp_it->ch < 0) |
| 1370 | { | 1370 | { |
| @@ -1489,9 +1489,14 @@ find_automatic_composition (EMACS_INT pos, EMACS_INT limit, EMACS_INT *start, EM | |||
| 1489 | EMACS_INT head, tail, stop; | 1489 | EMACS_INT head, tail, stop; |
| 1490 | /* Limit to check a composition after POS. */ | 1490 | /* Limit to check a composition after POS. */ |
| 1491 | EMACS_INT fore_check_limit; | 1491 | EMACS_INT fore_check_limit; |
| 1492 | struct position_record orig, cur, check, prev; | 1492 | struct position_record orig, cur; |
| 1493 | |||
| 1494 | /* FIXME: It's not obvious whether these two variables need initialization. | ||
| 1495 | If they do, please supply initial values. | ||
| 1496 | If not, please remove this comment. */ | ||
| 1497 | struct position_record check IF_LINT (= {0}), prev IF_LINT (= {0}); | ||
| 1498 | |||
| 1493 | Lisp_Object check_val, val, elt; | 1499 | Lisp_Object check_val, val, elt; |
| 1494 | int check_lookback; | ||
| 1495 | int c; | 1500 | int c; |
| 1496 | Lisp_Object window; | 1501 | Lisp_Object window; |
| 1497 | struct window *w; | 1502 | struct window *w; |
| @@ -1657,7 +1662,7 @@ find_automatic_composition (EMACS_INT pos, EMACS_INT limit, EMACS_INT *start, EM | |||
| 1657 | EMACS_INT | 1662 | EMACS_INT |
| 1658 | composition_adjust_point (EMACS_INT last_pt, EMACS_INT new_pt) | 1663 | composition_adjust_point (EMACS_INT last_pt, EMACS_INT new_pt) |
| 1659 | { | 1664 | { |
| 1660 | EMACS_INT charpos, bytepos, startpos, beg, end, pos; | 1665 | EMACS_INT beg, end; |
| 1661 | Lisp_Object val; | 1666 | Lisp_Object val; |
| 1662 | int i; | 1667 | int i; |
| 1663 | 1668 | ||
| @@ -2032,4 +2037,3 @@ See also the documentation of `auto-composition-mode'. */); | |||
| 2032 | defsubr (&Sfind_composition_internal); | 2037 | defsubr (&Sfind_composition_internal); |
| 2033 | defsubr (&Scomposition_get_gstring); | 2038 | defsubr (&Scomposition_get_gstring); |
| 2034 | } | 2039 | } |
| 2035 | |||
diff --git a/src/deps.mk b/src/deps.mk index 35754dfa7de..d84e80dca44 100644 --- a/src/deps.mk +++ b/src/deps.mk | |||
| @@ -65,7 +65,7 @@ coding.o: coding.c coding.h ccl.h buffer.h character.h charset.h composite.h \ | |||
| 65 | window.h dispextern.h msdos.h frame.h termhooks.h \ | 65 | window.h dispextern.h msdos.h frame.h termhooks.h \ |
| 66 | lisp.h globals.h $(config_h) | 66 | lisp.h globals.h $(config_h) |
| 67 | cm.o: cm.c frame.h cm.h termhooks.h termchar.h dispextern.h msdos.h \ | 67 | cm.o: cm.c frame.h cm.h termhooks.h termchar.h dispextern.h msdos.h \ |
| 68 | lisp.h globals.h $(config_h) | 68 | tparam.h lisp.h globals.h $(config_h) |
| 69 | cmds.o: cmds.c syntax.h buffer.h character.h commands.h window.h lisp.h \ | 69 | cmds.o: cmds.c syntax.h buffer.h character.h commands.h window.h lisp.h \ |
| 70 | globals.h $(config_h) msdos.h dispextern.h keyboard.h keymap.h systime.h \ | 70 | globals.h $(config_h) msdos.h dispextern.h keyboard.h keymap.h systime.h \ |
| 71 | coding.h frame.h composite.h | 71 | coding.h frame.h composite.h |
| @@ -196,7 +196,7 @@ termcap.o: termcap.c lisp.h tparam.h msdos.h $(config_h) | |||
| 196 | terminal.o: terminal.c frame.h termchar.h termhooks.h charset.h coding.h \ | 196 | terminal.o: terminal.c frame.h termchar.h termhooks.h charset.h coding.h \ |
| 197 | keyboard.h lisp.h globals.h $(config_h) dispextern.h composite.h systime.h \ | 197 | keyboard.h lisp.h globals.h $(config_h) dispextern.h composite.h systime.h \ |
| 198 | msdos.h | 198 | msdos.h |
| 199 | terminfo.o: terminfo.c lisp.h globals.h $(config_h) | 199 | terminfo.o: terminfo.c tparam.h lisp.h globals.h $(config_h) |
| 200 | tparam.o: tparam.c tparam.h lisp.h $(config_h) | 200 | tparam.o: tparam.c tparam.h lisp.h $(config_h) |
| 201 | undo.o: undo.c buffer.h commands.h window.h dispextern.h msdos.h \ | 201 | undo.o: undo.c buffer.h commands.h window.h dispextern.h msdos.h \ |
| 202 | lisp.h globals.h $(config_h) | 202 | lisp.h globals.h $(config_h) |
diff --git a/src/emacs.c b/src/emacs.c index 052f22ea622..bc7c07a9326 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -2312,6 +2312,7 @@ from the parent process and its tty file descriptors. */) | |||
| 2312 | (void) | 2312 | (void) |
| 2313 | { | 2313 | { |
| 2314 | int nfd; | 2314 | int nfd; |
| 2315 | int err = 0; | ||
| 2315 | 2316 | ||
| 2316 | if (!IS_DAEMON) | 2317 | if (!IS_DAEMON) |
| 2317 | error ("This function can only be called if emacs is run as a daemon"); | 2318 | error ("This function can only be called if emacs is run as a daemon"); |
| @@ -2324,10 +2325,11 @@ from the parent process and its tty file descriptors. */) | |||
| 2324 | 2325 | ||
| 2325 | /* Get rid of stdin, stdout and stderr. */ | 2326 | /* Get rid of stdin, stdout and stderr. */ |
| 2326 | nfd = open ("/dev/null", O_RDWR); | 2327 | nfd = open ("/dev/null", O_RDWR); |
| 2327 | dup2 (nfd, 0); | 2328 | err |= nfd < 0; |
| 2328 | dup2 (nfd, 1); | 2329 | err |= dup2 (nfd, 0) < 0; |
| 2329 | dup2 (nfd, 2); | 2330 | err |= dup2 (nfd, 1) < 0; |
| 2330 | close (nfd); | 2331 | err |= dup2 (nfd, 2) < 0; |
| 2332 | err |= close (nfd) != 0; | ||
| 2331 | 2333 | ||
| 2332 | /* Closing the pipe will notify the parent that it can exit. | 2334 | /* Closing the pipe will notify the parent that it can exit. |
| 2333 | FIXME: In case some other process inherited the pipe, closing it here | 2335 | FIXME: In case some other process inherited the pipe, closing it here |
| @@ -2336,10 +2338,13 @@ from the parent process and its tty file descriptors. */) | |||
| 2336 | Instead, we should probably close the pipe in start-process and | 2338 | Instead, we should probably close the pipe in start-process and |
| 2337 | call-process to make sure the pipe is never inherited by | 2339 | call-process to make sure the pipe is never inherited by |
| 2338 | subprocesses. */ | 2340 | subprocesses. */ |
| 2339 | write (daemon_pipe[1], "\n", 1); | 2341 | err |= write (daemon_pipe[1], "\n", 1) < 0; |
| 2340 | close (daemon_pipe[1]); | 2342 | err |= close (daemon_pipe[1]) != 0; |
| 2341 | /* Set it to an invalid value so we know we've already run this function. */ | 2343 | /* Set it to an invalid value so we know we've already run this function. */ |
| 2342 | daemon_pipe[1] = -1; | 2344 | daemon_pipe[1] = -1; |
| 2345 | |||
| 2346 | if (err) | ||
| 2347 | error ("I/O error during daemon initialization"); | ||
| 2343 | return Qt; | 2348 | return Qt; |
| 2344 | } | 2349 | } |
| 2345 | 2350 | ||
diff --git a/src/fileio.c b/src/fileio.c index 5d33fb93878..7d2f10d517c 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -1951,9 +1951,10 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */) | |||
| 1951 | owner and group. */ | 1951 | owner and group. */ |
| 1952 | if (input_file_statable_p) | 1952 | if (input_file_statable_p) |
| 1953 | { | 1953 | { |
| 1954 | if (! NILP (preserve_uid_gid)) | 1954 | if (!NILP (preserve_uid_gid) && fchown (ofd, st.st_uid, st.st_gid) != 0) |
| 1955 | fchown (ofd, st.st_uid, st.st_gid); | 1955 | report_file_error ("Doing chown", Fcons (newname, Qnil)); |
| 1956 | fchmod (ofd, st.st_mode & 07777); | 1956 | if (fchmod (ofd, st.st_mode & 07777) != 0) |
| 1957 | report_file_error ("Doing chmod", Fcons (newname, Qnil)); | ||
| 1957 | } | 1958 | } |
| 1958 | #endif /* not MSDOS */ | 1959 | #endif /* not MSDOS */ |
| 1959 | 1960 | ||
diff --git a/src/frame.c b/src/frame.c index 05938f3e1f0..3e00e1bf107 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -2529,7 +2529,7 @@ use is not recommended. Explicitly check for a frame-parameter instead. */) | |||
| 2529 | } | 2529 | } |
| 2530 | 2530 | ||
| 2531 | /* Now process them in reverse of specified order. */ | 2531 | /* Now process them in reverse of specified order. */ |
| 2532 | for (i--; i >= 0; i--) | 2532 | while (--i >= 0) |
| 2533 | { | 2533 | { |
| 2534 | prop = parms[i]; | 2534 | prop = parms[i]; |
| 2535 | val = values[i]; | 2535 | val = values[i]; |
| @@ -3713,8 +3713,7 @@ validate_x_resource_name (void) | |||
| 3713 | return; | 3713 | return; |
| 3714 | 3714 | ||
| 3715 | /* If name is entirely invalid, or nearly so, use `emacs'. */ | 3715 | /* If name is entirely invalid, or nearly so, use `emacs'. */ |
| 3716 | if (good_count == 0 | 3716 | if (good_count < 2) |
| 3717 | || (good_count == 1 && bad_count > 0)) | ||
| 3718 | { | 3717 | { |
| 3719 | Vx_resource_name = build_string ("emacs"); | 3718 | Vx_resource_name = build_string ("emacs"); |
| 3720 | return; | 3719 | return; |
diff --git a/src/ftfont.c b/src/ftfont.c index db6b29421dc..ad01149106e 100644 --- a/src/ftfont.c +++ b/src/ftfont.c | |||
| @@ -168,11 +168,11 @@ get_adstyle_property (FcPattern *p) | |||
| 168 | for (end = str; *end && *end != ' '; end++); | 168 | for (end = str; *end && *end != ' '; end++); |
| 169 | if (*end) | 169 | if (*end) |
| 170 | { | 170 | { |
| 171 | char *p = alloca (end - str + 1); | 171 | char *newstr = alloca (end - str + 1); |
| 172 | memcpy (p, str, end - str); | 172 | memcpy (newstr, str, end - str); |
| 173 | p[end - str] = '\0'; | 173 | newstr[end - str] = '\0'; |
| 174 | end = p + (end - str); | 174 | end = newstr + (end - str); |
| 175 | str = p; | 175 | str = newstr; |
| 176 | } | 176 | } |
| 177 | if (xstrcasecmp (str, "Regular") == 0 | 177 | if (xstrcasecmp (str, "Regular") == 0 |
| 178 | || xstrcasecmp (str, "Bold") == 0 | 178 | || xstrcasecmp (str, "Bold") == 0 |
| @@ -190,18 +190,18 @@ ftfont_pattern_entity (FcPattern *p, Lisp_Object extra) | |||
| 190 | { | 190 | { |
| 191 | Lisp_Object key, cache, entity; | 191 | Lisp_Object key, cache, entity; |
| 192 | char *file, *str; | 192 | char *file, *str; |
| 193 | int index; | 193 | int idx; |
| 194 | int numeric; | 194 | int numeric; |
| 195 | double dbl; | 195 | double dbl; |
| 196 | FcBool b; | 196 | FcBool b; |
| 197 | 197 | ||
| 198 | if (FcPatternGetString (p, FC_FILE, 0, (FcChar8 **) &file) != FcResultMatch) | 198 | if (FcPatternGetString (p, FC_FILE, 0, (FcChar8 **) &file) != FcResultMatch) |
| 199 | return Qnil; | 199 | return Qnil; |
| 200 | if (FcPatternGetInteger (p, FC_INDEX, 0, &index) != FcResultMatch) | 200 | if (FcPatternGetInteger (p, FC_INDEX, 0, &idx) != FcResultMatch) |
| 201 | return Qnil; | 201 | return Qnil; |
| 202 | 202 | ||
| 203 | key = Fcons (make_unibyte_string ((char *) file, strlen ((char *) file)), | 203 | key = Fcons (make_unibyte_string ((char *) file, strlen ((char *) file)), |
| 204 | make_number (index)); | 204 | make_number (idx)); |
| 205 | cache = ftfont_lookup_cache (key, FTFONT_CACHE_FOR_ENTITY); | 205 | cache = ftfont_lookup_cache (key, FTFONT_CACHE_FOR_ENTITY); |
| 206 | entity = XCAR (cache); | 206 | entity = XCAR (cache); |
| 207 | if (! NILP (entity)) | 207 | if (! NILP (entity)) |
| @@ -265,7 +265,7 @@ ftfont_pattern_entity (FcPattern *p, Lisp_Object extra) | |||
| 265 | 265 | ||
| 266 | ASET (entity, FONT_ADSTYLE_INDEX, get_adstyle_property (p)); | 266 | ASET (entity, FONT_ADSTYLE_INDEX, get_adstyle_property (p)); |
| 267 | if ((ft_library || FT_Init_FreeType (&ft_library) == 0) | 267 | if ((ft_library || FT_Init_FreeType (&ft_library) == 0) |
| 268 | && FT_New_Face (ft_library, file, index, &ft_face) == 0) | 268 | && FT_New_Face (ft_library, file, idx, &ft_face) == 0) |
| 269 | { | 269 | { |
| 270 | BDF_PropertyRec rec; | 270 | BDF_PropertyRec rec; |
| 271 | 271 | ||
| @@ -311,8 +311,9 @@ ftfont_resolve_generic_family (Lisp_Object family, FcPattern *pattern) | |||
| 311 | if (FcPatternGetLangSet (pattern, FC_LANG, 0, &langset) != FcResultMatch) | 311 | if (FcPatternGetLangSet (pattern, FC_LANG, 0, &langset) != FcResultMatch) |
| 312 | { | 312 | { |
| 313 | /* This is to avoid the effect of locale. */ | 313 | /* This is to avoid the effect of locale. */ |
| 314 | static const FcChar8 lang[] = "en"; | ||
| 314 | langset = FcLangSetCreate (); | 315 | langset = FcLangSetCreate (); |
| 315 | FcLangSetAdd (langset, "en"); | 316 | FcLangSetAdd (langset, lang); |
| 316 | FcPatternAddLangSet (pattern, FC_LANG, langset); | 317 | FcPatternAddLangSet (pattern, FC_LANG, langset); |
| 317 | FcLangSetDestroy (langset); | 318 | FcLangSetDestroy (langset); |
| 318 | } | 319 | } |
| @@ -393,14 +394,14 @@ ftfont_lookup_cache (Lisp_Object key, enum ftfont_cache_for cache_for) | |||
| 393 | ? ! cache_data->ft_face : ! cache_data->fc_charset) | 394 | ? ! cache_data->ft_face : ! cache_data->fc_charset) |
| 394 | { | 395 | { |
| 395 | char *filename = SSDATA (XCAR (key)); | 396 | char *filename = SSDATA (XCAR (key)); |
| 396 | int index = XINT (XCDR (key)); | 397 | int idx = XINT (XCDR (key)); |
| 397 | 398 | ||
| 398 | if (cache_for == FTFONT_CACHE_FOR_FACE) | 399 | if (cache_for == FTFONT_CACHE_FOR_FACE) |
| 399 | { | 400 | { |
| 400 | if (! ft_library | 401 | if (! ft_library |
| 401 | && FT_Init_FreeType (&ft_library) != 0) | 402 | && FT_Init_FreeType (&ft_library) != 0) |
| 402 | return Qnil; | 403 | return Qnil; |
| 403 | if (FT_New_Face (ft_library, filename, index, &cache_data->ft_face) | 404 | if (FT_New_Face (ft_library, filename, idx, &cache_data->ft_face) |
| 404 | != 0) | 405 | != 0) |
| 405 | return Qnil; | 406 | return Qnil; |
| 406 | } | 407 | } |
| @@ -412,7 +413,7 @@ ftfont_lookup_cache (Lisp_Object key, enum ftfont_cache_for cache_for) | |||
| 412 | FcCharSet *charset = NULL; | 413 | FcCharSet *charset = NULL; |
| 413 | 414 | ||
| 414 | pat = FcPatternBuild (0, FC_FILE, FcTypeString, (FcChar8 *) filename, | 415 | pat = FcPatternBuild (0, FC_FILE, FcTypeString, (FcChar8 *) filename, |
| 415 | FC_INDEX, FcTypeInteger, index, NULL); | 416 | FC_INDEX, FcTypeInteger, idx, NULL); |
| 416 | if (! pat) | 417 | if (! pat) |
| 417 | goto finish; | 418 | goto finish; |
| 418 | objset = FcObjectSetBuild (FC_CHARSET, FC_STYLE, NULL); | 419 | objset = FcObjectSetBuild (FC_CHARSET, FC_STYLE, NULL); |
| @@ -490,8 +491,12 @@ static int ftfont_get_bitmap (struct font *, unsigned, | |||
| 490 | struct font_bitmap *, int); | 491 | struct font_bitmap *, int); |
| 491 | static int ftfont_anchor_point (struct font *, unsigned, int, | 492 | static int ftfont_anchor_point (struct font *, unsigned, int, |
| 492 | int *, int *); | 493 | int *, int *); |
| 494 | #ifdef HAVE_LIBOTF | ||
| 493 | static Lisp_Object ftfont_otf_capability (struct font *); | 495 | static Lisp_Object ftfont_otf_capability (struct font *); |
| 496 | # ifdef HAVE_M17N_FLT | ||
| 494 | static Lisp_Object ftfont_shape (Lisp_Object); | 497 | static Lisp_Object ftfont_shape (Lisp_Object); |
| 498 | # endif | ||
| 499 | #endif | ||
| 495 | 500 | ||
| 496 | #ifdef HAVE_OTF_GET_VARIATION_GLYPHS | 501 | #ifdef HAVE_OTF_GET_VARIATION_GLYPHS |
| 497 | static int ftfont_variation_glyphs (struct font *, int c, | 502 | static int ftfont_variation_glyphs (struct font *, int c, |
| @@ -618,6 +623,7 @@ struct OpenTypeSpec | |||
| 618 | (P)[4] = '\0'; \ | 623 | (P)[4] = '\0'; \ |
| 619 | } while (0) | 624 | } while (0) |
| 620 | 625 | ||
| 626 | #ifdef HAVE_LIBOTF | ||
| 621 | #define OTF_TAG_SYM(SYM, TAG) \ | 627 | #define OTF_TAG_SYM(SYM, TAG) \ |
| 622 | do { \ | 628 | do { \ |
| 623 | char str[5]; \ | 629 | char str[5]; \ |
| @@ -625,6 +631,7 @@ struct OpenTypeSpec | |||
| 625 | OTF_TAG_STR (TAG, str); \ | 631 | OTF_TAG_STR (TAG, str); \ |
| 626 | (SYM) = font_intern_prop (str, 4, 1); \ | 632 | (SYM) = font_intern_prop (str, 4, 1); \ |
| 627 | } while (0) | 633 | } while (0) |
| 634 | #endif | ||
| 628 | 635 | ||
| 629 | 636 | ||
| 630 | static struct OpenTypeSpec * | 637 | static struct OpenTypeSpec * |
| @@ -864,7 +871,6 @@ ftfont_list (Lisp_Object frame, Lisp_Object spec) | |||
| 864 | FcObjectSet *objset = NULL; | 871 | FcObjectSet *objset = NULL; |
| 865 | FcCharSet *charset; | 872 | FcCharSet *charset; |
| 866 | Lisp_Object chars = Qnil; | 873 | Lisp_Object chars = Qnil; |
| 867 | FcResult result; | ||
| 868 | char otlayout[15]; /* For "otlayout:XXXX" */ | 874 | char otlayout[15]; /* For "otlayout:XXXX" */ |
| 869 | struct OpenTypeSpec *otspec = NULL; | 875 | struct OpenTypeSpec *otspec = NULL; |
| 870 | int spacing = -1; | 876 | int spacing = -1; |
| @@ -1153,7 +1159,7 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 1153 | FT_Face ft_face; | 1159 | FT_Face ft_face; |
| 1154 | FT_Size ft_size; | 1160 | FT_Size ft_size; |
| 1155 | FT_UInt size; | 1161 | FT_UInt size; |
| 1156 | Lisp_Object val, filename, index, cache, font_object; | 1162 | Lisp_Object val, filename, idx, cache, font_object; |
| 1157 | int scalable; | 1163 | int scalable; |
| 1158 | int spacing; | 1164 | int spacing; |
| 1159 | char name[256]; | 1165 | char name[256]; |
| @@ -1168,7 +1174,7 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 1168 | if (NILP (cache)) | 1174 | if (NILP (cache)) |
| 1169 | return Qnil; | 1175 | return Qnil; |
| 1170 | filename = XCAR (val); | 1176 | filename = XCAR (val); |
| 1171 | index = XCDR (val); | 1177 | idx = XCDR (val); |
| 1172 | val = XCDR (cache); | 1178 | val = XCDR (cache); |
| 1173 | cache_data = XSAVE_VALUE (XCDR (cache))->pointer; | 1179 | cache_data = XSAVE_VALUE (XCDR (cache))->pointer; |
| 1174 | ft_face = cache_data->ft_face; | 1180 | ft_face = cache_data->ft_face; |
| @@ -1210,7 +1216,7 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 1210 | font = XFONT_OBJECT (font_object); | 1216 | font = XFONT_OBJECT (font_object); |
| 1211 | ftfont_info = (struct ftfont_info *) font; | 1217 | ftfont_info = (struct ftfont_info *) font; |
| 1212 | ftfont_info->ft_size = ft_face->size; | 1218 | ftfont_info->ft_size = ft_face->size; |
| 1213 | ftfont_info->index = XINT (index); | 1219 | ftfont_info->index = XINT (idx); |
| 1214 | #ifdef HAVE_LIBOTF | 1220 | #ifdef HAVE_LIBOTF |
| 1215 | ftfont_info->maybe_otf = ft_face->face_flags & FT_FACE_FLAG_SFNT; | 1221 | ftfont_info->maybe_otf = ft_face->face_flags & FT_FACE_FLAG_SFNT; |
| 1216 | ftfont_info->otf = NULL; | 1222 | ftfont_info->otf = NULL; |
| @@ -1455,7 +1461,8 @@ ftfont_get_bitmap (struct font *font, unsigned int code, struct font_bitmap *bit | |||
| 1455 | } | 1461 | } |
| 1456 | 1462 | ||
| 1457 | static int | 1463 | static int |
| 1458 | ftfont_anchor_point (struct font *font, unsigned int code, int index, int *x, int *y) | 1464 | ftfont_anchor_point (struct font *font, unsigned int code, int idx, |
| 1465 | int *x, int *y) | ||
| 1459 | { | 1466 | { |
| 1460 | struct ftfont_info *ftfont_info = (struct ftfont_info *) font; | 1467 | struct ftfont_info *ftfont_info = (struct ftfont_info *) font; |
| 1461 | FT_Face ft_face = ftfont_info->ft_size->face; | 1468 | FT_Face ft_face = ftfont_info->ft_size->face; |
| @@ -1466,10 +1473,10 @@ ftfont_anchor_point (struct font *font, unsigned int code, int index, int *x, in | |||
| 1466 | return -1; | 1473 | return -1; |
| 1467 | if (ft_face->glyph->format != FT_GLYPH_FORMAT_OUTLINE) | 1474 | if (ft_face->glyph->format != FT_GLYPH_FORMAT_OUTLINE) |
| 1468 | return -1; | 1475 | return -1; |
| 1469 | if (index >= ft_face->glyph->outline.n_points) | 1476 | if (idx >= ft_face->glyph->outline.n_points) |
| 1470 | return -1; | 1477 | return -1; |
| 1471 | *x = ft_face->glyph->outline.points[index].x; | 1478 | *x = ft_face->glyph->outline.points[idx].x; |
| 1472 | *y = ft_face->glyph->outline.points[index].y; | 1479 | *y = ft_face->glyph->outline.points[idx].y; |
| 1473 | return 0; | 1480 | return 0; |
| 1474 | } | 1481 | } |
| 1475 | 1482 | ||
diff --git a/src/intervals.c b/src/intervals.c index 12b2789cc77..351677ad27e 100644 --- a/src/intervals.c +++ b/src/intervals.c | |||
| @@ -586,7 +586,7 @@ split_interval_left (INTERVAL interval, EMACS_INT offset) | |||
| 586 | Don't use this function on an interval which is the child | 586 | Don't use this function on an interval which is the child |
| 587 | of another interval! */ | 587 | of another interval! */ |
| 588 | 588 | ||
| 589 | int | 589 | static int |
| 590 | interval_start_pos (INTERVAL source) | 590 | interval_start_pos (INTERVAL source) |
| 591 | { | 591 | { |
| 592 | Lisp_Object parent; | 592 | Lisp_Object parent; |
| @@ -2559,4 +2559,3 @@ set_intervals_multibyte (int multi_flag) | |||
| 2559 | set_intervals_multibyte_1 (BUF_INTERVALS (current_buffer), multi_flag, | 2559 | set_intervals_multibyte_1 (BUF_INTERVALS (current_buffer), multi_flag, |
| 2560 | BEG, BEG_BYTE, Z, Z_BYTE); | 2560 | BEG, BEG_BYTE, Z, Z_BYTE); |
| 2561 | } | 2561 | } |
| 2562 | |||
diff --git a/src/intervals.h b/src/intervals.h index f6c1c002ce0..d7c34012e1f 100644 --- a/src/intervals.h +++ b/src/intervals.h | |||
| @@ -161,8 +161,13 @@ struct interval | |||
| 161 | (INTERVAL_HAS_PARENT (i) ? INTERVAL_PARENT (i) : 0) | 161 | (INTERVAL_HAS_PARENT (i) ? INTERVAL_PARENT (i) : 0) |
| 162 | 162 | ||
| 163 | /* Abort if interval I's size is negative. */ | 163 | /* Abort if interval I's size is negative. */ |
| 164 | #define CHECK_TOTAL_LENGTH(i) \ | 164 | #define CHECK_TOTAL_LENGTH(i) \ |
| 165 | if ((int) (i)->total_length < 0) abort (); else | 165 | do \ |
| 166 | { \ | ||
| 167 | if ((int) (i)->total_length < 0) \ | ||
| 168 | abort (); \ | ||
| 169 | } \ | ||
| 170 | while (0) | ||
| 166 | 171 | ||
| 167 | /* Reset this interval to its vanilla, or no-property state. */ | 172 | /* Reset this interval to its vanilla, or no-property state. */ |
| 168 | #define RESET_INTERVAL(i) \ | 173 | #define RESET_INTERVAL(i) \ |
| @@ -339,4 +344,3 @@ extern Lisp_Object get_pos_property (Lisp_Object pos, Lisp_Object prop, | |||
| 339 | extern void syms_of_textprop (void); | 344 | extern void syms_of_textprop (void); |
| 340 | 345 | ||
| 341 | #include "composite.h" | 346 | #include "composite.h" |
| 342 | |||
diff --git a/src/lisp.h b/src/lisp.h index 283b0989c1d..e98172ec104 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -3233,7 +3233,11 @@ extern void syms_of_process (void); | |||
| 3233 | extern void setup_process_coding_systems (Lisp_Object); | 3233 | extern void setup_process_coding_systems (Lisp_Object); |
| 3234 | 3234 | ||
| 3235 | EXFUN (Fcall_process, MANY); | 3235 | EXFUN (Fcall_process, MANY); |
| 3236 | extern int child_setup (int, int, int, char **, int, Lisp_Object); | 3236 | extern int child_setup (int, int, int, char **, int, Lisp_Object) |
| 3237 | #ifndef DOS_NT | ||
| 3238 | NO_RETURN | ||
| 3239 | #endif | ||
| 3240 | ; | ||
| 3237 | extern void init_callproc_1 (void); | 3241 | extern void init_callproc_1 (void); |
| 3238 | extern void init_callproc (void); | 3242 | extern void init_callproc (void); |
| 3239 | extern void set_initial_environment (void); | 3243 | extern void set_initial_environment (void); |
| @@ -3598,7 +3602,7 @@ extern Lisp_Object safe_alloca_unwind (Lisp_Object); | |||
| 3598 | else \ | 3602 | else \ |
| 3599 | { \ | 3603 | { \ |
| 3600 | buf = (type) xmalloc (size); \ | 3604 | buf = (type) xmalloc (size); \ |
| 3601 | sa_must_free++; \ | 3605 | sa_must_free = 1; \ |
| 3602 | record_unwind_protect (safe_alloca_unwind, \ | 3606 | record_unwind_protect (safe_alloca_unwind, \ |
| 3603 | make_save_value (buf, 0)); \ | 3607 | make_save_value (buf, 0)); \ |
| 3604 | } \ | 3608 | } \ |
| @@ -3628,7 +3632,7 @@ extern Lisp_Object safe_alloca_unwind (Lisp_Object); | |||
| 3628 | buf = (Lisp_Object *) xmalloc (size_); \ | 3632 | buf = (Lisp_Object *) xmalloc (size_); \ |
| 3629 | arg_ = make_save_value (buf, nelt); \ | 3633 | arg_ = make_save_value (buf, nelt); \ |
| 3630 | XSAVE_VALUE (arg_)->dogc = 1; \ | 3634 | XSAVE_VALUE (arg_)->dogc = 1; \ |
| 3631 | sa_must_free++; \ | 3635 | sa_must_free = 1; \ |
| 3632 | record_unwind_protect (safe_alloca_unwind, arg_); \ | 3636 | record_unwind_protect (safe_alloca_unwind, arg_); \ |
| 3633 | } \ | 3637 | } \ |
| 3634 | } while (0) | 3638 | } while (0) |
diff --git a/src/process.c b/src/process.c index c9b420ab2ae..4a7202388bf 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -159,9 +159,6 @@ extern Lisp_Object QCfilter; | |||
| 159 | #define SERIALCONN_P(p) (EQ (XPROCESS (p)->type, Qserial)) | 159 | #define SERIALCONN_P(p) (EQ (XPROCESS (p)->type, Qserial)) |
| 160 | #define SERIALCONN1_P(p) (EQ ((p)->type, Qserial)) | 160 | #define SERIALCONN1_P(p) (EQ ((p)->type, Qserial)) |
| 161 | 161 | ||
| 162 | /* Define first descriptor number available for subprocesses. */ | ||
| 163 | #define FIRST_PROC_DESC 3 | ||
| 164 | |||
| 165 | #ifndef HAVE_H_ERRNO | 162 | #ifndef HAVE_H_ERRNO |
| 166 | extern int h_errno; | 163 | extern int h_errno; |
| 167 | #endif | 164 | #endif |
| @@ -278,10 +275,6 @@ static SELECT_TYPE connect_wait_mask; | |||
| 278 | 275 | ||
| 279 | /* Number of bits set in connect_wait_mask. */ | 276 | /* Number of bits set in connect_wait_mask. */ |
| 280 | static int num_pending_connects; | 277 | static int num_pending_connects; |
| 281 | |||
| 282 | #define IF_NON_BLOCKING_CONNECT(s) s | ||
| 283 | #else /* NON_BLOCKING_CONNECT */ | ||
| 284 | #define IF_NON_BLOCKING_CONNECT(s) | ||
| 285 | #endif /* NON_BLOCKING_CONNECT */ | 278 | #endif /* NON_BLOCKING_CONNECT */ |
| 286 | 279 | ||
| 287 | /* The largest descriptor currently in use for a process object. */ | 280 | /* The largest descriptor currently in use for a process object. */ |
| @@ -1250,8 +1243,8 @@ Returns nil if format of ADDRESS is invalid. */) | |||
| 1250 | static Lisp_Object | 1243 | static Lisp_Object |
| 1251 | list_processes_1 (Lisp_Object query_only) | 1244 | list_processes_1 (Lisp_Object query_only) |
| 1252 | { | 1245 | { |
| 1253 | register Lisp_Object tail, tem; | 1246 | register Lisp_Object tail; |
| 1254 | Lisp_Object proc, minspace, tem1; | 1247 | Lisp_Object proc, minspace; |
| 1255 | register struct Lisp_Process *p; | 1248 | register struct Lisp_Process *p; |
| 1256 | char tembuf[300]; | 1249 | char tembuf[300]; |
| 1257 | int w_proc, w_buffer, w_tty; | 1250 | int w_proc, w_buffer, w_tty; |
| @@ -1453,10 +1446,10 @@ list_processes_1 (Lisp_Object query_only) | |||
| 1453 | } | 1446 | } |
| 1454 | else | 1447 | else |
| 1455 | { | 1448 | { |
| 1456 | tem = p->command; | 1449 | Lisp_Object tem = p->command; |
| 1457 | while (1) | 1450 | while (1) |
| 1458 | { | 1451 | { |
| 1459 | tem1 = Fcar (tem); | 1452 | Lisp_Object tem1 = Fcar (tem); |
| 1460 | if (NILP (tem1)) | 1453 | if (NILP (tem1)) |
| 1461 | break; | 1454 | break; |
| 1462 | Finsert (1, &tem1); | 1455 | Finsert (1, &tem1); |
| @@ -1919,8 +1912,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1919 | /* child_setup must clobber environ on systems with true vfork. | 1912 | /* child_setup must clobber environ on systems with true vfork. |
| 1920 | Protect it from permanent change. */ | 1913 | Protect it from permanent change. */ |
| 1921 | char **save_environ = environ; | 1914 | char **save_environ = environ; |
| 1922 | 1915 | volatile Lisp_Object encoded_current_dir = ENCODE_FILE (current_dir); | |
| 1923 | current_dir = ENCODE_FILE (current_dir); | ||
| 1924 | 1916 | ||
| 1925 | #ifndef WINDOWSNT | 1917 | #ifndef WINDOWSNT |
| 1926 | pid = vfork (); | 1918 | pid = vfork (); |
| @@ -2061,13 +2053,13 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 2061 | child_setup_tty (xforkout); | 2053 | child_setup_tty (xforkout); |
| 2062 | #ifdef WINDOWSNT | 2054 | #ifdef WINDOWSNT |
| 2063 | pid = child_setup (xforkin, xforkout, xforkout, | 2055 | pid = child_setup (xforkin, xforkout, xforkout, |
| 2064 | new_argv, 1, current_dir); | 2056 | new_argv, 1, encoded_current_dir); |
| 2065 | #else /* not WINDOWSNT */ | 2057 | #else /* not WINDOWSNT */ |
| 2066 | #ifdef FD_CLOEXEC | 2058 | #ifdef FD_CLOEXEC |
| 2067 | emacs_close (wait_child_setup[0]); | 2059 | emacs_close (wait_child_setup[0]); |
| 2068 | #endif | 2060 | #endif |
| 2069 | child_setup (xforkin, xforkout, xforkout, | 2061 | child_setup (xforkin, xforkout, xforkout, |
| 2070 | new_argv, 1, current_dir); | 2062 | new_argv, 1, encoded_current_dir); |
| 2071 | #endif /* not WINDOWSNT */ | 2063 | #endif /* not WINDOWSNT */ |
| 2072 | } | 2064 | } |
| 2073 | environ = save_environ; | 2065 | environ = save_environ; |
| @@ -3403,7 +3395,9 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3403 | { | 3395 | { |
| 3404 | int optn, optbits; | 3396 | int optn, optbits; |
| 3405 | 3397 | ||
| 3398 | #ifdef WINDOWSNT | ||
| 3406 | retry_connect: | 3399 | retry_connect: |
| 3400 | #endif | ||
| 3407 | 3401 | ||
| 3408 | s = socket (lres->ai_family, lres->ai_socktype, lres->ai_protocol); | 3402 | s = socket (lres->ai_family, lres->ai_socktype, lres->ai_protocol); |
| 3409 | if (s < 0) | 3403 | if (s < 0) |
| @@ -3467,7 +3461,7 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3467 | if (EQ (service, Qt)) | 3461 | if (EQ (service, Qt)) |
| 3468 | { | 3462 | { |
| 3469 | struct sockaddr_in sa1; | 3463 | struct sockaddr_in sa1; |
| 3470 | int len1 = sizeof (sa1); | 3464 | socklen_t len1 = sizeof (sa1); |
| 3471 | if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0) | 3465 | if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0) |
| 3472 | { | 3466 | { |
| 3473 | ((struct sockaddr_in *)(lres->ai_addr))->sin_port = sa1.sin_port; | 3467 | ((struct sockaddr_in *)(lres->ai_addr))->sin_port = sa1.sin_port; |
| @@ -3514,7 +3508,8 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3514 | /* Unlike most other syscalls connect() cannot be called | 3508 | /* Unlike most other syscalls connect() cannot be called |
| 3515 | again. (That would return EALREADY.) The proper way to | 3509 | again. (That would return EALREADY.) The proper way to |
| 3516 | wait for completion is select(). */ | 3510 | wait for completion is select(). */ |
| 3517 | int sc, len; | 3511 | int sc; |
| 3512 | socklen_t len; | ||
| 3518 | SELECT_TYPE fdset; | 3513 | SELECT_TYPE fdset; |
| 3519 | retry_select: | 3514 | retry_select: |
| 3520 | FD_ZERO (&fdset); | 3515 | FD_ZERO (&fdset); |
| @@ -3587,7 +3582,7 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3587 | if (!is_server) | 3582 | if (!is_server) |
| 3588 | { | 3583 | { |
| 3589 | struct sockaddr_in sa1; | 3584 | struct sockaddr_in sa1; |
| 3590 | int len1 = sizeof (sa1); | 3585 | socklen_t len1 = sizeof (sa1); |
| 3591 | if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0) | 3586 | if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0) |
| 3592 | contact = Fplist_put (contact, QClocal, | 3587 | contact = Fplist_put (contact, QClocal, |
| 3593 | conv_sockaddr_to_lisp ((struct sockaddr *)&sa1, len1)); | 3588 | conv_sockaddr_to_lisp ((struct sockaddr *)&sa1, len1)); |
| @@ -3705,10 +3700,10 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3705 | 3700 | ||
| 3706 | { | 3701 | { |
| 3707 | /* Setup coding systems for communicating with the network stream. */ | 3702 | /* Setup coding systems for communicating with the network stream. */ |
| 3708 | struct gcpro gcpro1; | 3703 | struct gcpro inner_gcpro1; |
| 3709 | /* Qt denotes we have not yet called Ffind_operation_coding_system. */ | 3704 | /* Qt denotes we have not yet called Ffind_operation_coding_system. */ |
| 3710 | Lisp_Object coding_systems = Qt; | 3705 | Lisp_Object coding_systems = Qt; |
| 3711 | Lisp_Object args[5], val; | 3706 | Lisp_Object fargs[5], val; |
| 3712 | 3707 | ||
| 3713 | if (!NILP (tem)) | 3708 | if (!NILP (tem)) |
| 3714 | { | 3709 | { |
| @@ -3731,11 +3726,11 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3731 | coding_systems = Qnil; | 3726 | coding_systems = Qnil; |
| 3732 | else | 3727 | else |
| 3733 | { | 3728 | { |
| 3734 | args[0] = Qopen_network_stream, args[1] = name, | 3729 | fargs[0] = Qopen_network_stream, fargs[1] = name, |
| 3735 | args[2] = buffer, args[3] = host, args[4] = service; | 3730 | fargs[2] = buffer, fargs[3] = host, fargs[4] = service; |
| 3736 | GCPRO1 (proc); | 3731 | GCPRO1_VAR (proc, inner_gcpro); |
| 3737 | coding_systems = Ffind_operation_coding_system (5, args); | 3732 | coding_systems = Ffind_operation_coding_system (5, fargs); |
| 3738 | UNGCPRO; | 3733 | UNGCPRO_VAR (inner_gcpro); |
| 3739 | } | 3734 | } |
| 3740 | if (CONSP (coding_systems)) | 3735 | if (CONSP (coding_systems)) |
| 3741 | val = XCAR (coding_systems); | 3736 | val = XCAR (coding_systems); |
| @@ -3764,11 +3759,11 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3764 | coding_systems = Qnil; | 3759 | coding_systems = Qnil; |
| 3765 | else | 3760 | else |
| 3766 | { | 3761 | { |
| 3767 | args[0] = Qopen_network_stream, args[1] = name, | 3762 | fargs[0] = Qopen_network_stream, fargs[1] = name, |
| 3768 | args[2] = buffer, args[3] = host, args[4] = service; | 3763 | fargs[2] = buffer, fargs[3] = host, fargs[4] = service; |
| 3769 | GCPRO1 (proc); | 3764 | GCPRO1_VAR (proc, inner_gcpro); |
| 3770 | coding_systems = Ffind_operation_coding_system (5, args); | 3765 | coding_systems = Ffind_operation_coding_system (5, fargs); |
| 3771 | UNGCPRO; | 3766 | UNGCPRO_VAR (inner_gcpro); |
| 3772 | } | 3767 | } |
| 3773 | } | 3768 | } |
| 3774 | if (CONSP (coding_systems)) | 3769 | if (CONSP (coding_systems)) |
| @@ -3948,7 +3943,7 @@ FLAGS is the current flags of the interface. */) | |||
| 3948 | CHECK_STRING (ifname); | 3943 | CHECK_STRING (ifname); |
| 3949 | 3944 | ||
| 3950 | memset (rq.ifr_name, 0, sizeof rq.ifr_name); | 3945 | memset (rq.ifr_name, 0, sizeof rq.ifr_name); |
| 3951 | strncpy (rq.ifr_name, SDATA (ifname), sizeof (rq.ifr_name)); | 3946 | strncpy (rq.ifr_name, SSDATA (ifname), sizeof (rq.ifr_name)); |
| 3952 | 3947 | ||
| 3953 | s = socket (AF_INET, SOCK_STREAM, 0); | 3948 | s = socket (AF_INET, SOCK_STREAM, 0); |
| 3954 | if (s < 0) | 3949 | if (s < 0) |
| @@ -4192,7 +4187,7 @@ server_accept_connection (Lisp_Object server, int channel) | |||
| 4192 | struct sockaddr_un un; | 4187 | struct sockaddr_un un; |
| 4193 | #endif | 4188 | #endif |
| 4194 | } saddr; | 4189 | } saddr; |
| 4195 | int len = sizeof saddr; | 4190 | socklen_t len = sizeof saddr; |
| 4196 | 4191 | ||
| 4197 | s = accept (channel, &saddr.sa, &len); | 4192 | s = accept (channel, &saddr.sa, &len); |
| 4198 | 4193 | ||
| @@ -4928,8 +4923,6 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd, | |||
| 4928 | d->func (channel, d->data, 0); | 4923 | d->func (channel, d->data, 0); |
| 4929 | } | 4924 | } |
| 4930 | 4925 | ||
| 4931 | /* Really FIRST_PROC_DESC should be 0 on Unix, | ||
| 4932 | but this is safer in the short run. */ | ||
| 4933 | for (channel = 0; channel <= max_process_desc; channel++) | 4926 | for (channel = 0; channel <= max_process_desc; channel++) |
| 4934 | { | 4927 | { |
| 4935 | if (FD_ISSET (channel, &Available) | 4928 | if (FD_ISSET (channel, &Available) |
| @@ -5059,7 +5052,7 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd, | |||
| 5059 | /* getsockopt(,,SO_ERROR,,) is said to hang on some systems. | 5052 | /* getsockopt(,,SO_ERROR,,) is said to hang on some systems. |
| 5060 | So only use it on systems where it is known to work. */ | 5053 | So only use it on systems where it is known to work. */ |
| 5061 | { | 5054 | { |
| 5062 | int xlen = sizeof (xerrno); | 5055 | socklen_t xlen = sizeof (xerrno); |
| 5063 | if (getsockopt (channel, SOL_SOCKET, SO_ERROR, &xerrno, &xlen)) | 5056 | if (getsockopt (channel, SOL_SOCKET, SO_ERROR, &xerrno, &xlen)) |
| 5064 | xerrno = errno; | 5057 | xerrno = errno; |
| 5065 | } | 5058 | } |
| @@ -5128,9 +5121,9 @@ read_process_output_call (Lisp_Object fun_and_args) | |||
| 5128 | } | 5121 | } |
| 5129 | 5122 | ||
| 5130 | static Lisp_Object | 5123 | static Lisp_Object |
| 5131 | read_process_output_error_handler (Lisp_Object error) | 5124 | read_process_output_error_handler (Lisp_Object error_val) |
| 5132 | { | 5125 | { |
| 5133 | cmd_error_internal (error, "error in process filter: "); | 5126 | cmd_error_internal (error_val, "error in process filter: "); |
| 5134 | Vinhibit_quit = Qt; | 5127 | Vinhibit_quit = Qt; |
| 5135 | update_echo_area (); | 5128 | update_echo_area (); |
| 5136 | Fsleep_for (make_number (2), Qnil); | 5129 | Fsleep_for (make_number (2), Qnil); |
| @@ -5171,7 +5164,7 @@ read_process_output (Lisp_Object proc, register int channel) | |||
| 5171 | /* We have a working select, so proc_buffered_char is always -1. */ | 5164 | /* We have a working select, so proc_buffered_char is always -1. */ |
| 5172 | if (DATAGRAM_CHAN_P (channel)) | 5165 | if (DATAGRAM_CHAN_P (channel)) |
| 5173 | { | 5166 | { |
| 5174 | int len = datagram_address[channel].len; | 5167 | socklen_t len = datagram_address[channel].len; |
| 5175 | nbytes = recvfrom (channel, chars + carryover, readmax, | 5168 | nbytes = recvfrom (channel, chars + carryover, readmax, |
| 5176 | 0, datagram_address[channel].sa, &len); | 5169 | 0, datagram_address[channel].sa, &len); |
| 5177 | } | 5170 | } |
| @@ -5925,7 +5918,7 @@ process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group, | |||
| 5925 | 5918 | ||
| 5926 | if (sig_char && *sig_char != CDISABLE) | 5919 | if (sig_char && *sig_char != CDISABLE) |
| 5927 | { | 5920 | { |
| 5928 | send_process (proc, sig_char, 1, Qnil); | 5921 | send_process (proc, (char *) sig_char, 1, Qnil); |
| 5929 | return; | 5922 | return; |
| 5930 | } | 5923 | } |
| 5931 | /* If we can't send the signal with a character, | 5924 | /* If we can't send the signal with a character, |
| @@ -6534,9 +6527,9 @@ exec_sentinel_unwind (Lisp_Object data) | |||
| 6534 | } | 6527 | } |
| 6535 | 6528 | ||
| 6536 | static Lisp_Object | 6529 | static Lisp_Object |
| 6537 | exec_sentinel_error_handler (Lisp_Object error) | 6530 | exec_sentinel_error_handler (Lisp_Object error_val) |
| 6538 | { | 6531 | { |
| 6539 | cmd_error_internal (error, "error in process sentinel: "); | 6532 | cmd_error_internal (error_val, "error in process sentinel: "); |
| 6540 | Vinhibit_quit = Qt; | 6533 | Vinhibit_quit = Qt; |
| 6541 | update_echo_area (); | 6534 | update_echo_area (); |
| 6542 | Fsleep_for (make_number (2), Qnil); | 6535 | Fsleep_for (make_number (2), Qnil); |
diff --git a/src/region-cache.c b/src/region-cache.c index 1f9b62da9fa..53ce0e9d802 100644 --- a/src/region-cache.c +++ b/src/region-cache.c | |||
| @@ -290,37 +290,37 @@ move_cache_gap (struct region_cache *c, EMACS_INT pos, EMACS_INT min_size) | |||
| 290 | } | 290 | } |
| 291 | 291 | ||
| 292 | 292 | ||
| 293 | /* Insert a new boundary in cache C; it will have cache index INDEX, | 293 | /* Insert a new boundary in cache C; it will have cache index I, |
| 294 | and have the specified POS and VALUE. */ | 294 | and have the specified POS and VALUE. */ |
| 295 | static void | 295 | static void |
| 296 | insert_cache_boundary (struct region_cache *c, EMACS_INT index, EMACS_INT pos, | 296 | insert_cache_boundary (struct region_cache *c, EMACS_INT i, EMACS_INT pos, |
| 297 | int value) | 297 | int value) |
| 298 | { | 298 | { |
| 299 | /* index must be a valid cache index. */ | 299 | /* i must be a valid cache index. */ |
| 300 | if (index < 0 || index > c->cache_len) | 300 | if (i < 0 || i > c->cache_len) |
| 301 | abort (); | 301 | abort (); |
| 302 | 302 | ||
| 303 | /* We must never want to insert something before the dummy first | 303 | /* We must never want to insert something before the dummy first |
| 304 | boundary. */ | 304 | boundary. */ |
| 305 | if (index == 0) | 305 | if (i == 0) |
| 306 | abort (); | 306 | abort (); |
| 307 | 307 | ||
| 308 | /* We must only be inserting things in order. */ | 308 | /* We must only be inserting things in order. */ |
| 309 | if (! (BOUNDARY_POS (c, index-1) < pos | 309 | if (! (BOUNDARY_POS (c, i - 1) < pos |
| 310 | && (index == c->cache_len | 310 | && (i == c->cache_len |
| 311 | || pos < BOUNDARY_POS (c, index)))) | 311 | || pos < BOUNDARY_POS (c, i)))) |
| 312 | abort (); | 312 | abort (); |
| 313 | 313 | ||
| 314 | /* The value must be different from the ones around it. However, we | 314 | /* The value must be different from the ones around it. However, we |
| 315 | temporarily create boundaries that establish the same value as | 315 | temporarily create boundaries that establish the same value as |
| 316 | the subsequent boundary, so we're not going to flag that case. */ | 316 | the subsequent boundary, so we're not going to flag that case. */ |
| 317 | if (BOUNDARY_VALUE (c, index-1) == value) | 317 | if (BOUNDARY_VALUE (c, i - 1) == value) |
| 318 | abort (); | 318 | abort (); |
| 319 | 319 | ||
| 320 | move_cache_gap (c, index, 1); | 320 | move_cache_gap (c, i, 1); |
| 321 | 321 | ||
| 322 | c->boundaries[index].pos = pos - c->buffer_beg; | 322 | c->boundaries[i].pos = pos - c->buffer_beg; |
| 323 | c->boundaries[index].value = value; | 323 | c->boundaries[i].value = value; |
| 324 | c->gap_start++; | 324 | c->gap_start++; |
| 325 | c->gap_len--; | 325 | c->gap_len--; |
| 326 | c->cache_len++; | 326 | c->cache_len++; |
| @@ -808,4 +808,3 @@ pp_cache (struct region_cache *c) | |||
| 808 | fprintf (stderr, "%ld : %d\n", (long)pos, BOUNDARY_VALUE (c, i)); | 808 | fprintf (stderr, "%ld : %d\n", (long)pos, BOUNDARY_VALUE (c, i)); |
| 809 | } | 809 | } |
| 810 | } | 810 | } |
| 811 | |||
diff --git a/src/region-cache.h b/src/region-cache.h index 0da159285e4..8e4336c2885 100644 --- a/src/region-cache.h +++ b/src/region-cache.h | |||
| @@ -111,3 +111,5 @@ extern int region_cache_backward (struct buffer *BUF, | |||
| 111 | EMACS_INT POS, | 111 | EMACS_INT POS, |
| 112 | EMACS_INT *NEXT); | 112 | EMACS_INT *NEXT); |
| 113 | 113 | ||
| 114 | /* For debugging. */ | ||
| 115 | void pp_cache (struct region_cache *); | ||
diff --git a/src/scroll.c b/src/scroll.c index 33af18d2090..f013ebbee0e 100644 --- a/src/scroll.c +++ b/src/scroll.c | |||
| @@ -245,8 +245,8 @@ do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix, struct m | |||
| 245 | int i, j, k; | 245 | int i, j, k; |
| 246 | 246 | ||
| 247 | /* Set to 1 if we have set a terminal window with | 247 | /* Set to 1 if we have set a terminal window with |
| 248 | set_terminal_window. */ | 248 | set_terminal_window. It's unsigned to work around GCC bug 48228. */ |
| 249 | int terminal_window_p = 0; | 249 | unsigned int terminal_window_p = 0; |
| 250 | 250 | ||
| 251 | /* A queue for line insertions to be done. */ | 251 | /* A queue for line insertions to be done. */ |
| 252 | struct queue { int count, pos; }; | 252 | struct queue { int count, pos; }; |
diff --git a/src/sound.c b/src/sound.c index 3a1668e4903..a2fe7ccc8ce 100644 --- a/src/sound.c +++ b/src/sound.c | |||
| @@ -595,12 +595,12 @@ wav_play (struct sound *s, struct sound_device *sd) | |||
| 595 | files I found so far. If someone feels inclined to implement the | 595 | files I found so far. If someone feels inclined to implement the |
| 596 | whole RIFF-WAVE spec, please do. */ | 596 | whole RIFF-WAVE spec, please do. */ |
| 597 | if (STRINGP (s->data)) | 597 | if (STRINGP (s->data)) |
| 598 | sd->write (sd, SDATA (s->data) + sizeof *header, | 598 | sd->write (sd, SSDATA (s->data) + sizeof *header, |
| 599 | SBYTES (s->data) - sizeof *header); | 599 | SBYTES (s->data) - sizeof *header); |
| 600 | else | 600 | else |
| 601 | { | 601 | { |
| 602 | char *buffer; | 602 | char *buffer; |
| 603 | int nbytes; | 603 | int nbytes = 0; |
| 604 | int blksize = sd->period_size ? sd->period_size (sd) : 2048; | 604 | int blksize = sd->period_size ? sd->period_size (sd) : 2048; |
| 605 | int data_left = header->data_length; | 605 | int data_left = header->data_length; |
| 606 | 606 | ||
| @@ -686,7 +686,7 @@ au_play (struct sound *s, struct sound_device *sd) | |||
| 686 | sd->configure (sd); | 686 | sd->configure (sd); |
| 687 | 687 | ||
| 688 | if (STRINGP (s->data)) | 688 | if (STRINGP (s->data)) |
| 689 | sd->write (sd, SDATA (s->data) + header->data_offset, | 689 | sd->write (sd, SSDATA (s->data) + header->data_offset, |
| 690 | SBYTES (s->data) - header->data_offset); | 690 | SBYTES (s->data) - header->data_offset); |
| 691 | else | 691 | else |
| 692 | { | 692 | { |
| @@ -1104,7 +1104,6 @@ alsa_close (struct sound_device *sd) | |||
| 1104 | static void | 1104 | static void |
| 1105 | alsa_choose_format (struct sound_device *sd, struct sound *s) | 1105 | alsa_choose_format (struct sound_device *sd, struct sound *s) |
| 1106 | { | 1106 | { |
| 1107 | struct alsa_params *p = (struct alsa_params *) sd->data; | ||
| 1108 | if (s->type == RIFF) | 1107 | if (s->type == RIFF) |
| 1109 | { | 1108 | { |
| 1110 | struct wav_header *h = (struct wav_header *) s->header; | 1109 | struct wav_header *h = (struct wav_header *) s->header; |
| @@ -1410,7 +1409,7 @@ Internal use only, use `play-sound' instead. */) | |||
| 1410 | { | 1409 | { |
| 1411 | int len = SCHARS (attrs[SOUND_DEVICE]); | 1410 | int len = SCHARS (attrs[SOUND_DEVICE]); |
| 1412 | current_sound_device->file = (char *) alloca (len + 1); | 1411 | current_sound_device->file = (char *) alloca (len + 1); |
| 1413 | strcpy (current_sound_device->file, SDATA (attrs[SOUND_DEVICE])); | 1412 | strcpy (current_sound_device->file, SSDATA (attrs[SOUND_DEVICE])); |
| 1414 | } | 1413 | } |
| 1415 | 1414 | ||
| 1416 | if (INTEGERP (attrs[SOUND_VOLUME])) | 1415 | if (INTEGERP (attrs[SOUND_VOLUME])) |
| @@ -1498,4 +1497,3 @@ init_sound (void) | |||
| 1498 | } | 1497 | } |
| 1499 | 1498 | ||
| 1500 | #endif /* HAVE_SOUND */ | 1499 | #endif /* HAVE_SOUND */ |
| 1501 | |||
diff --git a/src/sysdep.c b/src/sysdep.c index 6ef3d88c5c8..14db0fd26d0 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -488,7 +488,8 @@ sys_subshell (void) | |||
| 488 | int pid; | 488 | int pid; |
| 489 | struct save_signal saved_handlers[5]; | 489 | struct save_signal saved_handlers[5]; |
| 490 | Lisp_Object dir; | 490 | Lisp_Object dir; |
| 491 | unsigned char * IF_LINT (volatile) str = 0; | 491 | unsigned char *volatile str_volatile = 0; |
| 492 | unsigned char *str; | ||
| 492 | int len; | 493 | int len; |
| 493 | 494 | ||
| 494 | saved_handlers[0].code = SIGINT; | 495 | saved_handlers[0].code = SIGINT; |
| @@ -512,7 +513,7 @@ sys_subshell (void) | |||
| 512 | goto xyzzy; | 513 | goto xyzzy; |
| 513 | 514 | ||
| 514 | dir = expand_and_dir_to_file (Funhandled_file_name_directory (dir), Qnil); | 515 | dir = expand_and_dir_to_file (Funhandled_file_name_directory (dir), Qnil); |
| 515 | str = (unsigned char *) alloca (SCHARS (dir) + 2); | 516 | str_volatile = str = (unsigned char *) alloca (SCHARS (dir) + 2); |
| 516 | len = SCHARS (dir); | 517 | len = SCHARS (dir); |
| 517 | memcpy (str, SDATA (dir), len); | 518 | memcpy (str, SDATA (dir), len); |
| 518 | if (str[len - 1] != '/') str[len++] = '/'; | 519 | if (str[len - 1] != '/') str[len++] = '/'; |
| @@ -544,6 +545,7 @@ sys_subshell (void) | |||
| 544 | sh = "sh"; | 545 | sh = "sh"; |
| 545 | 546 | ||
| 546 | /* Use our buffer's default directory for the subshell. */ | 547 | /* Use our buffer's default directory for the subshell. */ |
| 548 | str = str_volatile; | ||
| 547 | if (str && chdir ((char *) str) != 0) | 549 | if (str && chdir ((char *) str) != 0) |
| 548 | { | 550 | { |
| 549 | #ifndef DOS_NT | 551 | #ifndef DOS_NT |
diff --git a/src/terminfo.c b/src/terminfo.c index 905a8edacc7..c0418984efa 100644 --- a/src/terminfo.c +++ b/src/terminfo.c | |||
| @@ -17,6 +17,8 @@ You should have received a copy of the GNU General Public License | |||
| 17 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | 17 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 18 | 18 | ||
| 19 | #include <config.h> | 19 | #include <config.h> |
| 20 | #include "tparam.h" | ||
| 21 | |||
| 20 | #include <setjmp.h> | 22 | #include <setjmp.h> |
| 21 | #include "lisp.h" | 23 | #include "lisp.h" |
| 22 | 24 | ||
| @@ -33,18 +35,19 @@ char *UP, *BC, PC; | |||
| 33 | format is different too. | 35 | format is different too. |
| 34 | */ | 36 | */ |
| 35 | 37 | ||
| 38 | extern char *tparm (const char *str, ...); | ||
| 39 | |||
| 40 | |||
| 36 | char * | 41 | char * |
| 37 | tparam (char *string, char *outstring, | 42 | tparam (const char *string, char *outstring, int len, |
| 38 | int len, int arg1, int arg2, int arg3, int arg4, | 43 | int arg1, int arg2, int arg3, int arg4) |
| 39 | int arg5, int arg6, int arg7, int arg8, int arg9) | ||
| 40 | { | 44 | { |
| 41 | char *temp; | 45 | char *temp; |
| 42 | extern char *tparm (char *str, ...); | ||
| 43 | 46 | ||
| 44 | temp = tparm (string, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); | 47 | /* Emacs always should pass a null OUTSTRING and zero LEN. */ |
| 45 | if (outstring == 0) | 48 | if (outstring || len) |
| 46 | outstring = ((char *) (xmalloc ((strlen (temp)) + 1))); | 49 | abort (); |
| 47 | strcpy (outstring, temp); | ||
| 48 | return outstring; | ||
| 49 | } | ||
| 50 | 50 | ||
| 51 | temp = tparm (string, arg1, arg2, arg3, arg4); | ||
| 52 | return xstrdup (temp); | ||
| 53 | } | ||
diff --git a/src/textprop.c b/src/textprop.c index 5db6033670b..cd89efeb38d 100644 --- a/src/textprop.c +++ b/src/textprop.c | |||
| @@ -974,37 +974,6 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */) | |||
| 974 | return make_number (next->position); | 974 | return make_number (next->position); |
| 975 | } | 975 | } |
| 976 | 976 | ||
| 977 | /* Return 1 if there's a change in some property between BEG and END. */ | ||
| 978 | |||
| 979 | int | ||
| 980 | property_change_between_p (EMACS_INT beg, EMACS_INT end) | ||
| 981 | { | ||
| 982 | register INTERVAL i, next; | ||
| 983 | Lisp_Object object, pos; | ||
| 984 | |||
| 985 | XSETBUFFER (object, current_buffer); | ||
| 986 | XSETFASTINT (pos, beg); | ||
| 987 | |||
| 988 | i = validate_interval_range (object, &pos, &pos, soft); | ||
| 989 | if (NULL_INTERVAL_P (i)) | ||
| 990 | return 0; | ||
| 991 | |||
| 992 | next = next_interval (i); | ||
| 993 | while (! NULL_INTERVAL_P (next) && intervals_equal (i, next)) | ||
| 994 | { | ||
| 995 | next = next_interval (next); | ||
| 996 | if (NULL_INTERVAL_P (next)) | ||
| 997 | return 0; | ||
| 998 | if (next->position >= end) | ||
| 999 | return 0; | ||
| 1000 | } | ||
| 1001 | |||
| 1002 | if (NULL_INTERVAL_P (next)) | ||
| 1003 | return 0; | ||
| 1004 | |||
| 1005 | return 1; | ||
| 1006 | } | ||
| 1007 | |||
| 1008 | DEFUN ("next-single-property-change", Fnext_single_property_change, | 977 | DEFUN ("next-single-property-change", Fnext_single_property_change, |
| 1009 | Snext_single_property_change, 2, 4, 0, | 978 | Snext_single_property_change, 2, 4, 0, |
| 1010 | doc: /* Return the position of next property change for a specific property. | 979 | doc: /* Return the position of next property change for a specific property. |
| @@ -2331,4 +2300,3 @@ inherits it if NONSTICKINESS is nil. The `front-sticky' and | |||
| 2331 | /* defsubr (&Serase_text_properties); */ | 2300 | /* defsubr (&Serase_text_properties); */ |
| 2332 | /* defsubr (&Scopy_text_properties); */ | 2301 | /* defsubr (&Scopy_text_properties); */ |
| 2333 | } | 2302 | } |
| 2334 | |||
diff --git a/src/tparam.h b/src/tparam.h index 3cd3e6053cc..dc4cdfaa28c 100644 --- a/src/tparam.h +++ b/src/tparam.h | |||
| @@ -29,3 +29,7 @@ char *tgetstr (const char *, char **); | |||
| 29 | char *tgoto (const char *, int, int); | 29 | char *tgoto (const char *, int, int); |
| 30 | 30 | ||
| 31 | char *tparam (const char *, char *, int, int, int, int, int); | 31 | char *tparam (const char *, char *, int, int, int, int, int); |
| 32 | |||
| 33 | extern char PC; | ||
| 34 | extern char *BC; | ||
| 35 | extern char *UP; | ||
diff --git a/src/xdisp.c b/src/xdisp.c index a7955f41e0c..457a5e3e11b 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -802,8 +802,8 @@ static int cursor_row_fully_visible_p (struct window *, int, int); | |||
| 802 | static int try_scrolling (Lisp_Object, int, EMACS_INT, EMACS_INT, int, int); | 802 | static int try_scrolling (Lisp_Object, int, EMACS_INT, EMACS_INT, int, int); |
| 803 | static int try_cursor_movement (Lisp_Object, struct text_pos, int *); | 803 | static int try_cursor_movement (Lisp_Object, struct text_pos, int *); |
| 804 | static int trailing_whitespace_p (EMACS_INT); | 804 | static int trailing_whitespace_p (EMACS_INT); |
| 805 | static int message_log_check_duplicate (EMACS_INT, EMACS_INT, | 805 | static unsigned long int message_log_check_duplicate (EMACS_INT, EMACS_INT, |
| 806 | EMACS_INT, EMACS_INT); | 806 | EMACS_INT, EMACS_INT); |
| 807 | static void push_it (struct it *); | 807 | static void push_it (struct it *); |
| 808 | static void pop_it (struct it *); | 808 | static void pop_it (struct it *); |
| 809 | static void sync_frame_with_window_matrix_rows (struct window *); | 809 | static void sync_frame_with_window_matrix_rows (struct window *); |
| @@ -7973,7 +7973,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte) | |||
| 7973 | if (nlflag) | 7973 | if (nlflag) |
| 7974 | { | 7974 | { |
| 7975 | EMACS_INT this_bol, this_bol_byte, prev_bol, prev_bol_byte; | 7975 | EMACS_INT this_bol, this_bol_byte, prev_bol, prev_bol_byte; |
| 7976 | int dups; | 7976 | unsigned long int dups; |
| 7977 | insert_1 ("\n", 1, 1, 0, 0); | 7977 | insert_1 ("\n", 1, 1, 0, 0); |
| 7978 | 7978 | ||
| 7979 | scan_newline (Z, Z_BYTE, BEG, BEG_BYTE, -2, 0); | 7979 | scan_newline (Z, Z_BYTE, BEG, BEG_BYTE, -2, 0); |
| @@ -8001,7 +8001,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte) | |||
| 8001 | 8001 | ||
| 8002 | /* If you change this format, don't forget to also | 8002 | /* If you change this format, don't forget to also |
| 8003 | change message_log_check_duplicate. */ | 8003 | change message_log_check_duplicate. */ |
| 8004 | sprintf (dupstr, " [%d times]", dups); | 8004 | sprintf (dupstr, " [%lu times]", dups); |
| 8005 | duplen = strlen (dupstr); | 8005 | duplen = strlen (dupstr); |
| 8006 | TEMP_SET_PT_BOTH (Z - 1, Z_BYTE - 1); | 8006 | TEMP_SET_PT_BOTH (Z - 1, Z_BYTE - 1); |
| 8007 | insert_1 (dupstr, duplen, 1, 0, 1); | 8007 | insert_1 (dupstr, duplen, 1, 0, 1); |
| @@ -8063,7 +8063,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte) | |||
| 8063 | Return 0 if different, 1 if the new one should just replace it, or a | 8063 | Return 0 if different, 1 if the new one should just replace it, or a |
| 8064 | value N > 1 if we should also append " [N times]". */ | 8064 | value N > 1 if we should also append " [N times]". */ |
| 8065 | 8065 | ||
| 8066 | static int | 8066 | static unsigned long int |
| 8067 | message_log_check_duplicate (EMACS_INT prev_bol, EMACS_INT prev_bol_byte, | 8067 | message_log_check_duplicate (EMACS_INT prev_bol, EMACS_INT prev_bol_byte, |
| 8068 | EMACS_INT this_bol, EMACS_INT this_bol_byte) | 8068 | EMACS_INT this_bol, EMACS_INT this_bol_byte) |
| 8069 | { | 8069 | { |
| @@ -8085,10 +8085,9 @@ message_log_check_duplicate (EMACS_INT prev_bol, EMACS_INT prev_bol_byte, | |||
| 8085 | return 2; | 8085 | return 2; |
| 8086 | if (*p1++ == ' ' && *p1++ == '[') | 8086 | if (*p1++ == ' ' && *p1++ == '[') |
| 8087 | { | 8087 | { |
| 8088 | int n = 0; | 8088 | char *pend; |
| 8089 | while (*p1 >= '0' && *p1 <= '9') | 8089 | unsigned long int n = strtoul ((char *) p1, &pend, 10); |
| 8090 | n = n * 10 + *p1++ - '0'; | 8090 | if (strncmp (pend, " times]\n", 8) == 0) |
| 8091 | if (strncmp ((char *) p1, " times]\n", 8) == 0) | ||
| 8092 | return n+1; | 8091 | return n+1; |
| 8093 | } | 8092 | } |
| 8094 | return 0; | 8093 | return 0; |
| @@ -19007,7 +19006,7 @@ pint2str (register char *buf, register int width, register EMACS_INT d) | |||
| 19007 | 19006 | ||
| 19008 | static const char power_letter[] = | 19007 | static const char power_letter[] = |
| 19009 | { | 19008 | { |
| 19010 | 0, /* not used */ | 19009 | 0, /* no letter */ |
| 19011 | 'k', /* kilo */ | 19010 | 'k', /* kilo */ |
| 19012 | 'M', /* mega */ | 19011 | 'M', /* mega */ |
| 19013 | 'G', /* giga */ | 19012 | 'G', /* giga */ |
| @@ -19089,8 +19088,7 @@ pint2hrstr (char *buf, int width, int d) | |||
| 19089 | p = psuffix = buf + max (width, length); | 19088 | p = psuffix = buf + max (width, length); |
| 19090 | 19089 | ||
| 19091 | /* Print EXPONENT. */ | 19090 | /* Print EXPONENT. */ |
| 19092 | if (exponent) | 19091 | *psuffix++ = power_letter[exponent]; |
| 19093 | *psuffix++ = power_letter[exponent]; | ||
| 19094 | *psuffix = '\0'; | 19092 | *psuffix = '\0'; |
| 19095 | 19093 | ||
| 19096 | /* Print TENTHS. */ | 19094 | /* Print TENTHS. */ |
diff --git a/src/xfont.c b/src/xfont.c index f8aace3663c..3e0fcd2cd75 100644 --- a/src/xfont.c +++ b/src/xfont.c | |||
| @@ -629,7 +629,7 @@ xfont_list_family (Lisp_Object frame) | |||
| 629 | char **names; | 629 | char **names; |
| 630 | int num_fonts, i; | 630 | int num_fonts, i; |
| 631 | Lisp_Object list; | 631 | Lisp_Object list; |
| 632 | char *last_family; | 632 | char *last_family IF_LINT (= 0); |
| 633 | int last_len; | 633 | int last_len; |
| 634 | 634 | ||
| 635 | BLOCK_INPUT; | 635 | BLOCK_INPUT; |
diff --git a/src/xftfont.c b/src/xftfont.c index 695527c4236..c27a4fcf91a 100644 --- a/src/xftfont.c +++ b/src/xftfont.c | |||
| @@ -280,7 +280,7 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 280 | { | 280 | { |
| 281 | FcResult result; | 281 | FcResult result; |
| 282 | Display *display = FRAME_X_DISPLAY (f); | 282 | Display *display = FRAME_X_DISPLAY (f); |
| 283 | Lisp_Object val, filename, index, font_object; | 283 | Lisp_Object val, filename, idx, font_object; |
| 284 | FcPattern *pat = NULL, *match; | 284 | FcPattern *pat = NULL, *match; |
| 285 | struct xftfont_info *xftfont_info = NULL; | 285 | struct xftfont_info *xftfont_info = NULL; |
| 286 | struct font *font; | 286 | struct font *font; |
| @@ -298,7 +298,7 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 298 | return Qnil; | 298 | return Qnil; |
| 299 | val = XCDR (val); | 299 | val = XCDR (val); |
| 300 | filename = XCAR (val); | 300 | filename = XCAR (val); |
| 301 | index = XCDR (val); | 301 | idx = XCDR (val); |
| 302 | size = XINT (AREF (entity, FONT_SIZE_INDEX)); | 302 | size = XINT (AREF (entity, FONT_SIZE_INDEX)); |
| 303 | if (size == 0) | 303 | if (size == 0) |
| 304 | size = pixel_size; | 304 | size = pixel_size; |
| @@ -335,7 +335,7 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 335 | xftfont_add_rendering_parameters (pat, entity); | 335 | xftfont_add_rendering_parameters (pat, entity); |
| 336 | 336 | ||
| 337 | FcPatternAddString (pat, FC_FILE, (FcChar8 *) SDATA (filename)); | 337 | FcPatternAddString (pat, FC_FILE, (FcChar8 *) SDATA (filename)); |
| 338 | FcPatternAddInteger (pat, FC_INDEX, XINT (index)); | 338 | FcPatternAddInteger (pat, FC_INDEX, XINT (idx)); |
| 339 | 339 | ||
| 340 | 340 | ||
| 341 | BLOCK_INPUT; | 341 | BLOCK_INPUT; |
| @@ -409,9 +409,9 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 409 | spacing = FC_PROPORTIONAL; | 409 | spacing = FC_PROPORTIONAL; |
| 410 | if (! ascii_printable[0]) | 410 | if (! ascii_printable[0]) |
| 411 | { | 411 | { |
| 412 | int i; | 412 | int ch; |
| 413 | for (i = 0; i < 95; i++) | 413 | for (ch = 0; ch < 95; ch++) |
| 414 | ascii_printable[i] = ' ' + i; | 414 | ascii_printable[ch] = ' ' + ch; |
| 415 | } | 415 | } |
| 416 | BLOCK_INPUT; | 416 | BLOCK_INPUT; |
| 417 | if (spacing != FC_PROPORTIONAL | 417 | if (spacing != FC_PROPORTIONAL |
| @@ -672,7 +672,8 @@ xftfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_b | |||
| 672 | return len; | 672 | return len; |
| 673 | } | 673 | } |
| 674 | 674 | ||
| 675 | Lisp_Object | 675 | #if defined HAVE_M17N_FLT && defined HAVE_LIBOTF |
| 676 | static Lisp_Object | ||
| 676 | xftfont_shape (Lisp_Object lgstring) | 677 | xftfont_shape (Lisp_Object lgstring) |
| 677 | { | 678 | { |
| 678 | struct font *font; | 679 | struct font *font; |
| @@ -688,6 +689,7 @@ xftfont_shape (Lisp_Object lgstring) | |||
| 688 | XftUnlockFace (xftfont_info->xftfont); | 689 | XftUnlockFace (xftfont_info->xftfont); |
| 689 | return val; | 690 | return val; |
| 690 | } | 691 | } |
| 692 | #endif | ||
| 691 | 693 | ||
| 692 | static int | 694 | static int |
| 693 | xftfont_end_for_frame (FRAME_PTR f) | 695 | xftfont_end_for_frame (FRAME_PTR f) |
diff --git a/src/xmenu.c b/src/xmenu.c index eab7bb03f20..60ac27a5b8f 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -922,7 +922,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) | |||
| 922 | #endif | 922 | #endif |
| 923 | Lisp_Object items; | 923 | Lisp_Object items; |
| 924 | widget_value *wv, *first_wv, *prev_wv = 0; | 924 | widget_value *wv, *first_wv, *prev_wv = 0; |
| 925 | int i, last_i = 0; | 925 | EMACS_UINT i, last_i = 0; |
| 926 | int *submenu_start, *submenu_end; | 926 | int *submenu_start, *submenu_end; |
| 927 | int *submenu_top_level_items, *submenu_n_panes; | 927 | int *submenu_top_level_items, *submenu_n_panes; |
| 928 | 928 | ||
| @@ -28,7 +28,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 28 | #include "lisp.h" | 28 | #include "lisp.h" |
| 29 | #include "buffer.h" | 29 | #include "buffer.h" |
| 30 | 30 | ||
| 31 | Lisp_Object make_dom (xmlNode *node) | 31 | static Lisp_Object |
| 32 | make_dom (xmlNode *node) | ||
| 32 | { | 33 | { |
| 33 | if (node->type == XML_ELEMENT_NODE) | 34 | if (node->type == XML_ELEMENT_NODE) |
| 34 | { | 35 | { |