aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorStefan Monnier2011-03-31 00:24:03 -0400
committerStefan Monnier2011-03-31 00:24:03 -0400
commit40d83b412f584cc02e68d4eac8fd5e6eb769e2fe (patch)
treeb56f27a7e6d75a8c1fd27b00179a27b5efea0a32 /lib-src
parentf488fb6528738131ef41859e1f04125f2e50efce (diff)
parent44f230aa043ebb222aa0876b44d70484d5dd38db (diff)
downloademacs-40d83b412f584cc02e68d4eac8fd5e6eb769e2fe.tar.gz
emacs-40d83b412f584cc02e68d4eac8fd5e6eb769e2fe.zip
Merge from trunk
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog48
-rw-r--r--lib-src/Makefile.in6
-rw-r--r--lib-src/ebrowse.c22
-rw-r--r--lib-src/emacsclient.c6
-rw-r--r--lib-src/etags.c40
-rw-r--r--lib-src/fakemail.c4
-rw-r--r--lib-src/ntlib.c1
-rw-r--r--lib-src/update-game-score.c14
8 files changed, 93 insertions, 48 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index bd1a84cf0b9..5007995e14e 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,51 @@
12011-03-30 Paul Eggert <eggert@cs.ucla.edu>
2
3 Fix a problem found by GCC 4.6.0's static checks.
4 * etags.c (just_read_file): Remove dummy variable and simplify.
5
62011-03-27 Glenn Morris <rgm@gnu.org>
7
8 * emacsclient.c: Replace SIGTYPE with void.
9
102011-03-23 Juanma Barranquero <lekktu@gmail.com>
11
12 * ntlib.c: Include <ctype.h>.
13
142011-03-23 Glenn Morris <rgm@gnu.org>
15
16 * Makefile.in ($(DESTDIR)${archlibdir}):
17 Use `install-sh -d' rather than mkinstalldirs.
18
192011-03-23 Paul Eggert <eggert@cs.ucla.edu>
20
21 * ebrowse.c: Use size_t, not int, for sizes.
22 This avoids a warning with gcc -Wstrict-overflow, and works
23 better for very large objects.
24 (inbuffer_size): Now size_t. All uses changed.
25 (xmalloc, xrealloc, operator_name, process_file): Use size_t for
26 sizes. Don't bother testing whether a size_t value can be negative.
27
28 * etags.c (Ada_funcs): Redo slightly to avoid overflow warning.
29
30 etags: In Prolog functions, don't assume int fits in size_t.
31 This avoids a warning with gcc -Wstrict-overflow.
32 * etags.c (Prolog_functions, prolog_pr, prolog_atom): Use size_t,
33 not int, to store sizes.
34 (prolog_atom): Return 0, not -1, on error. All callers changed.
35
36 update-game-score: fix bug with -r
37 * update-game-score.c (main): Don't set 'scores' to garbage when
38 -r is specified and scorecount != MAX_SCORES (Bug#8310). This bug
39 was introduced in the 2002-04-10 change, and was found with gcc
40 -Wstrict-overflow (GCC 4.5.2, x86-64).
41
42 fakemail: Remove dependency on ignore-value.
43 This undoes some of the recent fakemail-related changes.
44 It is made possible due to recent changes to gnulib's stdio module.
45 * Makefile.in (fakemail${EXEEXT}): Do not depend on ignore-value.h.
46 * fakemail.c: Do not include ignore-value.h.
47 (put_line): Do not use ignore_value.
48
12011-03-03 Drake Wilson <drake@begriffli.ch> (tiny change) 492011-03-03 Drake Wilson <drake@begriffli.ch> (tiny change)
2 50
3 * emacsclient.c (longopts): Add quiet. 51 * emacsclient.c (longopts): Add quiet.
diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in
index d622233efb4..36366a4d2e7 100644
--- a/lib-src/Makefile.in
+++ b/lib-src/Makefile.in
@@ -235,13 +235,13 @@ maybe-blessmail: $(BLESSMAIL_TARGET)
235$(DESTDIR)${archlibdir}: all 235$(DESTDIR)${archlibdir}: all
236 @echo 236 @echo
237 @echo "Installing utilities run internally by Emacs." 237 @echo "Installing utilities run internally by Emacs."
238 umask 022; $(top_srcdir)/mkinstalldirs $(DESTDIR)${archlibdir} 238 umask 022; $(top_srcdir)/install-sh -d $(DESTDIR)${archlibdir}
239 if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` != `/bin/pwd` ]; then \ 239 if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` != `/bin/pwd` ]; then \
240 for file in ${UTILITIES}; do \ 240 for file in ${UTILITIES}; do \
241 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file $(DESTDIR)${archlibdir}/$$file ; \ 241 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file $(DESTDIR)${archlibdir}/$$file ; \
242 done ; \ 242 done ; \
243 fi 243 fi
244 umask 022; $(top_srcdir)/mkinstalldirs $(DESTDIR)${gamedir}; \ 244 umask 022; $(top_srcdir)/install-sh -d $(DESTDIR)${gamedir}; \
245 touch $(DESTDIR)${gamedir}/snake-scores; \ 245 touch $(DESTDIR)${gamedir}/snake-scores; \
246 touch $(DESTDIR)${gamedir}/tetris-scores 246 touch $(DESTDIR)${gamedir}/tetris-scores
247 -if chown ${gameuser} $(DESTDIR)${archlibdir}/update-game-score && chmod u+s $(DESTDIR)${archlibdir}/update-game-score; then \ 247 -if chown ${gameuser} $(DESTDIR)${archlibdir}/update-game-score && chmod u+s $(DESTDIR)${archlibdir}/update-game-score; then \
@@ -353,7 +353,7 @@ movemail.o: ${srcdir}/movemail.c ../src/config.h
353pop.o: ${srcdir}/pop.c ${srcdir}/../lib/min-max.h ../src/config.h 353pop.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
356fakemail${EXEEXT}: ${srcdir}/fakemail.c ${srcdir}/../lib/ignore-value.h ../src/config.h 356fakemail${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
359emacsclient${EXEEXT}: ${srcdir}/emacsclient.c ../src/config.h 359emacsclient${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
379char *inbuffer; 379char *inbuffer;
380char *in; 380char *in;
381int inbuffer_size; 381size_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
494static void * 494static void *
495xmalloc (int nbytes) 495xmalloc (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
509static void * 509static void *
510xrealloc (void *p, int sz) 510xrealloc (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)
2792static char * 2792static char *
2793operator_name (int *sc) 2793operator_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/emacsclient.c b/lib-src/emacsclient.c
index abc9aee37c1..737a8d88586 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -1116,7 +1116,7 @@ socket_status (char *name)
1116/* A signal handler that passes the signal to the Emacs process. 1116/* A signal handler that passes the signal to the Emacs process.
1117 Useful for SIGWINCH. */ 1117 Useful for SIGWINCH. */
1118 1118
1119static SIGTYPE 1119static void
1120pass_signal_to_emacs (int signalnum) 1120pass_signal_to_emacs (int signalnum)
1121{ 1121{
1122 int old_errno = errno; 1122 int old_errno = errno;
@@ -1131,7 +1131,7 @@ pass_signal_to_emacs (int signalnum)
1131/* Signal handler for SIGCONT; notify the Emacs process that it can 1131/* Signal handler for SIGCONT; notify the Emacs process that it can
1132 now resume our tty frame. */ 1132 now resume our tty frame. */
1133 1133
1134static SIGTYPE 1134static void
1135handle_sigcont (int signalnum) 1135handle_sigcont (int signalnum)
1136{ 1136{
1137 int old_errno = errno; 1137 int old_errno = errno;
@@ -1157,7 +1157,7 @@ handle_sigcont (int signalnum)
1157 reality, we may get a SIGTSTP on C-z. Handling this signal and 1157 reality, we may get a SIGTSTP on C-z. Handling this signal and
1158 notifying Emacs about it should get things under control again. */ 1158 notifying Emacs about it should get things under control again. */
1159 1159
1160static SIGTYPE 1160static void
1161handle_sigtstp (int signalnum) 1161handle_sigtstp (int signalnum)
1162{ 1162{
1163 int old_errno = errno; 1163 int old_errno = errno;
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 385e4cc9721..a2cdf26abc7 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -3978,10 +3978,8 @@ Yacc_entries (FILE *inf)
3978static void 3978static void
3979just_read_file (FILE *inf) 3979just_read_file (FILE *inf)
3980{ 3980{
3981 register char *dummy; 3981 while (!feof (inf))
3982 3982 readline (&lb, inf);
3983 LOOP_ON_INPUT_LINES (inf, lb, dummy)
3984 continue;
3985} 3983}
3986 3984
3987 3985
@@ -4198,7 +4196,7 @@ Ada_funcs (FILE *inf)
4198 /* Skip a string i.e. "abcd". */ 4196 /* Skip a string i.e. "abcd". */
4199 if (inquote || (*dbp == '"')) 4197 if (inquote || (*dbp == '"'))
4200 { 4198 {
4201 dbp = etags_strchr ((inquote) ? dbp : dbp+1, '"'); 4199 dbp = etags_strchr (dbp + !inquote, '"');
4202 if (dbp != NULL) 4200 if (dbp != NULL)
4203 { 4201 {
4204 inquote = FALSE; 4202 inquote = FALSE;
@@ -5254,16 +5252,16 @@ HTML_labels (FILE *inf)
5254 * Original code by Sunichirou Sugou (1989) 5252 * Original code by Sunichirou Sugou (1989)
5255 * Rewritten by Anders Lindgren (1996) 5253 * Rewritten by Anders Lindgren (1996)
5256 */ 5254 */
5257static int prolog_pr (char *, char *); 5255static size_t prolog_pr (char *, char *);
5258static void prolog_skip_comment (linebuffer *, FILE *); 5256static void prolog_skip_comment (linebuffer *, FILE *);
5259static int prolog_atom (char *, int); 5257static size_t prolog_atom (char *, size_t);
5260 5258
5261static void 5259static void
5262Prolog_functions (FILE *inf) 5260Prolog_functions (FILE *inf)
5263{ 5261{
5264 char *cp, *last; 5262 char *cp, *last;
5265 int len; 5263 size_t len;
5266 int allocated; 5264 size_t allocated;
5267 5265
5268 allocated = 0; 5266 allocated = 0;
5269 len = 0; 5267 len = 0;
@@ -5320,16 +5318,16 @@ prolog_skip_comment (linebuffer *plb, FILE *inf)
5320 * Return the size of the name of the predicate or rule, or 0 if no 5318 * Return the size of the name of the predicate or rule, or 0 if no
5321 * header was found. 5319 * header was found.
5322 */ 5320 */
5323static int 5321static size_t
5324prolog_pr (char *s, char *last) 5322prolog_pr (char *s, char *last)
5325 5323
5326 /* Name of last clause. */ 5324 /* Name of last clause. */
5327{ 5325{
5328 int pos; 5326 size_t pos;
5329 int len; 5327 size_t len;
5330 5328
5331 pos = prolog_atom (s, 0); 5329 pos = prolog_atom (s, 0);
5332 if (pos < 1) 5330 if (! pos)
5333 return 0; 5331 return 0;
5334 5332
5335 len = pos; 5333 len = pos;
@@ -5339,7 +5337,7 @@ prolog_pr (char *s, char *last)
5339 || (s[pos] == '(' && (pos += 1)) 5337 || (s[pos] == '(' && (pos += 1))
5340 || (s[pos] == ':' && s[pos + 1] == '-' && (pos += 2))) 5338 || (s[pos] == ':' && s[pos + 1] == '-' && (pos += 2)))
5341 && (last == NULL /* save only the first clause */ 5339 && (last == NULL /* save only the first clause */
5342 || len != (int)strlen (last) 5340 || len != strlen (last)
5343 || !strneq (s, last, len))) 5341 || !strneq (s, last, len)))
5344 { 5342 {
5345 make_tag (s, len, TRUE, s, pos, lineno, linecharno); 5343 make_tag (s, len, TRUE, s, pos, lineno, linecharno);
@@ -5351,17 +5349,17 @@ prolog_pr (char *s, char *last)
5351 5349
5352/* 5350/*
5353 * Consume a Prolog atom. 5351 * Consume a Prolog atom.
5354 * Return the number of bytes consumed, or -1 if there was an error. 5352 * Return the number of bytes consumed, or 0 if there was an error.
5355 * 5353 *
5356 * A prolog atom, in this context, could be one of: 5354 * A prolog atom, in this context, could be one of:
5357 * - An alphanumeric sequence, starting with a lower case letter. 5355 * - An alphanumeric sequence, starting with a lower case letter.
5358 * - A quoted arbitrary string. Single quotes can escape themselves. 5356 * - A quoted arbitrary string. Single quotes can escape themselves.
5359 * Backslash quotes everything. 5357 * Backslash quotes everything.
5360 */ 5358 */
5361static int 5359static size_t
5362prolog_atom (char *s, int pos) 5360prolog_atom (char *s, size_t pos)
5363{ 5361{
5364 int origpos; 5362 size_t origpos;
5365 5363
5366 origpos = pos; 5364 origpos = pos;
5367 5365
@@ -5390,11 +5388,11 @@ prolog_atom (char *s, int pos)
5390 } 5388 }
5391 else if (s[pos] == '\0') 5389 else if (s[pos] == '\0')
5392 /* Multiline quoted atoms are ignored. */ 5390 /* Multiline quoted atoms are ignored. */
5393 return -1; 5391 return 0;
5394 else if (s[pos] == '\\') 5392 else if (s[pos] == '\\')
5395 { 5393 {
5396 if (s[pos+1] == '\0') 5394 if (s[pos+1] == '\0')
5397 return -1; 5395 return 0;
5398 pos += 2; 5396 pos += 2;
5399 } 5397 }
5400 else 5398 else
@@ -5403,7 +5401,7 @@ prolog_atom (char *s, int pos)
5403 return pos - origpos; 5401 return pos - origpos;
5404 } 5402 }
5405 else 5403 else
5406 return -1; 5404 return 0;
5407} 5405}
5408 5406
5409 5407
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/ntlib.c b/lib-src/ntlib.c
index 0ecd4177d2c..83f653f3ea3 100644
--- a/lib-src/ntlib.c
+++ b/lib-src/ntlib.c
@@ -28,6 +28,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
28#include <sys/types.h> 28#include <sys/types.h>
29#include <sys/stat.h> 29#include <sys/stat.h>
30#include <errno.h> 30#include <errno.h>
31#include <ctype.h>
31 32
32#include "ntlib.h" 33#include "ntlib.h"
33 34
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);