From 401bf9b4708c19d3c86c888ce482014ca559a5b8 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 17 Mar 2011 20:30:24 -0700 Subject: process.c: Use socklen_t, not int, for socket lengths. --- src/ChangeLog | 10 ++++++++++ src/config.in | 3 +++ src/process.c | 13 +++++++------ 3 files changed, 20 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d97969c24db..6eaa52ee285 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2011-03-18 Paul Eggert + + * process.c (Fmake_network_process): Use socklen_t, not int, + where POSIX says socklen_t is required in portable programs. + This fixes a porting bug on hosts like 64-bit HP-UX, where + socklen_t is wider than int. + (Fmake_network_process, server_accept_connection): + (wait_reading_process_output, read_process_output): + Likewise. + 2011-03-17 Paul Eggert Fix more problems found by GCC 4.5.2's static checks. diff --git a/src/config.in b/src/config.in index fbd3ee9338d..8b7312faaaa 100644 --- a/src/config.in +++ b/src/config.in @@ -1209,6 +1209,9 @@ along with GNU Emacs. If not, see . */ /* Define to `unsigned int' if does not define. */ #undef size_t +/* type to use in place of socklen_t if not defined */ +#undef socklen_t + /* Define to any substitute for sys_siglist. */ #undef sys_siglist diff --git a/src/process.c b/src/process.c index c9b420ab2ae..5a410c1e924 100644 --- a/src/process.c +++ b/src/process.c @@ -3467,7 +3467,7 @@ usage: (make-network-process &rest ARGS) */) if (EQ (service, Qt)) { struct sockaddr_in sa1; - int len1 = sizeof (sa1); + socklen_t len1 = sizeof (sa1); if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0) { ((struct sockaddr_in *)(lres->ai_addr))->sin_port = sa1.sin_port; @@ -3514,7 +3514,8 @@ usage: (make-network-process &rest ARGS) */) /* Unlike most other syscalls connect() cannot be called again. (That would return EALREADY.) The proper way to wait for completion is select(). */ - int sc, len; + int sc; + socklen_t len; SELECT_TYPE fdset; retry_select: FD_ZERO (&fdset); @@ -3587,7 +3588,7 @@ usage: (make-network-process &rest ARGS) */) if (!is_server) { struct sockaddr_in sa1; - int len1 = sizeof (sa1); + socklen_t len1 = sizeof (sa1); if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0) contact = Fplist_put (contact, QClocal, conv_sockaddr_to_lisp ((struct sockaddr *)&sa1, len1)); @@ -4192,7 +4193,7 @@ server_accept_connection (Lisp_Object server, int channel) struct sockaddr_un un; #endif } saddr; - int len = sizeof saddr; + socklen_t len = sizeof saddr; s = accept (channel, &saddr.sa, &len); @@ -5059,7 +5060,7 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd, /* getsockopt(,,SO_ERROR,,) is said to hang on some systems. So only use it on systems where it is known to work. */ { - int xlen = sizeof (xerrno); + socklen_t xlen = sizeof (xerrno); if (getsockopt (channel, SOL_SOCKET, SO_ERROR, &xerrno, &xlen)) xerrno = errno; } @@ -5171,7 +5172,7 @@ read_process_output (Lisp_Object proc, register int channel) /* We have a working select, so proc_buffered_char is always -1. */ if (DATAGRAM_CHAN_P (channel)) { - int len = datagram_address[channel].len; + socklen_t len = datagram_address[channel].len; nbytes = recvfrom (channel, chars + carryover, readmax, 0, datagram_address[channel].sa, &len); } -- cgit v1.2.1 From 7710357ceb6f58d34b85c665d7a3a3e1a3abd044 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 17 Mar 2011 21:43:32 -0700 Subject: * callproc.c (call_process_cleanup): Now static. --- src/ChangeLog | 4 ++++ src/callproc.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 93c8245b239..2271734e707 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2011-03-18 Paul Eggert + + * callproc.c (call_process_cleanup): Now static. + 2011-03-17 Eli Zaretskii * makefile.w32-in ($(BLD)/unexw32.$(O)): Depend on $(SRC)/unexec.h. diff --git a/src/callproc.c b/src/callproc.c index c53a92bbaf8..2fffb9d02a7 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -107,7 +107,7 @@ call_process_kill (Lisp_Object fdpid) return Qnil; } -Lisp_Object +static Lisp_Object call_process_cleanup (Lisp_Object arg) { Lisp_Object fdpid = Fcdr (arg); -- cgit v1.2.1 From cb1d0ef7c91692a70f3628c5b33095e48f325250 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 17 Mar 2011 21:45:18 -0700 Subject: * callproc.c (relocate_fd): Rename locals to avoid shadowing. --- src/ChangeLog | 1 + src/callproc.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 2271734e707..1d27999b49d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,7 @@ 2011-03-18 Paul Eggert * callproc.c (call_process_cleanup): Now static. + (relocate_fd): Rename locals to avoid shadowing. 2011-03-17 Eli Zaretskii diff --git a/src/callproc.c b/src/callproc.c index 2fffb9d02a7..04b8aa3332d 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -1272,12 +1272,12 @@ relocate_fd (int fd, int minfd) #endif if (new == -1) { - const char *message1 = "Error while setting up child: "; + const char *message_1 = "Error while setting up child: "; const char *errmessage = strerror (errno); - const char *message2 = "\n"; - emacs_write (2, message1, strlen (message1)); + const char *message_2 = "\n"; + emacs_write (2, message_1, strlen (message_1)); emacs_write (2, errmessage, strlen (errmessage)); - emacs_write (2, message2, strlen (message2)); + emacs_write (2, message_2, strlen (message_2)); _exit (1); } emacs_close (fd); -- cgit v1.2.1 From 6bd8c14466b0787f9675279727efdff93bced7bb Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 17 Mar 2011 21:58:44 -0700 Subject: * lisp.h (child_setup): Now NO_RETURN unless DOS_NT. This should get cleaned up, so that child_setup has the same signature on all platforms. --- src/ChangeLog | 4 ++++ src/lisp.h | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 1d27999b49d..da9676233e0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2011-03-18 Paul Eggert + * lisp.h (child_setup): Now NO_RETURN unless DOS_NT. + This should get cleaned up, so that child_setup has the + same signature on all platforms. + * callproc.c (call_process_cleanup): Now static. (relocate_fd): Rename locals to avoid shadowing. diff --git a/src/lisp.h b/src/lisp.h index 283b0989c1d..645b82c80cf 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3233,7 +3233,11 @@ extern void syms_of_process (void); extern void setup_process_coding_systems (Lisp_Object); EXFUN (Fcall_process, MANY); -extern int child_setup (int, int, int, char **, int, Lisp_Object); +extern int child_setup (int, int, int, char **, int, Lisp_Object) +#ifndef DOS_NT + NO_RETURN +#endif + ; extern void init_callproc_1 (void); extern void init_callproc (void); extern void set_initial_environment (void); -- cgit v1.2.1 From 7e9123a200047d0caaaa02e866aae6b7c4cebeb6 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 17 Mar 2011 22:06:34 -0700 Subject: * sysdep.c (sys_subshell): Use 'volatile' to avoid vfork clobbering. Before, this 'volatile' was incorrectly IF_LINTted out. --- src/ChangeLog | 3 +++ src/sysdep.c | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index da9676233e0..53f66bd8032 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-18 Paul Eggert + * sysdep.c (sys_subshell): Use 'volatile' to avoid vfork clobbering. + Before, this 'volatile' was incorrectly IF_LINTted out. + * lisp.h (child_setup): Now NO_RETURN unless DOS_NT. This should get cleaned up, so that child_setup has the same signature on all platforms. diff --git a/src/sysdep.c b/src/sysdep.c index 6ef3d88c5c8..889ff6d83eb 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -488,7 +488,11 @@ sys_subshell (void) int pid; struct save_signal saved_handlers[5]; Lisp_Object dir; - unsigned char * IF_LINT (volatile) str = 0; + + /* Volatile because otherwise vfork might clobber it on some hosts. */ + unsigned char *volatile dirstr = 0; + + unsigned char *str; int len; saved_handlers[0].code = SIGINT; @@ -512,7 +516,7 @@ sys_subshell (void) goto xyzzy; dir = expand_and_dir_to_file (Funhandled_file_name_directory (dir), Qnil); - str = (unsigned char *) alloca (SCHARS (dir) + 2); + str = dirstr = (unsigned char *) alloca (SCHARS (dir) + 2); len = SCHARS (dir); memcpy (str, SDATA (dir), len); if (str[len - 1] != '/') str[len++] = '/'; @@ -544,6 +548,7 @@ sys_subshell (void) sh = "sh"; /* Use our buffer's default directory for the subshell. */ + str = dirstr; if (str && chdir ((char *) str) != 0) { #ifndef DOS_NT -- cgit v1.2.1 From 591b2973e740d73b4bd00a78e8dc5444d59a22f3 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 17 Mar 2011 22:09:58 -0700 Subject: Add Bug#. --- src/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 6eaa52ee285..f1a6dcb3c17 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -3,7 +3,7 @@ * process.c (Fmake_network_process): Use socklen_t, not int, where POSIX says socklen_t is required in portable programs. This fixes a porting bug on hosts like 64-bit HP-UX, where - socklen_t is wider than int. + socklen_t is wider than int (Bug#8277). (Fmake_network_process, server_accept_connection): (wait_reading_process_output, read_process_output): Likewise. -- cgit v1.2.1 From 5e41f65daf496cc39cd8bef55a28525b78f97d3d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 17 Mar 2011 22:50:40 -0700 Subject: Better fix for volatile issue. --- src/sysdep.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/sysdep.c b/src/sysdep.c index 889ff6d83eb..14db0fd26d0 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -488,10 +488,7 @@ sys_subshell (void) int pid; struct save_signal saved_handlers[5]; Lisp_Object dir; - - /* Volatile because otherwise vfork might clobber it on some hosts. */ - unsigned char *volatile dirstr = 0; - + unsigned char *volatile str_volatile = 0; unsigned char *str; int len; @@ -516,7 +513,7 @@ sys_subshell (void) goto xyzzy; dir = expand_and_dir_to_file (Funhandled_file_name_directory (dir), Qnil); - str = dirstr = (unsigned char *) alloca (SCHARS (dir) + 2); + str_volatile = str = (unsigned char *) alloca (SCHARS (dir) + 2); len = SCHARS (dir); memcpy (str, SDATA (dir), len); if (str[len - 1] != '/') str[len++] = '/'; @@ -548,7 +545,7 @@ sys_subshell (void) sh = "sh"; /* Use our buffer's default directory for the subshell. */ - str = dirstr; + str = str_volatile; if (str && chdir ((char *) str) != 0) { #ifndef DOS_NT -- cgit v1.2.1 From b9c7f648f0a8af1492b32d53e0779198d28d6603 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 17 Mar 2011 22:56:46 -0700 Subject: * callproc.c (Fcall_process): Use 'volatile' to avoid vfork clobbering. --- src/ChangeLog | 5 +++-- src/callproc.c | 10 +++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 53f66bd8032..b8ab24a7121 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,7 +1,8 @@ 2011-03-18 Paul Eggert - * sysdep.c (sys_subshell): Use 'volatile' to avoid vfork clobbering. - Before, this 'volatile' was incorrectly IF_LINTted out. + * callproc.c (Fcall_process): Use 'volatile' to avoid vfork clobbering. + * sysdep.c (sys_subshell): Likewise. + Previously, the sys_subshell 'volatile' was incorrectly IF_LINTted out. * lisp.h (child_setup): Now NO_RETURN unless DOS_NT. This should get cleaned up, so that child_setup has the diff --git a/src/callproc.c b/src/callproc.c index 04b8aa3332d..75f239d1be2 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -180,7 +180,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) (int nargs, register Lisp_Object *args) { Lisp_Object infile, buffer, current_dir, path; - int display_p; + volatile int display_p_volatile; int fd[2]; int filefd; register int pid; @@ -190,6 +190,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) int bufsize = CALLPROC_BUFFER_SIZE_MIN; int count = SPECPDL_INDEX (); + const unsigned char **volatile new_argv_volatile; register const unsigned char **new_argv; /* File to use for stderr in the child. t means use same as standard output. */ @@ -343,7 +344,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) UNGCPRO; } - display_p = INTERACTIVE && nargs >= 4 && !NILP (args[3]); + display_p_volatile = INTERACTIVE && nargs >= 4 && !NILP (args[3]); filefd = emacs_open (SSDATA (infile), O_RDONLY, 0); if (filefd < 0) @@ -371,7 +372,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) && SREF (path, 1) == ':') path = Fsubstring (path, make_number (2), Qnil); - new_argv = (const unsigned char **) + new_argv_volatile = new_argv = (const unsigned char **) alloca (max (2, nargs - 2) * sizeof (char *)); if (nargs > 4) { @@ -542,6 +543,8 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) pid = vfork (); + new_argv = new_argv_volatile; + if (pid == 0) { if (fd[0] >= 0) @@ -673,6 +676,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) int first = 1; EMACS_INT total_read = 0; int carryover = 0; + int display_p = display_p_volatile; int display_on_the_fly = display_p; struct coding_system saved_coding; -- cgit v1.2.1 From 918436ed33aa8c600281c36454f8519df9a4147d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 17 Mar 2011 23:22:42 -0700 Subject: * region-cache.h (pp_cache): New decl, for gcc -Wmissing-prototypes. --- src/ChangeLog | 2 ++ src/region-cache.h | 2 ++ 2 files changed, 4 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index b8ab24a7121..db115bdbfd7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-18 Paul Eggert + * region-cache.h (pp_cache): New decl, for gcc -Wmissing-prototypes. + * callproc.c (Fcall_process): Use 'volatile' to avoid vfork clobbering. * sysdep.c (sys_subshell): Likewise. Previously, the sys_subshell 'volatile' was incorrectly IF_LINTted out. 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, EMACS_INT POS, EMACS_INT *NEXT); +/* For debugging. */ +void pp_cache (struct region_cache *); -- cgit v1.2.1 From c4fc4e301ecaeb98bd3041ca2ce7a106cafefef1 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 17 Mar 2011 23:25:25 -0700 Subject: * region-cache.c (insert_cache_boundary): Redo var to avoid shadowing. --- src/ChangeLog | 2 ++ src/region-cache.c | 25 ++++++++++++------------- 2 files changed, 14 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index db115bdbfd7..aa9de9deacb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-18 Paul Eggert + * region-cache.c (insert_cache_boundary): Redo var to avoid shadowing. + * region-cache.h (pp_cache): New decl, for gcc -Wmissing-prototypes. * callproc.c (Fcall_process): Use 'volatile' to avoid vfork clobbering. 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) } -/* Insert a new boundary in cache C; it will have cache index INDEX, +/* Insert a new boundary in cache C; it will have cache index I, and have the specified POS and VALUE. */ static void -insert_cache_boundary (struct region_cache *c, EMACS_INT index, EMACS_INT pos, +insert_cache_boundary (struct region_cache *c, EMACS_INT i, EMACS_INT pos, int value) { - /* index must be a valid cache index. */ - if (index < 0 || index > c->cache_len) + /* i must be a valid cache index. */ + if (i < 0 || i > c->cache_len) abort (); /* We must never want to insert something before the dummy first boundary. */ - if (index == 0) + if (i == 0) abort (); /* We must only be inserting things in order. */ - if (! (BOUNDARY_POS (c, index-1) < pos - && (index == c->cache_len - || pos < BOUNDARY_POS (c, index)))) + if (! (BOUNDARY_POS (c, i - 1) < pos + && (i == c->cache_len + || pos < BOUNDARY_POS (c, i)))) abort (); /* The value must be different from the ones around it. However, we temporarily create boundaries that establish the same value as the subsequent boundary, so we're not going to flag that case. */ - if (BOUNDARY_VALUE (c, index-1) == value) + if (BOUNDARY_VALUE (c, i - 1) == value) abort (); - move_cache_gap (c, index, 1); + move_cache_gap (c, i, 1); - c->boundaries[index].pos = pos - c->buffer_beg; - c->boundaries[index].value = value; + c->boundaries[i].pos = pos - c->buffer_beg; + c->boundaries[i].value = value; c->gap_start++; c->gap_len--; c->cache_len++; @@ -808,4 +808,3 @@ pp_cache (struct region_cache *c) fprintf (stderr, "%ld : %d\n", (long)pos, BOUNDARY_VALUE (c, i)); } } - -- cgit v1.2.1 From 500603320d95a06f8dfb25ab3f4447e115fea56d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 17 Mar 2011 23:27:08 -0700 Subject: * sound.c (wav_play, au_play, Fplay_sound_internal): Fix pointer signedness. --- src/ChangeLog | 3 +++ src/sound.c | 7 +++---- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index aa9de9deacb..aab298274cc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-18 Paul Eggert + * sound.c (wav_play, au_play, Fplay_sound_internal): + Fix pointer signedness. + * region-cache.c (insert_cache_boundary): Redo var to avoid shadowing. * region-cache.h (pp_cache): New decl, for gcc -Wmissing-prototypes. diff --git a/src/sound.c b/src/sound.c index 3a1668e4903..47d4c325997 100644 --- a/src/sound.c +++ b/src/sound.c @@ -595,7 +595,7 @@ wav_play (struct sound *s, struct sound_device *sd) files I found so far. If someone feels inclined to implement the whole RIFF-WAVE spec, please do. */ if (STRINGP (s->data)) - sd->write (sd, SDATA (s->data) + sizeof *header, + sd->write (sd, SSDATA (s->data) + sizeof *header, SBYTES (s->data) - sizeof *header); else { @@ -686,7 +686,7 @@ au_play (struct sound *s, struct sound_device *sd) sd->configure (sd); if (STRINGP (s->data)) - sd->write (sd, SDATA (s->data) + header->data_offset, + sd->write (sd, SSDATA (s->data) + header->data_offset, SBYTES (s->data) - header->data_offset); else { @@ -1410,7 +1410,7 @@ Internal use only, use `play-sound' instead. */) { int len = SCHARS (attrs[SOUND_DEVICE]); current_sound_device->file = (char *) alloca (len + 1); - strcpy (current_sound_device->file, SDATA (attrs[SOUND_DEVICE])); + strcpy (current_sound_device->file, SSDATA (attrs[SOUND_DEVICE])); } if (INTEGERP (attrs[SOUND_VOLUME])) @@ -1498,4 +1498,3 @@ init_sound (void) } #endif /* HAVE_SOUND */ - -- cgit v1.2.1 From d01f234b5f882640c9b9046fe48a0f3987dd088a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 17 Mar 2011 23:28:04 -0700 Subject: * sound.c (alsa_choose_format): Remove unused local var. --- src/ChangeLog | 1 + src/sound.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index aab298274cc..b35cae14094 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,6 +2,7 @@ * sound.c (wav_play, au_play, Fplay_sound_internal): Fix pointer signedness. + (alsa_choose_format): Remove unused local var. * region-cache.c (insert_cache_boundary): Redo var to avoid shadowing. diff --git a/src/sound.c b/src/sound.c index 47d4c325997..c886c8c40b1 100644 --- a/src/sound.c +++ b/src/sound.c @@ -1104,7 +1104,6 @@ alsa_close (struct sound_device *sd) static void alsa_choose_format (struct sound_device *sd, struct sound *s) { - struct alsa_params *p = (struct alsa_params *) sd->data; if (s->type == RIFF) { struct wav_header *h = (struct wav_header *) s->header; -- cgit v1.2.1 From 8176119bc432d0ddb6187a4a84c81a7d9489153a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 17 Mar 2011 23:42:43 -0700 Subject: * sound.c (wav_play): Initialize a variable to 0, to prevent undefined behavior. --- src/ChangeLog | 1 + src/sound.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index b35cae14094..69aaa359887 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -3,6 +3,7 @@ * sound.c (wav_play, au_play, Fplay_sound_internal): Fix pointer signedness. (alsa_choose_format): Remove unused local var. + (wav_play): Initialize a variable to 0, to prevent undefined behavior. * region-cache.c (insert_cache_boundary): Redo var to avoid shadowing. diff --git a/src/sound.c b/src/sound.c index c886c8c40b1..a2fe7ccc8ce 100644 --- a/src/sound.c +++ b/src/sound.c @@ -600,7 +600,7 @@ wav_play (struct sound *s, struct sound_device *sd) else { char *buffer; - int nbytes; + int nbytes = 0; int blksize = sd->period_size ? sd->period_size (sd) : 2048; int data_left = header->data_length; -- cgit v1.2.1 From 3e7d65943519072e22cb3bcff3897805f5bae7a8 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 17 Mar 2011 23:48:05 -0700 Subject: * atimer.c (start_atimer, append_atimer_lists, set_alarm): Rename locals to avoid shadowing. --- src/ChangeLog | 3 +++ src/atimer.c | 47 +++++++++++++++++++++++------------------------ 2 files changed, 26 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 69aaa359887..6ba2133de66 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-18 Paul Eggert + * atimer.c (start_atimer, append_atimer_lists, set_alarm): Rename + locals to avoid shadowing. + * sound.c (wav_play, au_play, Fplay_sound_internal): Fix pointer signedness. (alsa_choose_format): Remove unused local var. 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); to cancel_atimer; don't free it yourself. */ struct atimer * -start_atimer (enum atimer_type type, EMACS_TIME time, atimer_callback fn, +start_atimer (enum atimer_type type, EMACS_TIME timestamp, atimer_callback fn, void *client_data) { struct atimer *t; @@ -94,10 +94,10 @@ start_atimer (enum atimer_type type, EMACS_TIME time, atimer_callback fn, /* Round TIME up to the next full second if we don't have itimers. */ #ifndef HAVE_SETITIMER - if (EMACS_USECS (time) != 0) + if (EMACS_USECS (timestamp) != 0) { - EMACS_SET_USECS (time, 0); - EMACS_SET_SECS (time, EMACS_SECS (time) + 1); + EMACS_SET_USECS (timestamp, 0); + EMACS_SET_SECS (timestamp, EMACS_SECS (timestamp) + 1); } #endif /* not HAVE_SETITIMER */ @@ -123,18 +123,18 @@ start_atimer (enum atimer_type type, EMACS_TIME time, atimer_callback fn, switch (type) { case ATIMER_ABSOLUTE: - t->expiration = time; + t->expiration = timestamp; break; case ATIMER_RELATIVE: EMACS_GET_TIME (t->expiration); - EMACS_ADD_TIME (t->expiration, t->expiration, time); + EMACS_ADD_TIME (t->expiration, t->expiration, timestamp); break; case ATIMER_CONTINUOUS: EMACS_GET_TIME (t->expiration); - EMACS_ADD_TIME (t->expiration, t->expiration, time); - t->interval = time; + EMACS_ADD_TIME (t->expiration, t->expiration, timestamp); + t->interval = timestamp; break; } @@ -187,24 +187,24 @@ cancel_atimer (struct atimer *timer) } -/* Append two lists of atimers LIST1 and LIST2 and return the +/* Append two lists of atimers LIST_1 and LIST_2 and return the result list. */ static struct atimer * -append_atimer_lists (struct atimer *list1, struct atimer *list2) +append_atimer_lists (struct atimer *list_1, struct atimer *list_2) { - if (list1 == NULL) - return list2; - else if (list2 == NULL) - return list1; + if (list_1 == NULL) + return list_2; + else if (list_2 == NULL) + return list_1; else { struct atimer *p; - for (p = list1; p->next; p = p->next) + for (p = list_1; p->next; p = p->next) ; - p->next = list2; - return list1; + p->next = list_2; + return list_1; } } @@ -287,28 +287,28 @@ set_alarm (void) { if (atimers) { - EMACS_TIME now, time; + EMACS_TIME now, timestamp; #ifdef HAVE_SETITIMER struct itimerval it; #endif /* Determine s/us till the next timer is ripe. */ EMACS_GET_TIME (now); - EMACS_SUB_TIME (time, atimers->expiration, now); + EMACS_SUB_TIME (timestamp, atimers->expiration, now); #ifdef HAVE_SETITIMER /* Don't set the interval to 0; this disables the timer. */ if (EMACS_TIME_LE (atimers->expiration, now)) { - EMACS_SET_SECS (time, 0); - EMACS_SET_USECS (time, 1000); + EMACS_SET_SECS (timestamp, 0); + EMACS_SET_USECS (timestamp, 1000); } memset (&it, 0, sizeof it); - it.it_value = time; + it.it_value = timestamp; setitimer (ITIMER_REAL, &it, 0); #else /* not HAVE_SETITIMER */ - alarm (max (EMACS_SECS (time), 1)); + alarm (max (EMACS_SECS (timestamp), 1)); #endif /* not HAVE_SETITIMER */ } } @@ -442,4 +442,3 @@ init_atimer (void) /* pending_signals is initialized in init_keyboard.*/ signal (SIGALRM, alarm_signal_handler); } - -- cgit v1.2.1 From c83b88720cb825690820f549c1a070766b685f76 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 18 Mar 2011 00:27:01 -0700 Subject: Add Bug#. --- src/ChangeLog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 6ba2133de66..576bbf50157 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -6,7 +6,8 @@ * sound.c (wav_play, au_play, Fplay_sound_internal): Fix pointer signedness. (alsa_choose_format): Remove unused local var. - (wav_play): Initialize a variable to 0, to prevent undefined behavior. + (wav_play): Initialize a variable to 0, to prevent undefined + behavior (Bug#8278). * region-cache.c (insert_cache_boundary): Redo var to avoid shadowing. -- cgit v1.2.1 From 235d7abc8e825c66c642023ff6290ae83f6dac86 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 18 Mar 2011 09:39:15 -0700 Subject: * intervals.h (CHECK_TOTAL_LENGTH): Avoid empty "else". --- src/ChangeLog | 2 ++ src/intervals.h | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 576bbf50157..89e054f62b0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-18 Paul Eggert + * intervals.h (CHECK_TOTAL_LENGTH): Avoid empty "else". + * atimer.c (start_atimer, append_atimer_lists, set_alarm): Rename locals to avoid shadowing. 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 (INTERVAL_HAS_PARENT (i) ? INTERVAL_PARENT (i) : 0) /* Abort if interval I's size is negative. */ -#define CHECK_TOTAL_LENGTH(i) \ - if ((int) (i)->total_length < 0) abort (); else +#define CHECK_TOTAL_LENGTH(i) \ + do \ + { \ + if ((int) (i)->total_length < 0) \ + abort (); \ + } \ + while (0) /* Reset this interval to its vanilla, or no-property state. */ #define RESET_INTERVAL(i) \ @@ -339,4 +344,3 @@ extern Lisp_Object get_pos_property (Lisp_Object pos, Lisp_Object prop, extern void syms_of_textprop (void); #include "composite.h" - -- cgit v1.2.1 From fc7bf02501ee772bb872561371f44a74dfb96a80 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 18 Mar 2011 09:40:17 -0700 Subject: * intervals.c (interval_start_pos): Now static. --- src/ChangeLog | 2 ++ src/intervals.c | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 89e054f62b0..21475dd6a6a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-18 Paul Eggert + * intervals.c (interval_start_pos): Now static. + * intervals.h (CHECK_TOTAL_LENGTH): Avoid empty "else". * atimer.c (start_atimer, append_atimer_lists, set_alarm): Rename 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) Don't use this function on an interval which is the child of another interval! */ -int +static int interval_start_pos (INTERVAL source) { Lisp_Object parent; @@ -2559,4 +2559,3 @@ set_intervals_multibyte (int multi_flag) set_intervals_multibyte_1 (BUF_INTERVALS (current_buffer), multi_flag, BEG, BEG_BYTE, Z, Z_BYTE); } - -- cgit v1.2.1 From ff08eb8560405630be43c0543aa5558ed0fe6cbf Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 18 Mar 2011 09:42:05 -0700 Subject: * textprop.c (property_change_between_p): Remove; unused. --- src/ChangeLog | 2 ++ src/textprop.c | 32 -------------------------------- 2 files changed, 2 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 21475dd6a6a..65b7bccd79e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-18 Paul Eggert + * textprop.c (property_change_between_p): Remove; unused. + * intervals.c (interval_start_pos): Now static. * intervals.h (CHECK_TOTAL_LENGTH): Avoid empty "else". 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. */) return make_number (next->position); } -/* Return 1 if there's a change in some property between BEG and END. */ - -int -property_change_between_p (EMACS_INT beg, EMACS_INT end) -{ - register INTERVAL i, next; - Lisp_Object object, pos; - - XSETBUFFER (object, current_buffer); - XSETFASTINT (pos, beg); - - i = validate_interval_range (object, &pos, &pos, soft); - if (NULL_INTERVAL_P (i)) - return 0; - - next = next_interval (i); - while (! NULL_INTERVAL_P (next) && intervals_equal (i, next)) - { - next = next_interval (next); - if (NULL_INTERVAL_P (next)) - return 0; - if (next->position >= end) - return 0; - } - - if (NULL_INTERVAL_P (next)) - return 0; - - return 1; -} - DEFUN ("next-single-property-change", Fnext_single_property_change, Snext_single_property_change, 2, 4, 0, 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 /* defsubr (&Serase_text_properties); */ /* defsubr (&Scopy_text_properties); */ } - -- cgit v1.2.1 From 760fbc2c7d8c1f3e8b38583c28d655f11f9bc0e2 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 18 Mar 2011 17:12:53 -0700 Subject: character.h: Rename locals to avoid shadowing. * character.h (PREV_CHAR_BOUNDARY, FETCH_STRING_CHAR_ADVANCE): (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE, FETCH_CHAR_ADVANCE): (FETCH_CHAR_ADVANCE_NO_CHECK, INC_POS, DEC_POS, BUF_INC_POS): (BUF_DEC_POS): Be more systematic about renaming local temporaries to avoid shadowing. --- src/ChangeLog | 7 ++++++ src/character.h | 68 ++++++++++++++++++++++++++++----------------------------- 2 files changed, 41 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 65b7bccd79e..b614091bdbb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,12 @@ 2011-03-18 Paul Eggert + character.h: Rename locals to avoid shadowing. + * character.h (PREV_CHAR_BOUNDARY, FETCH_STRING_CHAR_ADVANCE): + (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE, FETCH_CHAR_ADVANCE): + (FETCH_CHAR_ADVANCE_NO_CHECK, INC_POS, DEC_POS, BUF_INC_POS): + (BUF_DEC_POS): Be more systematic about renaming local temporaries + to avoid shadowing. + * textprop.c (property_change_between_p): Remove; unused. * intervals.c (interval_start_pos): Now static. 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 . */ do { \ if ((p) > (limit)) \ { \ - const unsigned char *pcb = (p); \ + const unsigned char *chp = (p); \ do { \ - pcb--; \ - } while (pcb >= limit && ! CHAR_HEAD_P (*pcb)); \ - (p) = (BYTES_BY_CHAR_HEAD (*pcb) == (p) - pcb) ? pcb : (p) - 1; \ + chp--; \ + } while (chp >= limit && ! CHAR_HEAD_P (*chp)); \ + (p) = (BYTES_BY_CHAR_HEAD (*chp) == (p) - chp) ? chp : (p) - 1; \ } \ } while (0) @@ -353,11 +353,11 @@ along with GNU Emacs. If not, see . */ CHARIDX++; \ if (STRING_MULTIBYTE (STRING)) \ { \ - unsigned char *string_ptr = &SDATA (STRING)[BYTEIDX]; \ - int string_len; \ + unsigned char *chp = &SDATA (STRING)[BYTEIDX]; \ + int chlen; \ \ - OUTPUT = STRING_CHAR_AND_LENGTH (string_ptr, string_len); \ - BYTEIDX += string_len; \ + OUTPUT = STRING_CHAR_AND_LENGTH (chp, chlen); \ + BYTEIDX += chlen; \ } \ else \ { \ @@ -376,11 +376,11 @@ along with GNU Emacs. If not, see . */ CHARIDX++; \ if (STRING_MULTIBYTE (STRING)) \ { \ - unsigned char *ptr = &SDATA (STRING)[BYTEIDX]; \ - int ptrlen; \ + unsigned char *chp = &SDATA (STRING)[BYTEIDX]; \ + int chlen; \ \ - OUTPUT = STRING_CHAR_AND_LENGTH (ptr, ptrlen); \ - BYTEIDX += ptrlen; \ + OUTPUT = STRING_CHAR_AND_LENGTH (chp, chlen); \ + BYTEIDX += chlen; \ } \ else \ { \ @@ -416,11 +416,11 @@ along with GNU Emacs. If not, see . */ CHARIDX++; \ if (!NILP (BVAR (current_buffer, enable_multibyte_characters))) \ { \ - unsigned char *ptr = BYTE_POS_ADDR (BYTEIDX); \ - int string_len; \ + unsigned char *chp = BYTE_POS_ADDR (BYTEIDX); \ + int chlen; \ \ - OUTPUT= STRING_CHAR_AND_LENGTH (ptr, string_len); \ - BYTEIDX += string_len; \ + OUTPUT= STRING_CHAR_AND_LENGTH (chp, chlen); \ + BYTEIDX += chlen; \ } \ else \ { \ @@ -436,11 +436,11 @@ along with GNU Emacs. If not, see . */ #define FETCH_CHAR_ADVANCE_NO_CHECK(OUTPUT, CHARIDX, BYTEIDX) \ do \ { \ - unsigned char *ptr = BYTE_POS_ADDR (BYTEIDX); \ - int len; \ + unsigned char *chp = BYTE_POS_ADDR (BYTEIDX); \ + int chlen; \ \ - OUTPUT = STRING_CHAR_AND_LENGTH (ptr, len); \ - BYTEIDX += len; \ + OUTPUT = STRING_CHAR_AND_LENGTH (chp, chlen); \ + BYTEIDX += chlen; \ CHARIDX++; \ } \ while (0) @@ -451,8 +451,8 @@ along with GNU Emacs. If not, see . */ #define INC_POS(pos_byte) \ do { \ - unsigned char *ptr = BYTE_POS_ADDR (pos_byte); \ - pos_byte += BYTES_BY_CHAR_HEAD (*ptr); \ + unsigned char *chp = BYTE_POS_ADDR (pos_byte); \ + pos_byte += BYTES_BY_CHAR_HEAD (*chp); \ } while (0) @@ -461,16 +461,16 @@ along with GNU Emacs. If not, see . */ #define DEC_POS(pos_byte) \ do { \ - unsigned char *ptr; \ + unsigned char *chp; \ \ pos_byte--; \ if (pos_byte < GPT_BYTE) \ - ptr = BEG_ADDR + pos_byte - BEG_BYTE; \ + chp = BEG_ADDR + pos_byte - BEG_BYTE; \ else \ - ptr = BEG_ADDR + GAP_SIZE + pos_byte - BEG_BYTE; \ - while (!CHAR_HEAD_P (*ptr)) \ + chp = BEG_ADDR + GAP_SIZE + pos_byte - BEG_BYTE; \ + while (!CHAR_HEAD_P (*chp)) \ { \ - ptr--; \ + chp--; \ pos_byte--; \ } \ } while (0) @@ -510,8 +510,8 @@ along with GNU Emacs. If not, see . */ #define BUF_INC_POS(buf, pos_byte) \ do { \ - unsigned char *bbp = BUF_BYTE_ADDRESS (buf, pos_byte); \ - pos_byte += BYTES_BY_CHAR_HEAD (*bbp); \ + unsigned char *chp = BUF_BYTE_ADDRESS (buf, pos_byte); \ + pos_byte += BYTES_BY_CHAR_HEAD (*chp); \ } while (0) @@ -520,15 +520,15 @@ along with GNU Emacs. If not, see . */ #define BUF_DEC_POS(buf, pos_byte) \ do { \ - unsigned char *p; \ + unsigned char *chp; \ pos_byte--; \ if (pos_byte < BUF_GPT_BYTE (buf)) \ - p = BUF_BEG_ADDR (buf) + pos_byte - BEG_BYTE; \ + chp = BUF_BEG_ADDR (buf) + pos_byte - BEG_BYTE; \ else \ - p = BUF_BEG_ADDR (buf) + BUF_GAP_SIZE (buf) + pos_byte - BEG_BYTE;\ - while (!CHAR_HEAD_P (*p)) \ + chp = BUF_BEG_ADDR (buf) + BUF_GAP_SIZE (buf) + pos_byte - BEG_BYTE;\ + while (!CHAR_HEAD_P (*chp)) \ { \ - p--; \ + chp--; \ pos_byte--; \ } \ } while (0) -- cgit v1.2.1 From 8f5201aeebe612c1028a5912d81280b67b94039a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 18 Mar 2011 17:16:45 -0700 Subject: * composite.c (composition_compute_stop_pos): Rename local to avoid shadowing. --- src/ChangeLog | 5 +++++ src/composite.c | 17 ++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index b614091bdbb..1aa87aec661 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2011-03-19 Paul Eggert + + * composite.c (composition_compute_stop_pos): Rename local to + avoid shadowing. + 2011-03-18 Paul Eggert character.h: Rename locals to avoid shadowing. diff --git a/src/composite.c b/src/composite.c index 0b0602bf283..ddb0004b15b 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, if (! NILP (val)) { Lisp_Object elt; - int ridx, back, len; + int ridx, back, blen; for (ridx = 0; CONSP (val); val = XCDR (val), ridx++) { @@ -1132,17 +1132,17 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos, bpos = (NILP (string) ? CHAR_TO_BYTE (cpos) : string_char_to_byte (string, cpos)); if (STRINGP (AREF (elt, 0))) - len = fast_looking_at (AREF (elt, 0), cpos, bpos, - start + 1, limit, string); + blen = fast_looking_at (AREF (elt, 0), cpos, bpos, + start + 1, limit, string); else - len = 1; - if (len > 0) + blen = 1; + if (blen > 0) { /* Make CPOS point to the last character of - match. Note that LEN is byte-length. */ - if (len > 1) + match. Note that BLEN is byte-length. */ + if (blen > 1) { - bpos += len; + bpos += blen; if (NILP (string)) cpos = BYTE_TO_CHAR (bpos) - 1; else @@ -2032,4 +2032,3 @@ See also the documentation of `auto-composition-mode'. */); defsubr (&Sfind_composition_internal); defsubr (&Scomposition_get_gstring); } - -- cgit v1.2.1 From b246f9329c26a1174f760d345927d740aaac364b Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 18 Mar 2011 17:18:31 -0700 Subject: * composite.c (composition_reseat_it): Remove unused locals. (find_automatic_composition, composition_adjust_point): Likewise. --- src/ChangeLog | 2 ++ src/composite.c | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 1aa87aec661..fa16bab29c9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,6 +2,8 @@ * composite.c (composition_compute_stop_pos): Rename local to avoid shadowing. + (composition_reseat_it): Remove unused locals. + (find_automatic_composition, composition_adjust_point): Likewise. 2011-03-18 Paul Eggert diff --git a/src/composite.c b/src/composite.c index ddb0004b15b..86a53f91c97 100644 --- a/src/composite.c +++ b/src/composite.c @@ -1248,8 +1248,8 @@ composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_I else if (w) { Lisp_Object lgstring = Qnil; - Lisp_Object val, elt, re; - int len, i; + Lisp_Object val, elt; + int i; val = CHAR_TABLE_REF (Vcomposition_function_table, cmp_it->ch); for (i = 0; i < cmp_it->rule_idx; i++, val = XCDR (val)); @@ -1491,7 +1491,6 @@ find_automatic_composition (EMACS_INT pos, EMACS_INT limit, EMACS_INT *start, EM EMACS_INT fore_check_limit; struct position_record orig, cur, check, prev; Lisp_Object check_val, val, elt; - int check_lookback; int c; Lisp_Object window; struct window *w; @@ -1657,7 +1656,7 @@ find_automatic_composition (EMACS_INT pos, EMACS_INT limit, EMACS_INT *start, EM EMACS_INT composition_adjust_point (EMACS_INT last_pt, EMACS_INT new_pt) { - EMACS_INT charpos, bytepos, startpos, beg, end, pos; + EMACS_INT beg, end; Lisp_Object val; int i; -- cgit v1.2.1 From 80e079b231d97294c2c0cbd00a8d0e68c9586d36 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 18 Mar 2011 17:58:10 -0700 Subject: * composite.c (composition_update_it): Mark var as initialized. --- src/ChangeLog | 1 + src/composite.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index fa16bab29c9..ca10b31305d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -4,6 +4,7 @@ avoid shadowing. (composition_reseat_it): Remove unused locals. (find_automatic_composition, composition_adjust_point): Likewise. + (composition_update_it): Mark var as initialized. 2011-03-18 Paul Eggert diff --git a/src/composite.c b/src/composite.c index 86a53f91c97..ee2e843b729 100644 --- a/src/composite.c +++ b/src/composite.c @@ -1364,7 +1364,7 @@ composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_I int composition_update_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_INT bytepos, Lisp_Object string) { - int i, c; + int i, c IF_LINT (= 0); if (cmp_it->ch < 0) { -- cgit v1.2.1 From 8e52e652078cbaa3588c3fe034e076773fee04ce Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 18 Mar 2011 18:02:49 -0700 Subject: * composite.c (find_automatic_composition): Mark vars as initialized, with a FIXME. --- src/ChangeLog | 1 + src/composite.c | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index ca10b31305d..f856a24fbdd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -5,6 +5,7 @@ (composition_reseat_it): Remove unused locals. (find_automatic_composition, composition_adjust_point): Likewise. (composition_update_it): Mark var as initialized. + (find_automatic_composition): Mark vars as initialized, with a FIXME. 2011-03-18 Paul Eggert diff --git a/src/composite.c b/src/composite.c index ee2e843b729..bc5644a4612 100644 --- a/src/composite.c +++ b/src/composite.c @@ -1489,7 +1489,13 @@ find_automatic_composition (EMACS_INT pos, EMACS_INT limit, EMACS_INT *start, EM EMACS_INT head, tail, stop; /* Limit to check a composition after POS. */ EMACS_INT fore_check_limit; - struct position_record orig, cur, check, prev; + struct position_record orig, cur; + + /* FIXME: It's not obvious whether these two variables need initialization. + If they do, please supply initial values. + If not, please remove this comment. */ + struct position_record check IF_LINT (= {0}), prev IF_LINT (= {0}); + Lisp_Object check_val, val, elt; int c; Lisp_Object window; -- cgit v1.2.1 From 11b61122218efde0ffa175c2635f99570a62d1e3 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 18 Mar 2011 19:42:49 -0700 Subject: Add Bug#. --- src/ChangeLog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index f856a24fbdd..70f3daa10d3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -5,7 +5,8 @@ (composition_reseat_it): Remove unused locals. (find_automatic_composition, composition_adjust_point): Likewise. (composition_update_it): Mark var as initialized. - (find_automatic_composition): Mark vars as initialized, with a FIXME. + (find_automatic_composition): Mark vars as initialized, + with a FIXME (Bug#8290). 2011-03-18 Paul Eggert -- cgit v1.2.1 From c9735e30cac759cd796d6b6eb2d41b4d46894a08 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 18 Mar 2011 19:43:47 -0700 Subject: * xml.c (make_dom): Now static. --- src/ChangeLog | 2 ++ src/xml.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 70f3daa10d3..dbf5c94a87c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-19 Paul Eggert + * xml.c (make_dom): Now static. + * composite.c (composition_compute_stop_pos): Rename local to avoid shadowing. (composition_reseat_it): Remove unused locals. diff --git a/src/xml.c b/src/xml.c index 12ef14e6b9f..d8e6f8c3faa 100644 --- a/src/xml.c +++ b/src/xml.c @@ -28,7 +28,8 @@ along with GNU Emacs. If not, see . */ #include "lisp.h" #include "buffer.h" -Lisp_Object make_dom (xmlNode *node) +static Lisp_Object +make_dom (xmlNode *node) { if (node->type == XML_ELEMENT_NODE) { -- cgit v1.2.1 From e2be39f6afd7c24f3436740711fd1aeeb3fce3df Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 18 Mar 2011 19:45:11 -0700 Subject: * xfont.c (xfont_list_family): Mark var as initialized. --- src/ChangeLog | 2 ++ src/xfont.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index dbf5c94a87c..b242465cef3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-19 Paul Eggert + * xfont.c (xfont_list_family): Mark var as initialized. + * xml.c (make_dom): Now static. * composite.c (composition_compute_stop_pos): Rename local to 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) char **names; int num_fonts, i; Lisp_Object list; - char *last_family; + char *last_family IF_LINT (= 0); int last_len; BLOCK_INPUT; -- cgit v1.2.1 From 8ff096c18cc923d5f3b936311d837edd91d8fbe9 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 18 Mar 2011 19:49:10 -0700 Subject: * ftfont.c (ftfont_resolve_generic_family): Fix pointer signedness. --- src/ChangeLog | 2 ++ src/ftfont.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index b242465cef3..26833532ca4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-19 Paul Eggert + * ftfont.c (ftfont_resolve_generic_family): Fix pointer signedness. + * xfont.c (xfont_list_family): Mark var as initialized. * xml.c (make_dom): Now static. diff --git a/src/ftfont.c b/src/ftfont.c index db6b29421dc..0c3e7bb6428 100644 --- a/src/ftfont.c +++ b/src/ftfont.c @@ -311,8 +311,9 @@ ftfont_resolve_generic_family (Lisp_Object family, FcPattern *pattern) if (FcPatternGetLangSet (pattern, FC_LANG, 0, &langset) != FcResultMatch) { /* This is to avoid the effect of locale. */ + static const FcChar8 lang[] = "en"; langset = FcLangSetCreate (); - FcLangSetAdd (langset, "en"); + FcLangSetAdd (langset, lang); FcPatternAddLangSet (pattern, FC_LANG, langset); FcLangSetDestroy (langset); } -- cgit v1.2.1 From a00924bbcef7baa794fc1368d81bccd8931ae055 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 18 Mar 2011 21:56:15 -0700 Subject: * ftfont.c (ftfont_otf_capability, ftfont_shape): Omit decls if not needed. (OTF_TAG_SYM): Omit macro if not needed. --- src/ChangeLog | 2 ++ src/ftfont.c | 6 ++++++ 2 files changed, 8 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 26833532ca4..6ad69b657b8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,8 @@ 2011-03-19 Paul Eggert * ftfont.c (ftfont_resolve_generic_family): Fix pointer signedness. + (ftfont_otf_capability, ftfont_shape): Omit decls if not needed. + (OTF_TAG_SYM): Omit macro if not needed. * xfont.c (xfont_list_family): Mark var as initialized. diff --git a/src/ftfont.c b/src/ftfont.c index 0c3e7bb6428..5decec16825 100644 --- a/src/ftfont.c +++ b/src/ftfont.c @@ -491,8 +491,12 @@ static int ftfont_get_bitmap (struct font *, unsigned, struct font_bitmap *, int); static int ftfont_anchor_point (struct font *, unsigned, int, int *, int *); +#ifdef HAVE_LIBOTF static Lisp_Object ftfont_otf_capability (struct font *); +# ifdef HAVE_M17N_FLT static Lisp_Object ftfont_shape (Lisp_Object); +# endif +#endif #ifdef HAVE_OTF_GET_VARIATION_GLYPHS static int ftfont_variation_glyphs (struct font *, int c, @@ -619,6 +623,7 @@ struct OpenTypeSpec (P)[4] = '\0'; \ } while (0) +#ifdef HAVE_LIBOTF #define OTF_TAG_SYM(SYM, TAG) \ do { \ char str[5]; \ @@ -626,6 +631,7 @@ struct OpenTypeSpec OTF_TAG_STR (TAG, str); \ (SYM) = font_intern_prop (str, 4, 1); \ } while (0) +#endif static struct OpenTypeSpec * -- cgit v1.2.1 From e932860f4b4ecee35ae0f69f8c3082f5d32ef193 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 18 Mar 2011 21:57:02 -0700 Subject: * ftfont.c (ftfont_list): Remove unused local. --- src/ChangeLog | 1 + src/ftfont.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 6ad69b657b8..5ec2d88ea90 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -3,6 +3,7 @@ * ftfont.c (ftfont_resolve_generic_family): Fix pointer signedness. (ftfont_otf_capability, ftfont_shape): Omit decls if not needed. (OTF_TAG_SYM): Omit macro if not needed. + (ftfont_list): Remove unused local. * xfont.c (xfont_list_family): Mark var as initialized. diff --git a/src/ftfont.c b/src/ftfont.c index 5decec16825..28042bb9c66 100644 --- a/src/ftfont.c +++ b/src/ftfont.c @@ -871,7 +871,6 @@ ftfont_list (Lisp_Object frame, Lisp_Object spec) FcObjectSet *objset = NULL; FcCharSet *charset; Lisp_Object chars = Qnil; - FcResult result; char otlayout[15]; /* For "otlayout:XXXX" */ struct OpenTypeSpec *otspec = NULL; int spacing = -1; -- cgit v1.2.1 From 49eaafbac1695d9244329b3518309bfcc1a98aa4 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 18 Mar 2011 22:03:30 -0700 Subject: * ftfont.c: (get_adstyle_property, ftfont_pattern_entity): (ftfont_lookup_cache, ftfont_open, ftfont_anchor_point): Rename locals to avoid shadowing. --- src/ChangeLog | 3 +++ src/ftfont.c | 39 ++++++++++++++++++++------------------- 2 files changed, 23 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 5ec2d88ea90..ec9f513b045 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -4,6 +4,9 @@ (ftfont_otf_capability, ftfont_shape): Omit decls if not needed. (OTF_TAG_SYM): Omit macro if not needed. (ftfont_list): Remove unused local. + (get_adstyle_property, ftfont_pattern_entity): + (ftfont_lookup_cache, ftfont_open, ftfont_anchor_point): + Rename locals to avoid shadowing. * xfont.c (xfont_list_family): Mark var as initialized. diff --git a/src/ftfont.c b/src/ftfont.c index 28042bb9c66..ad01149106e 100644 --- a/src/ftfont.c +++ b/src/ftfont.c @@ -168,11 +168,11 @@ get_adstyle_property (FcPattern *p) for (end = str; *end && *end != ' '; end++); if (*end) { - char *p = alloca (end - str + 1); - memcpy (p, str, end - str); - p[end - str] = '\0'; - end = p + (end - str); - str = p; + char *newstr = alloca (end - str + 1); + memcpy (newstr, str, end - str); + newstr[end - str] = '\0'; + end = newstr + (end - str); + str = newstr; } if (xstrcasecmp (str, "Regular") == 0 || xstrcasecmp (str, "Bold") == 0 @@ -190,18 +190,18 @@ ftfont_pattern_entity (FcPattern *p, Lisp_Object extra) { Lisp_Object key, cache, entity; char *file, *str; - int index; + int idx; int numeric; double dbl; FcBool b; if (FcPatternGetString (p, FC_FILE, 0, (FcChar8 **) &file) != FcResultMatch) return Qnil; - if (FcPatternGetInteger (p, FC_INDEX, 0, &index) != FcResultMatch) + if (FcPatternGetInteger (p, FC_INDEX, 0, &idx) != FcResultMatch) return Qnil; key = Fcons (make_unibyte_string ((char *) file, strlen ((char *) file)), - make_number (index)); + make_number (idx)); cache = ftfont_lookup_cache (key, FTFONT_CACHE_FOR_ENTITY); entity = XCAR (cache); if (! NILP (entity)) @@ -265,7 +265,7 @@ ftfont_pattern_entity (FcPattern *p, Lisp_Object extra) ASET (entity, FONT_ADSTYLE_INDEX, get_adstyle_property (p)); if ((ft_library || FT_Init_FreeType (&ft_library) == 0) - && FT_New_Face (ft_library, file, index, &ft_face) == 0) + && FT_New_Face (ft_library, file, idx, &ft_face) == 0) { BDF_PropertyRec rec; @@ -394,14 +394,14 @@ ftfont_lookup_cache (Lisp_Object key, enum ftfont_cache_for cache_for) ? ! cache_data->ft_face : ! cache_data->fc_charset) { char *filename = SSDATA (XCAR (key)); - int index = XINT (XCDR (key)); + int idx = XINT (XCDR (key)); if (cache_for == FTFONT_CACHE_FOR_FACE) { if (! ft_library && FT_Init_FreeType (&ft_library) != 0) return Qnil; - if (FT_New_Face (ft_library, filename, index, &cache_data->ft_face) + if (FT_New_Face (ft_library, filename, idx, &cache_data->ft_face) != 0) return Qnil; } @@ -413,7 +413,7 @@ ftfont_lookup_cache (Lisp_Object key, enum ftfont_cache_for cache_for) FcCharSet *charset = NULL; pat = FcPatternBuild (0, FC_FILE, FcTypeString, (FcChar8 *) filename, - FC_INDEX, FcTypeInteger, index, NULL); + FC_INDEX, FcTypeInteger, idx, NULL); if (! pat) goto finish; objset = FcObjectSetBuild (FC_CHARSET, FC_STYLE, NULL); @@ -1159,7 +1159,7 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) FT_Face ft_face; FT_Size ft_size; FT_UInt size; - Lisp_Object val, filename, index, cache, font_object; + Lisp_Object val, filename, idx, cache, font_object; int scalable; int spacing; char name[256]; @@ -1174,7 +1174,7 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) if (NILP (cache)) return Qnil; filename = XCAR (val); - index = XCDR (val); + idx = XCDR (val); val = XCDR (cache); cache_data = XSAVE_VALUE (XCDR (cache))->pointer; ft_face = cache_data->ft_face; @@ -1216,7 +1216,7 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) font = XFONT_OBJECT (font_object); ftfont_info = (struct ftfont_info *) font; ftfont_info->ft_size = ft_face->size; - ftfont_info->index = XINT (index); + ftfont_info->index = XINT (idx); #ifdef HAVE_LIBOTF ftfont_info->maybe_otf = ft_face->face_flags & FT_FACE_FLAG_SFNT; ftfont_info->otf = NULL; @@ -1461,7 +1461,8 @@ ftfont_get_bitmap (struct font *font, unsigned int code, struct font_bitmap *bit } static int -ftfont_anchor_point (struct font *font, unsigned int code, int index, int *x, int *y) +ftfont_anchor_point (struct font *font, unsigned int code, int idx, + int *x, int *y) { struct ftfont_info *ftfont_info = (struct ftfont_info *) font; FT_Face ft_face = ftfont_info->ft_size->face; @@ -1472,10 +1473,10 @@ ftfont_anchor_point (struct font *font, unsigned int code, int index, int *x, in return -1; if (ft_face->glyph->format != FT_GLYPH_FORMAT_OUTLINE) return -1; - if (index >= ft_face->glyph->outline.n_points) + if (idx >= ft_face->glyph->outline.n_points) return -1; - *x = ft_face->glyph->outline.points[index].x; - *y = ft_face->glyph->outline.points[index].y; + *x = ft_face->glyph->outline.points[idx].x; + *y = ft_face->glyph->outline.points[idx].y; return 0; } -- cgit v1.2.1 From 0248044d313959dd87d64438fa297ca25adfc9ac Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 18 Mar 2011 22:05:19 -0700 Subject: * xftfont.c (xftfont_shape): Now static, and defined only if needed. --- src/ChangeLog | 2 ++ src/xftfont.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index ec9f513b045..ef0999b8454 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-19 Paul Eggert + * xftfont.c (xftfont_shape): Now static, and defined only if needed. + * ftfont.c (ftfont_resolve_generic_family): Fix pointer signedness. (ftfont_otf_capability, ftfont_shape): Omit decls if not needed. (OTF_TAG_SYM): Omit macro if not needed. diff --git a/src/xftfont.c b/src/xftfont.c index 695527c4236..7c8b5dde070 100644 --- a/src/xftfont.c +++ b/src/xftfont.c @@ -672,7 +672,8 @@ xftfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_b return len; } -Lisp_Object +#if defined HAVE_M17N_FLT && defined HAVE_LIBOTF +static Lisp_Object xftfont_shape (Lisp_Object lgstring) { struct font *font; @@ -688,6 +689,7 @@ xftfont_shape (Lisp_Object lgstring) XftUnlockFace (xftfont_info->xftfont); return val; } +#endif static int xftfont_end_for_frame (FRAME_PTR f) -- cgit v1.2.1 From 001a7ab41b79b45c0c6a1b5b90fe4ed9bbfe4e14 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 18 Mar 2011 22:07:42 -0700 Subject: * xftfont.c (xftfont_open): Rename locals to avoid shadowing. --- src/ChangeLog | 1 + src/xftfont.c | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index ef0999b8454..37534dc6c64 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,7 @@ 2011-03-19 Paul Eggert * xftfont.c (xftfont_shape): Now static, and defined only if needed. + (xftfont_open): Rename locals to avoid shadowing. * ftfont.c (ftfont_resolve_generic_family): Fix pointer signedness. (ftfont_otf_capability, ftfont_shape): Omit decls if not needed. diff --git a/src/xftfont.c b/src/xftfont.c index 7c8b5dde070..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) { FcResult result; Display *display = FRAME_X_DISPLAY (f); - Lisp_Object val, filename, index, font_object; + Lisp_Object val, filename, idx, font_object; FcPattern *pat = NULL, *match; struct xftfont_info *xftfont_info = NULL; struct font *font; @@ -298,7 +298,7 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) return Qnil; val = XCDR (val); filename = XCAR (val); - index = XCDR (val); + idx = XCDR (val); size = XINT (AREF (entity, FONT_SIZE_INDEX)); if (size == 0) size = pixel_size; @@ -335,7 +335,7 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) xftfont_add_rendering_parameters (pat, entity); FcPatternAddString (pat, FC_FILE, (FcChar8 *) SDATA (filename)); - FcPatternAddInteger (pat, FC_INDEX, XINT (index)); + FcPatternAddInteger (pat, FC_INDEX, XINT (idx)); BLOCK_INPUT; @@ -409,9 +409,9 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) spacing = FC_PROPORTIONAL; if (! ascii_printable[0]) { - int i; - for (i = 0; i < 95; i++) - ascii_printable[i] = ' ' + i; + int ch; + for (ch = 0; ch < 95; ch++) + ascii_printable[ch] = ' ' + ch; } BLOCK_INPUT; if (spacing != FC_PROPORTIONAL -- cgit v1.2.1 From af8a867c625d0ba45177795dea995a842b22e5f6 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 19 Mar 2011 15:46:50 -0700 Subject: Make tparam.h and terminfo.c consistent. * cm.c (tputs, tgoto, BC, UP): Remove extern decls. Include tparam.h instead, since it declares them. * cm.h (PC): Remove extern decl; tparam.h now does this. * deps.mk (cm.o, terminfo.o): Depend on tparam.h. * terminfo.c: Include tparam.h, to check interfaces. (tparm): Make 1st arg a const pointer in decl. Put it at top level. (tparam): Adjust signature to match interface in tparam.h; this removes some undefined behavior. Check that outstring and len are zero, which they always are with Emacs. * tparam.h (PC, BC, UP): New extern decls. --- src/ChangeLog | 12 ++++++++++++ src/cm.c | 10 +--------- src/cm.h | 2 -- src/deps.mk | 4 ++-- src/terminfo.c | 23 +++++++++++++---------- src/tparam.h | 4 ++++ 6 files changed, 32 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 37534dc6c64..841f4ee69dc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,17 @@ 2011-03-19 Paul Eggert + Make tparam.h and terminfo.c consistent. + * cm.c (tputs, tgoto, BC, UP): Remove extern decls. Include + tparam.h instead, since it declares them. + * cm.h (PC): Remove extern decl; tparam.h now does this. + * deps.mk (cm.o, terminfo.o): Depend on tparam.h. + * terminfo.c: Include tparam.h, to check interfaces. + (tparm): Make 1st arg a const pointer in decl. Put it at top level. + (tparam): Adjust signature to match interface in tparam.h; + this removes some undefined behavior. Check that outstring and len + are zero, which they always are with Emacs. + * tparam.h (PC, BC, UP): New extern decls. + * xftfont.c (xftfont_shape): Now static, and defined only if needed. (xftfont_open): Rename locals to avoid shadowing. diff --git a/src/cm.c b/src/cm.c index 108ee5720f3..6379955b48c 100644 --- a/src/cm.c +++ b/src/cm.c @@ -27,19 +27,11 @@ along with GNU Emacs. If not, see . */ #include "cm.h" #include "termhooks.h" #include "termchar.h" - - -/* For now, don't try to include termcap.h. On some systems, - configure finds a non-standard termcap.h that the main build - won't find. */ -extern void tputs (const char *, int, int (*)(int)); -extern char *tgoto (const char *, int, int); +#include "tparam.h" #define BIG 9999 /* 9999 good on VAXen. For 16 bit machines use about 2000.... */ -extern char *BC, *UP; - int cost; /* sums up costs */ /* ARGSUSED */ diff --git a/src/cm.h b/src/cm.h index 5d430598f0c..8f23990ce55 100644 --- a/src/cm.h +++ b/src/cm.h @@ -96,8 +96,6 @@ struct cm int cc_vabs; }; -extern char PC; /* Pad character */ - /* Shorthand */ #ifndef NoCMShortHand #define curY(tty) (tty)->Wcm->cm_curY 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 \ window.h dispextern.h msdos.h frame.h termhooks.h \ lisp.h globals.h $(config_h) cm.o: cm.c frame.h cm.h termhooks.h termchar.h dispextern.h msdos.h \ - lisp.h globals.h $(config_h) + tparam.h lisp.h globals.h $(config_h) cmds.o: cmds.c syntax.h buffer.h character.h commands.h window.h lisp.h \ globals.h $(config_h) msdos.h dispextern.h keyboard.h keymap.h systime.h \ coding.h frame.h composite.h @@ -196,7 +196,7 @@ termcap.o: termcap.c lisp.h tparam.h msdos.h $(config_h) terminal.o: terminal.c frame.h termchar.h termhooks.h charset.h coding.h \ keyboard.h lisp.h globals.h $(config_h) dispextern.h composite.h systime.h \ msdos.h -terminfo.o: terminfo.c lisp.h globals.h $(config_h) +terminfo.o: terminfo.c tparam.h lisp.h globals.h $(config_h) tparam.o: tparam.c tparam.h lisp.h $(config_h) undo.o: undo.c buffer.h commands.h window.h dispextern.h msdos.h \ lisp.h globals.h $(config_h) 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 along with GNU Emacs. If not, see . */ #include +#include "tparam.h" + #include #include "lisp.h" @@ -33,18 +35,19 @@ char *UP, *BC, PC; format is different too. */ +extern char *tparm (const char *str, ...); + + char * -tparam (char *string, char *outstring, - int len, int arg1, int arg2, int arg3, int arg4, - int arg5, int arg6, int arg7, int arg8, int arg9) +tparam (const char *string, char *outstring, int len, + int arg1, int arg2, int arg3, int arg4) { char *temp; - extern char *tparm (char *str, ...); - temp = tparm (string, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); - if (outstring == 0) - outstring = ((char *) (xmalloc ((strlen (temp)) + 1))); - strcpy (outstring, temp); - return outstring; -} + /* Emacs always should pass a null OUTSTRING and zero LEN. */ + if (outstring || len) + abort (); + temp = tparm (string, arg1, arg2, arg3, arg4); + return xstrdup (temp); +} 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 **); char *tgoto (const char *, int, int); char *tparam (const char *, char *, int, int, int, int, int); + +extern char PC; +extern char *BC; +extern char *UP; -- cgit v1.2.1 From b93aacde821363e25f86bad302cc2a8c32ff82ac Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 19 Mar 2011 19:40:14 -0700 Subject: * process.c: Rename or move locals to avoid shadowing. (list_processes_1, Fmake_network_process): (read_process_output_error_handler, exec_sentinel_error_handler): Rename or move locals. --- src/ChangeLog | 7 +++++++ src/process.c | 40 ++++++++++++++++++++-------------------- 2 files changed, 27 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 841f4ee69dc..df1c683b4eb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2011-03-20 Paul Eggert + + * process.c: Rename or move locals to avoid shadowing. + (list_processes_1, Fmake_network_process): + (read_process_output_error_handler, exec_sentinel_error_handler): + Rename or move locals. + 2011-03-19 Paul Eggert Make tparam.h and terminfo.c consistent. diff --git a/src/process.c b/src/process.c index c9b420ab2ae..952bc8e23da 100644 --- a/src/process.c +++ b/src/process.c @@ -1250,8 +1250,8 @@ Returns nil if format of ADDRESS is invalid. */) static Lisp_Object list_processes_1 (Lisp_Object query_only) { - register Lisp_Object tail, tem; - Lisp_Object proc, minspace, tem1; + register Lisp_Object tail; + Lisp_Object proc, minspace; register struct Lisp_Process *p; char tembuf[300]; int w_proc, w_buffer, w_tty; @@ -1453,10 +1453,10 @@ list_processes_1 (Lisp_Object query_only) } else { - tem = p->command; + Lisp_Object tem = p->command; while (1) { - tem1 = Fcar (tem); + Lisp_Object tem1 = Fcar (tem); if (NILP (tem1)) break; Finsert (1, &tem1); @@ -3705,10 +3705,10 @@ usage: (make-network-process &rest ARGS) */) { /* Setup coding systems for communicating with the network stream. */ - struct gcpro gcpro1; + struct gcpro inner_gcpro1; /* Qt denotes we have not yet called Ffind_operation_coding_system. */ Lisp_Object coding_systems = Qt; - Lisp_Object args[5], val; + Lisp_Object fargs[5], val; if (!NILP (tem)) { @@ -3731,11 +3731,11 @@ usage: (make-network-process &rest ARGS) */) coding_systems = Qnil; else { - args[0] = Qopen_network_stream, args[1] = name, - args[2] = buffer, args[3] = host, args[4] = service; - GCPRO1 (proc); - coding_systems = Ffind_operation_coding_system (5, args); - UNGCPRO; + fargs[0] = Qopen_network_stream, fargs[1] = name, + fargs[2] = buffer, fargs[3] = host, fargs[4] = service; + GCPRO1_VAR (proc, inner_gcpro); + coding_systems = Ffind_operation_coding_system (5, fargs); + UNGCPRO_VAR (inner_gcpro); } if (CONSP (coding_systems)) val = XCAR (coding_systems); @@ -3764,11 +3764,11 @@ usage: (make-network-process &rest ARGS) */) coding_systems = Qnil; else { - args[0] = Qopen_network_stream, args[1] = name, - args[2] = buffer, args[3] = host, args[4] = service; - GCPRO1 (proc); - coding_systems = Ffind_operation_coding_system (5, args); - UNGCPRO; + fargs[0] = Qopen_network_stream, fargs[1] = name, + fargs[2] = buffer, fargs[3] = host, fargs[4] = service; + GCPRO1_VAR (proc, inner_gcpro); + coding_systems = Ffind_operation_coding_system (5, fargs); + UNGCPRO_VAR (inner_gcpro); } } if (CONSP (coding_systems)) @@ -5128,9 +5128,9 @@ read_process_output_call (Lisp_Object fun_and_args) } static Lisp_Object -read_process_output_error_handler (Lisp_Object error) +read_process_output_error_handler (Lisp_Object error_val) { - cmd_error_internal (error, "error in process filter: "); + cmd_error_internal (error_val, "error in process filter: "); Vinhibit_quit = Qt; update_echo_area (); Fsleep_for (make_number (2), Qnil); @@ -6534,9 +6534,9 @@ exec_sentinel_unwind (Lisp_Object data) } static Lisp_Object -exec_sentinel_error_handler (Lisp_Object error) +exec_sentinel_error_handler (Lisp_Object error_val) { - cmd_error_internal (error, "error in process sentinel: "); + cmd_error_internal (error_val, "error in process sentinel: "); Vinhibit_quit = Qt; update_echo_area (); Fsleep_for (make_number (2), Qnil); -- cgit v1.2.1 From 4dc343ee3651cfefa2091788f4749a71ccbe741b Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 19 Mar 2011 19:41:23 -0700 Subject: * process.c (Fmake_network_process): Define label "retry_connect" only if needed. --- src/ChangeLog | 1 + src/process.c | 2 ++ 2 files changed, 3 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index df1c683b4eb..41cf56e47f0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -4,6 +4,7 @@ (list_processes_1, Fmake_network_process): (read_process_output_error_handler, exec_sentinel_error_handler): Rename or move locals. + (Fmake_network_process): Define label "retry_connect" only if needed. 2011-03-19 Paul Eggert diff --git a/src/process.c b/src/process.c index 952bc8e23da..fb6dc95bb31 100644 --- a/src/process.c +++ b/src/process.c @@ -3403,7 +3403,9 @@ usage: (make-network-process &rest ARGS) */) { int optn, optbits; +#ifdef WINDOWSNT retry_connect: +#endif s = socket (lres->ai_family, lres->ai_socktype, lres->ai_protocol); if (s < 0) -- cgit v1.2.1 From 0da4933597401742827d31c66836082c1ee70875 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 19 Mar 2011 19:42:34 -0700 Subject: * process.c (Fnetwork_interface_info): Fix pointer signedness. --- src/ChangeLog | 1 + src/process.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 41cf56e47f0..12a70ce9575 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -5,6 +5,7 @@ (read_process_output_error_handler, exec_sentinel_error_handler): Rename or move locals. (Fmake_network_process): Define label "retry_connect" only if needed. + (Fnetwork_interface_info): Fix pointer signedness. 2011-03-19 Paul Eggert diff --git a/src/process.c b/src/process.c index fb6dc95bb31..3cdf045f4f4 100644 --- a/src/process.c +++ b/src/process.c @@ -3950,7 +3950,7 @@ FLAGS is the current flags of the interface. */) CHECK_STRING (ifname); memset (rq.ifr_name, 0, sizeof rq.ifr_name); - strncpy (rq.ifr_name, SDATA (ifname), sizeof (rq.ifr_name)); + strncpy (rq.ifr_name, SSDATA (ifname), sizeof (rq.ifr_name)); s = socket (AF_INET, SOCK_STREAM, 0); if (s < 0) -- cgit v1.2.1 From f990b4e5d91b66e20f06cc0dab0b3f0ab97c3f91 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 19 Mar 2011 19:45:19 -0700 Subject: * process.c (process_send_signal): Add cast to avoid pointer signedness problem. --- src/ChangeLog | 1 + src/process.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 12a70ce9575..fa0ff89e5f7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -6,6 +6,7 @@ Rename or move locals. (Fmake_network_process): Define label "retry_connect" only if needed. (Fnetwork_interface_info): Fix pointer signedness. + (process_send_signal): Add cast to avoid pointer signedness problem. 2011-03-19 Paul Eggert diff --git a/src/process.c b/src/process.c index 3cdf045f4f4..ae7ec158ef9 100644 --- a/src/process.c +++ b/src/process.c @@ -5927,7 +5927,7 @@ process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group, if (sig_char && *sig_char != CDISABLE) { - send_process (proc, sig_char, 1, Qnil); + send_process (proc, (char *) sig_char, 1, Qnil); return; } /* If we can't send the signal with a character, -- cgit v1.2.1 From 7b8081265e19732eb3e0defde970e1ccfad5fbcc Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 19 Mar 2011 19:48:50 -0700 Subject: * process.c (FIRST_PROC_DESC, IF_NON_BLOCKING_CONNECT): Remove unused macros. --- src/ChangeLog | 1 + src/process.c | 9 --------- 2 files changed, 1 insertion(+), 9 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index fa0ff89e5f7..041d4b21754 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -7,6 +7,7 @@ (Fmake_network_process): Define label "retry_connect" only if needed. (Fnetwork_interface_info): Fix pointer signedness. (process_send_signal): Add cast to avoid pointer signedness problem. + (FIRST_PROC_DESC, IF_NON_BLOCKING_CONNECT): Remove unused macros. 2011-03-19 Paul Eggert diff --git a/src/process.c b/src/process.c index ae7ec158ef9..5bc1707756b 100644 --- a/src/process.c +++ b/src/process.c @@ -159,9 +159,6 @@ extern Lisp_Object QCfilter; #define SERIALCONN_P(p) (EQ (XPROCESS (p)->type, Qserial)) #define SERIALCONN1_P(p) (EQ ((p)->type, Qserial)) -/* Define first descriptor number available for subprocesses. */ -#define FIRST_PROC_DESC 3 - #ifndef HAVE_H_ERRNO extern int h_errno; #endif @@ -278,10 +275,6 @@ static SELECT_TYPE connect_wait_mask; /* Number of bits set in connect_wait_mask. */ static int num_pending_connects; - -#define IF_NON_BLOCKING_CONNECT(s) s -#else /* NON_BLOCKING_CONNECT */ -#define IF_NON_BLOCKING_CONNECT(s) #endif /* NON_BLOCKING_CONNECT */ /* The largest descriptor currently in use for a process object. */ @@ -4930,8 +4923,6 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd, d->func (channel, d->data, 0); } - /* Really FIRST_PROC_DESC should be 0 on Unix, - but this is safer in the short run. */ for (channel = 0; channel <= max_process_desc; channel++) { if (FD_ISSET (channel, &Available) -- cgit v1.2.1 From 12d8b6ab59c4a70a7af46361dc4ff05308982a54 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 19 Mar 2011 20:07:54 -0700 Subject: * process.c (create_process): Use 'volatile' to avoid vfork clobbering. --- src/ChangeLog | 1 + src/process.c | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 041d4b21754..bc306f20578 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -8,6 +8,7 @@ (Fnetwork_interface_info): Fix pointer signedness. (process_send_signal): Add cast to avoid pointer signedness problem. (FIRST_PROC_DESC, IF_NON_BLOCKING_CONNECT): Remove unused macros. + (create_process): Use 'volatile' to avoid vfork clobbering. 2011-03-19 Paul Eggert diff --git a/src/process.c b/src/process.c index 5bc1707756b..5ee731a5bd3 100644 --- a/src/process.c +++ b/src/process.c @@ -1912,8 +1912,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) /* child_setup must clobber environ on systems with true vfork. Protect it from permanent change. */ char **save_environ = environ; - - current_dir = ENCODE_FILE (current_dir); + volatile Lisp_Object encoded_current_dir = ENCODE_FILE (current_dir); #ifndef WINDOWSNT pid = vfork (); @@ -2054,13 +2053,13 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) child_setup_tty (xforkout); #ifdef WINDOWSNT pid = child_setup (xforkin, xforkout, xforkout, - new_argv, 1, current_dir); + new_argv, 1, encoded_current_dir); #else /* not WINDOWSNT */ #ifdef FD_CLOEXEC emacs_close (wait_child_setup[0]); #endif child_setup (xforkin, xforkout, xforkout, - new_argv, 1, current_dir); + new_argv, 1, encoded_current_dir); #endif /* not WINDOWSNT */ } environ = save_environ; -- cgit v1.2.1 From c939f91b4d9d7830daf4e17cacbab1709ce9949d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 19 Mar 2011 22:15:59 -0700 Subject: Add Bug#8298. --- src/ChangeLog | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index bc306f20578..744d3ef53f0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -8,7 +8,7 @@ (Fnetwork_interface_info): Fix pointer signedness. (process_send_signal): Add cast to avoid pointer signedness problem. (FIRST_PROC_DESC, IF_NON_BLOCKING_CONNECT): Remove unused macros. - (create_process): Use 'volatile' to avoid vfork clobbering. + (create_process): Use 'volatile' to avoid vfork clobbering (Bug#8298). 2011-03-19 Paul Eggert @@ -75,7 +75,8 @@ * region-cache.h (pp_cache): New decl, for gcc -Wmissing-prototypes. - * callproc.c (Fcall_process): Use 'volatile' to avoid vfork clobbering. + * callproc.c (Fcall_process): Use 'volatile' to avoid vfork + clobbering (Bug#8298). * sysdep.c (sys_subshell): Likewise. Previously, the sys_subshell 'volatile' was incorrectly IF_LINTted out. -- cgit v1.2.1 From 6a90a4f1982c25213ec70637b52462674c2564bd Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 20 Mar 2011 09:28:22 -0700 Subject: Merge from gnulib, for socklen_t. --- src/config.in | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/config.in b/src/config.in index 8b7312faaaa..b24aacd4e54 100644 --- a/src/config.in +++ b/src/config.in @@ -833,6 +833,9 @@ along with GNU Emacs. If not, see . */ /* Define to 1 if `vfork' works. */ #undef HAVE_WORKING_VFORK +/* Define to 1 if you have the header file. */ +#undef HAVE_WS2TCPIP_H + /* Define to 1 if you want to use version 11 of X windows. Otherwise, Emacs expects to use version 10. */ #undef HAVE_X11 -- cgit v1.2.1 From dc1ca6a87f1e100a054b0e5eab64da30dc5cad6f Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 20 Mar 2011 14:03:44 -0700 Subject: * emacs.c (Fdaemon_initialized): Do not ignore I/O errors. --- src/ChangeLog | 2 ++ src/emacs.c | 17 +++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 0b2a0d44c5f..82213687708 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-20 Paul Eggert + * emacs.c (Fdaemon_initialized): Do not ignore I/O errors. + * process.c (Fmake_network_process): Use socklen_t, not int, where POSIX says socklen_t is required in portable programs. This fixes a porting bug on hosts like 64-bit HP-UX, where 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. */) (void) { int nfd; + int err = 0; if (!IS_DAEMON) 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. */) /* Get rid of stdin, stdout and stderr. */ nfd = open ("/dev/null", O_RDWR); - dup2 (nfd, 0); - dup2 (nfd, 1); - dup2 (nfd, 2); - close (nfd); + err |= nfd < 0; + err |= dup2 (nfd, 0) < 0; + err |= dup2 (nfd, 1) < 0; + err |= dup2 (nfd, 2) < 0; + err |= close (nfd) != 0; /* Closing the pipe will notify the parent that it can exit. 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. */) Instead, we should probably close the pipe in start-process and call-process to make sure the pipe is never inherited by subprocesses. */ - write (daemon_pipe[1], "\n", 1); - close (daemon_pipe[1]); + err |= write (daemon_pipe[1], "\n", 1) < 0; + err |= close (daemon_pipe[1]) != 0; /* Set it to an invalid value so we know we've already run this function. */ daemon_pipe[1] = -1; + + if (err) + error ("I/O error during daemon initialization"); return Qt; } -- cgit v1.2.1 From 699979fc4c93ec11005da00e983af08078831e44 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 20 Mar 2011 16:56:23 -0700 Subject: Add Bug#. --- src/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 82213687708..c97331a78e5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,6 @@ 2011-03-20 Paul Eggert - * emacs.c (Fdaemon_initialized): Do not ignore I/O errors. + * emacs.c (Fdaemon_initialized): Do not ignore I/O errors (Bug#8303). * process.c (Fmake_network_process): Use socklen_t, not int, where POSIX says socklen_t is required in portable programs. -- cgit v1.2.1 From 81e56e612dab7d80485c640068531710a713d205 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 20 Mar 2011 19:40:27 -0700 Subject: * fileio.c (Fcopy_file): Report error if fchown or fchmod fail. --- src/ChangeLog | 4 ++++ src/fileio.c | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index c97331a78e5..fdf57152294 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2011-03-21 Paul Eggert + + * fileio.c (Fcopy_file): Report error if fchown or fchmod fail. + 2011-03-20 Paul Eggert * emacs.c (Fdaemon_initialized): Do not ignore I/O errors (Bug#8303). 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. */) owner and group. */ if (input_file_statable_p) { - if (! NILP (preserve_uid_gid)) - fchown (ofd, st.st_uid, st.st_gid); - fchmod (ofd, st.st_mode & 07777); + if (!NILP (preserve_uid_gid) && fchown (ofd, st.st_uid, st.st_gid) != 0) + report_file_error ("Doing chown", Fcons (newname, Qnil)); + if (fchmod (ofd, st.st_mode & 07777) != 0) + report_file_error ("Doing chmod", Fcons (newname, Qnil)); } #endif /* not MSDOS */ -- cgit v1.2.1 From 37dd57d1e53ffb2d9dee6cc66d807e6d2575ef57 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 20 Mar 2011 22:50:24 -0700 Subject: Add Bug#. --- src/ChangeLog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 26e343ddde4..f8ccbfd1f3c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,7 @@ 2011-03-21 Paul Eggert - * fileio.c (Fcopy_file): Report error if fchown or fchmod fail. + * fileio.c (Fcopy_file): Report error if fchown or fchmod + fail (Bug#8306). * emacs.c (Fdaemon_initialized): Do not ignore I/O errors (Bug#8303). -- cgit v1.2.1 From 7f650bb9a878f4ce87828bf068edd9d2b5ca032e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 21 Mar 2011 11:09:45 -0700 Subject: * frame.c (Fmodify_frame_parameters): Simplify loop counter. This also avoids a warning with gcc -Wstrict-overflow. --- src/ChangeLog | 3 +++ src/frame.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index f8ccbfd1f3c..d833648667d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-21 Paul Eggert + * frame.c (Fmodify_frame_parameters): Simplify loop counter. + This also avoids a warning with gcc -Wstrict-overflow. + * fileio.c (Fcopy_file): Report error if fchown or fchmod fail (Bug#8306). diff --git a/src/frame.c b/src/frame.c index 05938f3e1f0..5c676527909 100644 --- a/src/frame.c +++ b/src/frame.c @@ -2529,8 +2529,9 @@ use is not recommended. Explicitly check for a frame-parameter instead. */) } /* Now process them in reverse of specified order. */ - for (i--; i >= 0; i--) + while (i != 0) { + i--; prop = parms[i]; val = values[i]; store_frame_param (f, prop, val); -- cgit v1.2.1 From 5ffe6683c36bdaed21324ddd59cb47aecadea8ea Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 21 Mar 2011 11:11:03 -0700 Subject: Better version of previous patch. --- src/frame.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/frame.c b/src/frame.c index 5c676527909..60f192e9817 100644 --- a/src/frame.c +++ b/src/frame.c @@ -2529,9 +2529,8 @@ use is not recommended. Explicitly check for a frame-parameter instead. */) } /* Now process them in reverse of specified order. */ - while (i != 0) + while (--i >= 0) { - i--; prop = parms[i]; val = values[i]; store_frame_param (f, prop, val); -- cgit v1.2.1 From 39f5e5198f666c1a00b9df957a17b2c3fe11a9ae Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 21 Mar 2011 11:12:38 -0700 Subject: * frame.c (validate_x_resource_name): Simplify count usage. This also avoids a warning with gcc -Wstrict-overflow. --- src/ChangeLog | 2 ++ src/frame.c | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d833648667d..34104669a53 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,6 +2,8 @@ * frame.c (Fmodify_frame_parameters): Simplify loop counter. This also avoids a warning with gcc -Wstrict-overflow. + (validate_x_resource_name): Simplify count usage. + This also avoids a warning with gcc -Wstrict-overflow. * fileio.c (Fcopy_file): Report error if fchown or fchmod fail (Bug#8306). diff --git a/src/frame.c b/src/frame.c index 60f192e9817..3e00e1bf107 100644 --- a/src/frame.c +++ b/src/frame.c @@ -3713,8 +3713,7 @@ validate_x_resource_name (void) return; /* If name is entirely invalid, or nearly so, use `emacs'. */ - if (good_count == 0 - || (good_count == 1 && bad_count > 0)) + if (good_count < 2) { Vx_resource_name = build_string ("emacs"); return; -- cgit v1.2.1 From f0641eff4f15f93287576f9902e4657af4fdd3e3 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 22 Mar 2011 00:48:10 -0700 Subject: * scroll.c (do_scrolling): Work around GCC bug 48228. See . --- src/ChangeLog | 5 +++++ src/scroll.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 34104669a53..d491d089514 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2011-03-22 Paul Eggert + + * scroll.c (do_scrolling): Work around GCC bug 48228. + See . + 2011-03-21 Paul Eggert * frame.c (Fmodify_frame_parameters): Simplify loop counter. 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 int i, j, k; /* Set to 1 if we have set a terminal window with - set_terminal_window. */ - int terminal_window_p = 0; + set_terminal_window. It's unsigned to work around GCC bug 48228. */ + unsigned int terminal_window_p = 0; /* A queue for line insertions to be done. */ struct queue { int count, pos; }; -- cgit v1.2.1 From 19ab8a188aed3904edb0cfa026503c4d63c57c5a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 22 Mar 2011 01:10:11 -0700 Subject: * xdisp.c (message_log_check_duplicate): Return unsigned long, not int. This is less likely to overflow, and avoids undefined behavior if overflow does occur. All callers changed. Use strtoul to scan for the unsigned long integer. --- src/ChangeLog | 5 +++++ src/xdisp.c | 17 ++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d491d089514..a9f3e3a5b70 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2011-03-22 Paul Eggert + * xdisp.c (message_log_check_duplicate): Return unsigned long, not int. + This is less likely to overflow, and avoids undefined behavior if + overflow does occur. All callers changed. Use strtoul to scan + for the unsigned long integer. + * scroll.c (do_scrolling): Work around GCC bug 48228. See . diff --git a/src/xdisp.c b/src/xdisp.c index a7955f41e0c..93bc8c9479e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -802,8 +802,8 @@ static int cursor_row_fully_visible_p (struct window *, int, int); static int try_scrolling (Lisp_Object, int, EMACS_INT, EMACS_INT, int, int); static int try_cursor_movement (Lisp_Object, struct text_pos, int *); static int trailing_whitespace_p (EMACS_INT); -static int message_log_check_duplicate (EMACS_INT, EMACS_INT, - EMACS_INT, EMACS_INT); +static unsigned long int message_log_check_duplicate (EMACS_INT, EMACS_INT, + EMACS_INT, EMACS_INT); static void push_it (struct it *); static void pop_it (struct it *); 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) if (nlflag) { EMACS_INT this_bol, this_bol_byte, prev_bol, prev_bol_byte; - int dups; + unsigned long int dups; insert_1 ("\n", 1, 1, 0, 0); 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) /* If you change this format, don't forget to also change message_log_check_duplicate. */ - sprintf (dupstr, " [%d times]", dups); + sprintf (dupstr, " [%lu times]", dups); duplen = strlen (dupstr); TEMP_SET_PT_BOTH (Z - 1, Z_BYTE - 1); insert_1 (dupstr, duplen, 1, 0, 1); @@ -8063,7 +8063,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte) Return 0 if different, 1 if the new one should just replace it, or a value N > 1 if we should also append " [N times]". */ -static int +static unsigned long int message_log_check_duplicate (EMACS_INT prev_bol, EMACS_INT prev_bol_byte, EMACS_INT this_bol, EMACS_INT this_bol_byte) { @@ -8085,10 +8085,9 @@ message_log_check_duplicate (EMACS_INT prev_bol, EMACS_INT prev_bol_byte, return 2; if (*p1++ == ' ' && *p1++ == '[') { - int n = 0; - while (*p1 >= '0' && *p1 <= '9') - n = n * 10 + *p1++ - '0'; - if (strncmp ((char *) p1, " times]\n", 8) == 0) + char *pend; + unsigned long int n = strtoul ((char *) p1, &pend, 10); + if (strncmp (pend, " times]\n", 8) == 0) return n+1; } return 0; -- cgit v1.2.1 From b7cbbd6f018241962b432c1a608067614d223a6d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 22 Mar 2011 01:15:43 -0700 Subject: * xdisp.c (pint2hrstr): Simplify and tune code slightly. This also avoids a (bogus) GCC warning with gcc -Wstrict-overflow. --- src/ChangeLog | 2 ++ src/xdisp.c | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index a9f3e3a5b70..fd135de123b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -4,6 +4,8 @@ This is less likely to overflow, and avoids undefined behavior if overflow does occur. All callers changed. Use strtoul to scan for the unsigned long integer. + (pint2hrstr): Simplify and tune code slightly. + This also avoids a (bogus) GCC warning with gcc -Wstrict-overflow. * scroll.c (do_scrolling): Work around GCC bug 48228. See . diff --git a/src/xdisp.c b/src/xdisp.c index 93bc8c9479e..457a5e3e11b 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -19006,7 +19006,7 @@ pint2str (register char *buf, register int width, register EMACS_INT d) static const char power_letter[] = { - 0, /* not used */ + 0, /* no letter */ 'k', /* kilo */ 'M', /* mega */ 'G', /* giga */ @@ -19088,8 +19088,7 @@ pint2hrstr (char *buf, int width, int d) p = psuffix = buf + max (width, length); /* Print EXPONENT. */ - if (exponent) - *psuffix++ = power_letter[exponent]; + *psuffix++ = power_letter[exponent]; *psuffix = '\0'; /* Print TENTHS. */ -- cgit v1.2.1 From 916c72e97a711e6d0f571a507634e4f795fbaf6c Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 22 Mar 2011 01:59:50 -0700 Subject: * xmenu.c (set_frame_menubar): Use EMACS_UINT, not int, for indexes that could (at least in theory) be that large. --- src/ChangeLog | 3 +++ src/xmenu.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index fd135de123b..c8fa1e55695 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-22 Paul Eggert + * xmenu.c (set_frame_menubar): Use EMACS_UINT, not int, for indexes + that could (at least in theory) be that large. + * xdisp.c (message_log_check_duplicate): Return unsigned long, not int. This is less likely to overflow, and avoids undefined behavior if overflow does occur. All callers changed. Use strtoul to scan 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) #endif Lisp_Object items; widget_value *wv, *first_wv, *prev_wv = 0; - int i, last_i = 0; + EMACS_UINT i, last_i = 0; int *submenu_start, *submenu_end; int *submenu_top_level_items, *submenu_n_panes; -- cgit v1.2.1 From a2d26660368fbe4cc7d103aad6f565e36a280fac Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 22 Mar 2011 02:08:11 -0700 Subject: * lisp.h (SAFE_ALLOCA, SAFE_ALLOCA_LISP): Avoid 'int' overflow leading to a memory leak, possible in functions like load_charset_map_from_file that can allocate an unbounded number of objects. --- src/ChangeLog | 5 +++++ src/lisp.h | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index c8fa1e55695..a341d1b4678 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2011-03-22 Paul Eggert + * lisp.h (SAFE_ALLOCA, SAFE_ALLOCA_LISP): Avoid 'int' overflow + leading to a memory leak, possible in functions like + load_charset_map_from_file that can allocate an unbounded number + of objects. + * xmenu.c (set_frame_menubar): Use EMACS_UINT, not int, for indexes that could (at least in theory) be that large. diff --git a/src/lisp.h b/src/lisp.h index 645b82c80cf..e98172ec104 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3602,7 +3602,7 @@ extern Lisp_Object safe_alloca_unwind (Lisp_Object); else \ { \ buf = (type) xmalloc (size); \ - sa_must_free++; \ + sa_must_free = 1; \ record_unwind_protect (safe_alloca_unwind, \ make_save_value (buf, 0)); \ } \ @@ -3632,7 +3632,7 @@ extern Lisp_Object safe_alloca_unwind (Lisp_Object); buf = (Lisp_Object *) xmalloc (size_); \ arg_ = make_save_value (buf, nelt); \ XSAVE_VALUE (arg_)->dogc = 1; \ - sa_must_free++; \ + sa_must_free = 1; \ record_unwind_protect (safe_alloca_unwind, arg_); \ } \ } while (0) -- cgit v1.2.1 From 8abc3f12955673bdb367b2de5556ff66f202d2d0 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 22 Mar 2011 09:20:45 -0700 Subject: * coding.c (encode_coding_raw_text): Avoid unnecessary test the first time through the loop, since we know p0 < p1 then. This also avoids a gcc -Wstrict-overflow warning. --- src/ChangeLog | 4 ++++ src/coding.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index a341d1b4678..45982f607f4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2011-03-22 Paul Eggert + * coding.c (encode_coding_raw_text): Avoid unnecessary test + the first time through the loop, since we know p0 < p1 then. + This also avoids a gcc -Wstrict-overflow warning. + * lisp.h (SAFE_ALLOCA, SAFE_ALLOCA_LISP): Avoid 'int' overflow leading to a memory leak, possible in functions like load_charset_map_from_file that can allocate an unbounded number 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) unsigned char str[MAX_MULTIBYTE_LENGTH], *p0 = str, *p1 = str; CHAR_STRING_ADVANCE (c, p1); - while (p0 < p1) + do { EMIT_ONE_BYTE (*p0); p0++; } + while (p0 < p1); } } else -- cgit v1.2.1 From b12ef4116793ce9cc422c22d98b02261995df143 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 22 Mar 2011 09:43:12 -0700 Subject: Add Bug# --- src/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 45982f607f4..7e9bec9b6e9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -7,7 +7,7 @@ * lisp.h (SAFE_ALLOCA, SAFE_ALLOCA_LISP): Avoid 'int' overflow leading to a memory leak, possible in functions like load_charset_map_from_file that can allocate an unbounded number - of objects. + of objects (Bug#8318). * xmenu.c (set_frame_menubar): Use EMACS_UINT, not int, for indexes that could (at least in theory) be that large. -- cgit v1.2.1 From c59da222fa57399540a7c3d13c88209336cc5d01 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Tue, 22 Mar 2011 14:15:52 -0400 Subject: Remove an apparently unnecessary XClearWindow call. * src/xterm.c (x_clear_frame): Remove XClearWindow call. This appears not to be necessary, and produces flickering. --- src/ChangeLog | 5 +++++ src/xterm.c | 10 +++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 6fa2d821565..f489a233683 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2011-03-22 Chong Yidong + + * xterm.c (x_clear_frame): Remove XClearWindow call. This appears + not to be necessary, and produces flickering. + 2011-03-20 Glenn Morris * config.in: Remove file. diff --git a/src/xterm.c b/src/xterm.c index fd7ffd68e62..f87c22912a4 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -2928,10 +2928,14 @@ x_clear_frame (struct frame *f) /* We don't set the output cursor here because there will always follow an explicit cursor_to. */ BLOCK_INPUT; - XClearWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); - /* We have to clear the scroll bars, too. If we have changed - colors or something like that, then they should be notified. */ + /* The following calls have been commented out because they do not + seem to accomplish anything, apart from causing flickering during + window resize. */ + /* XClearWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); */ + + /* We have to clear the scroll bars. If we have changed colors or + something like that, then they should be notified. */ x_scroll_bar_clear (f); #if defined (USE_GTK) && defined (USE_TOOLKIT_SCROLL_BARS) -- cgit v1.2.1 From b9b4b7cb4c27f9f6ad644168f0e1241e5c0d6eaa Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 22 Mar 2011 17:53:37 -0700 Subject: Merge removals from trunk. --- src/config.in | 1400 --------------------------------------------------------- 1 file changed, 1400 deletions(-) delete mode 100644 src/config.in (limited to 'src') diff --git a/src/config.in b/src/config.in deleted file mode 100644 index b24aacd4e54..00000000000 --- a/src/config.in +++ /dev/null @@ -1,1400 +0,0 @@ -/* src/config.in. Generated from configure.in by autoheader. */ - -/* GNU Emacs site configuration template file. - -Copyright (C) 1988, 1993-1994, 1999-2002, 2004-2011 - Free Software Foundation, Inc. - -This file is part of GNU Emacs. - -GNU Emacs is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -GNU Emacs is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Emacs. If not, see . */ - - -/* No code in Emacs #includes config.h twice, but some bits of code - intended to work with other packages as well (like gmalloc.c) - think they can include it as many times as they like. */ -#ifndef EMACS_CONFIG_H -#define EMACS_CONFIG_H - - -/* Define if building universal (internal helper macro) */ -#undef AC_APPLE_UNIVERSAL_BUILD - -/* Define to the number of bits in type 'ptrdiff_t'. */ -#undef BITSIZEOF_PTRDIFF_T - -/* Define to the number of bits in type 'sig_atomic_t'. */ -#undef BITSIZEOF_SIG_ATOMIC_T - -/* Define to the number of bits in type 'size_t'. */ -#undef BITSIZEOF_SIZE_T - -/* Define to the number of bits in type 'wchar_t'. */ -#undef BITSIZEOF_WCHAR_T - -/* Define to the number of bits in type 'wint_t'. */ -#undef BITSIZEOF_WINT_T - -/* Define if Emacs cannot be dumped on your system. */ -#undef CANNOT_DUMP - -/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP - systems. This function is required for `alloca.c' support on those systems. - */ -#undef CRAY_STACKSEG_END - -/* Define to 1 if using `alloca.c'. */ -#undef C_ALLOCA - -/* Define to 1 for DGUX with . */ -#undef DGUX - -/* Define to 1 if you are using the GNU C Library. */ -#undef DOUG_LEA_MALLOC - -/* Define to the canonical Emacs configuration name. */ -#undef EMACS_CONFIGURATION - -/* Define to the options passed to configure. */ -#undef EMACS_CONFIG_OPTIONS - -/* Enable expensive run-time checking of data types? */ -#undef ENABLE_CHECKING - -/* Define this to check for errors in cons list. */ -#undef GC_CHECK_CONS_LIST - -/* Define this temporarily to hunt a bug. If defined, the size of strings is - redundantly recorded in sdata structures so that it can be compared to the - sizes recorded in Lisp strings. */ -#undef GC_CHECK_STRING_BYTES - -/* Define this to check the string free list. */ -#undef GC_CHECK_STRING_FREE_LIST - -/* Define this to check for short string overrun. */ -#undef GC_CHECK_STRING_OVERRUN - -/* Define to 1 if the `getpgrp' function requires zero arguments. */ -#undef GETPGRP_VOID - -/* Define to 1 if gettimeofday accepts only one argument. */ -#undef GETTIMEOFDAY_ONE_ARGUMENT - -/* Define to 1 if you want to use the GNU memory allocator. */ -#undef GNU_MALLOC - -/* Define to 1 if the file /usr/lpp/X11/bin/smt.exp exists. */ -#undef HAVE_AIX_SMT_EXP - -/* Define to 1 if you have the `alarm' function. */ -#undef HAVE_ALARM - -/* Define to 1 if you have `alloca', as a function or macro. */ -#undef HAVE_ALLOCA - -/* Define to 1 if you have and it should be used (not on Ultrix). - */ -#undef HAVE_ALLOCA_H - -/* Define to 1 if ALSA is available. */ -#undef HAVE_ALSA - -/* Define to 1 if GCC-style __attribute__ ((__aligned__ (expr))) works. */ -#undef HAVE_ATTRIBUTE_ALIGNED - -/* Define to 1 if strtold conforms to C99. */ -#undef HAVE_C99_STRTOLD - -/* Define to 1 if you have the `cbrt' function. */ -#undef HAVE_CBRT - -/* Define to 1 if you have the `cfmakeraw' function. */ -#undef HAVE_CFMAKERAW - -/* Define to 1 if you have the `cfsetspeed' function. */ -#undef HAVE_CFSETSPEED - -/* Define to 1 if you have the `closedir' function. */ -#undef HAVE_CLOSEDIR - -/* Define to 1 if you have the header file. */ -#undef HAVE_COFF_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_COM_ERR_H - -/* Define to 1 if you have the `copysign' function. */ -#undef HAVE_COPYSIGN - -/* Define to 1 if using D-Bus. */ -#undef HAVE_DBUS - -/* Define to 1 if you have the `dbus_watch_get_unix_fd' function. */ -#undef HAVE_DBUS_WATCH_GET_UNIX_FD - -/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't. - */ -#undef HAVE_DECL_GETENV - -/* Define to 1 if you have the declaration of `localtime_r', and to 0 if you - don't. */ -#undef HAVE_DECL_LOCALTIME_R - -/* Define to 1 if you have the declaration of `strmode', and to 0 if you - don't. */ -#undef HAVE_DECL_STRMODE - -/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you - don't. */ -#undef HAVE_DECL_SYS_SIGLIST - -/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't. - */ -#undef HAVE_DECL_TZNAME - -/* Define to 1 if you have the declaration of `__sys_siglist', and to 0 if you - don't. */ -#undef HAVE_DECL___SYS_SIGLIST - -/* Define to 1 if you have the header file. */ -#undef HAVE_DES_H - -/* Define to 1 if dynamic ptys are supported. */ -#undef HAVE_DEV_PTMX - -/* Define to 1 if you have the `difftime' function. */ -#undef HAVE_DIFFTIME - -/* Define to 1 if you have the header file. */ -#undef HAVE_DIRENT_H - -/* Define to 1 if you have the `dup2' function. */ -#undef HAVE_DUP2 - -/* Define to 1 if you have the `euidaccess' function. */ -#undef HAVE_EUIDACCESS - -/* Define to 1 if you have the header file. */ -#undef HAVE_FCNTL_H - -/* Define to 1 if you have the `fmod' function. */ -#undef HAVE_FMOD - -/* Define to 1 if you have the `fork' function. */ -#undef HAVE_FORK - -/* Define to 1 if you have the `fpathconf' function. */ -#undef HAVE_FPATHCONF - -/* Define to 1 if using the freetype and fontconfig libraries. */ -#undef HAVE_FREETYPE - -/* Define to 1 if you have the `frexp' function. */ -#undef HAVE_FREXP - -/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ -#undef HAVE_FSEEKO - -/* Define to 1 if you have the `fsync' function. */ -#undef HAVE_FSYNC - -/* Define to 1 if you have the `ftime' function. */ -#undef HAVE_FTIME - -/* Define to 1 if you have the `gai_strerror' function. */ -#undef HAVE_GAI_STRERROR - -/* Define to 1 if using GConf. */ -#undef HAVE_GCONF - -/* Define to 1 if you have the `getaddrinfo' function. */ -#undef HAVE_GETADDRINFO - -/* Define to 1 if you have the `getcwd' function. */ -#undef HAVE_GETCWD - -/* Define to 1 if you have the `getdelim' function. */ -#undef HAVE_GETDELIM - -/* Define to 1 if you have the `getdomainname' function. */ -#undef HAVE_GETDOMAINNAME - -/* Define to 1 if you have the `gethostname' function. */ -#undef HAVE_GETHOSTNAME - -/* Define to 1 if you have the `getline' function. */ -#undef HAVE_GETLINE - -/* Define to 1 if you have the header file. */ -#undef HAVE_GETOPT_H - -/* Define to 1 if you have the `getopt_long_only' function. */ -#undef HAVE_GETOPT_LONG_ONLY - -/* Define to 1 if you have the `getpagesize' function. */ -#undef HAVE_GETPAGESIZE - -/* Define to 1 if you have the `getpeername' function. */ -#undef HAVE_GETPEERNAME - -/* Define to 1 if you have the `getpt' function. */ -#undef HAVE_GETPT - -/* Define to 1 if you have the `getrlimit' function. */ -#undef HAVE_GETRLIMIT - -/* Define to 1 if you have the `getrusage' function. */ -#undef HAVE_GETRUSAGE - -/* Define to 1 if you have the `getsockname' function. */ -#undef HAVE_GETSOCKNAME - -/* Define to 1 if you have the `getsockopt' function. */ -#undef HAVE_GETSOCKOPT - -/* Define to 1 if you have the `gettimeofday' function. */ -#undef HAVE_GETTIMEOFDAY - -/* Define to 1 if you have the `getwd' function. */ -#undef HAVE_GETWD - -/* Define to 1 if you have the `get_current_dir_name' function. */ -#undef HAVE_GET_CURRENT_DIR_NAME - -/* Define to 1 if you have a gif (or ungif) library. */ -#undef HAVE_GIF - -/* Define if using GnuTLS. */ -#undef HAVE_GNUTLS - -/* Define to 1 if you have the gpm library (-lgpm). */ -#undef HAVE_GPM - -/* Define to 1 if you have the `grantpt' function. */ -#undef HAVE_GRANTPT - -/* Define to 1 if using GTK 3 or later. */ -#undef HAVE_GTK3 - -/* Define to 1 if you have the `gtk_adjustment_get_page_size' function. */ -#undef HAVE_GTK_ADJUSTMENT_GET_PAGE_SIZE - -/* Define to 1 if you have GTK and pthread (-lpthread). */ -#undef HAVE_GTK_AND_PTHREAD - -/* Define to 1 if you have the `gtk_dialog_get_action_area' function. */ -#undef HAVE_GTK_DIALOG_GET_ACTION_AREA - -/* Define to 1 if you have the `gtk_file_selection_new' function. */ -#undef HAVE_GTK_FILE_SELECTION_NEW - -/* Define to 1 if you have the `gtk_main' function. */ -#undef HAVE_GTK_MAIN - -/* Define to 1 if you have the `gtk_orientable_set_orientation' function. */ -#undef HAVE_GTK_ORIENTABLE_SET_ORIENTATION - -/* Define to 1 if you have the `gtk_widget_get_mapped' function. */ -#undef HAVE_GTK_WIDGET_GET_MAPPED - -/* Define to 1 if you have the `gtk_widget_get_sensitive' function. */ -#undef HAVE_GTK_WIDGET_GET_SENSITIVE - -/* Define to 1 if you have the `gtk_widget_get_window' function. */ -#undef HAVE_GTK_WIDGET_GET_WINDOW - -/* Define to 1 if you have the `gtk_widget_set_has_window' function. */ -#undef HAVE_GTK_WIDGET_SET_HAS_WINDOW - -/* Define to 1 if you have the `g_type_init' function. */ -#undef HAVE_G_TYPE_INIT - -/* Define to 1 if netdb.h declares h_errno. */ -#undef HAVE_H_ERRNO - -/* Define to 1 if using imagemagick. */ -#undef HAVE_IMAGEMAGICK - -/* Define to 1 if you have inet sockets. */ -#undef HAVE_INET_SOCKETS - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the `isnan' function. */ -#undef HAVE_ISNAN - -/* Define to 1 if you have the jpeg library (-ljpeg). */ -#undef HAVE_JPEG - -/* Define to 1 if you have the header file. */ -#undef HAVE_KERBEROSIV_DES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_KERBEROSIV_KRB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_KERBEROS_DES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_KERBEROS_KRB_H - -/* Define to 1 if `e_text' is a member of `krb5_error'. */ -#undef HAVE_KRB5_ERROR_E_TEXT - -/* Define to 1 if `text' is a member of `krb5_error'. */ -#undef HAVE_KRB5_ERROR_TEXT - -/* Define to 1 if you have the header file. */ -#undef HAVE_KRB5_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_KRB_H - -/* Define if you have and nl_langinfo(CODESET). */ -#undef HAVE_LANGINFO_CODESET - -/* Define to 1 if you have the `com_err' library (-lcom_err). */ -#undef HAVE_LIBCOM_ERR - -/* Define to 1 if you have the `crypto' library (-lcrypto). */ -#undef HAVE_LIBCRYPTO - -/* Define to 1 if you have the `des' library (-ldes). */ -#undef HAVE_LIBDES - -/* Define to 1 if you have the `des425' library (-ldes425). */ -#undef HAVE_LIBDES425 - -/* Define to 1 if you have the `dgc' library (-ldgc). */ -#undef HAVE_LIBDGC - -/* Define to 1 if you have the `dnet' library (-ldnet). */ -#undef HAVE_LIBDNET - -/* Define to 1 if you have the hesiod library (-lhesiod). */ -#undef HAVE_LIBHESIOD - -/* Define to 1 if you have the `intl' library (-lintl). */ -#undef HAVE_LIBINTL - -/* Define to 1 if you have the `k5crypto' library (-lk5crypto). */ -#undef HAVE_LIBK5CRYPTO - -/* Define to 1 if you have the `krb' library (-lkrb). */ -#undef HAVE_LIBKRB - -/* Define to 1 if you have the `krb4' library (-lkrb4). */ -#undef HAVE_LIBKRB4 - -/* Define to 1 if you have the `krb5' library (-lkrb5). */ -#undef HAVE_LIBKRB5 - -/* Define to 1 if you have the `kstat' library (-lkstat). */ -#undef HAVE_LIBKSTAT - -/* Define to 1 if you have the `lockfile' library (-llockfile). */ -#undef HAVE_LIBLOCKFILE - -/* Define to 1 if you have the `m' library (-lm). */ -#undef HAVE_LIBM - -/* Define to 1 if you have the `mail' library (-lmail). */ -#undef HAVE_LIBMAIL - -/* Define to 1 if you have the `ncurses' library (-lncurses). */ -#undef HAVE_LIBNCURSES - -/* Define to 1 if using libotf. */ -#undef HAVE_LIBOTF - -/* Define to 1 if you have the `perfstat' library (-lperfstat). */ -#undef HAVE_LIBPERFSTAT - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIBPNG_PNG_H - -/* Define to 1 if you have the `pthreads' library (-lpthreads). */ -#undef HAVE_LIBPTHREADS - -/* Define to 1 if you have the resolv library (-lresolv). */ -#undef HAVE_LIBRESOLV - -/* Define to 1 if using SELinux. */ -#undef HAVE_LIBSELINUX - -/* Define to 1 if you have the `Xext' library (-lXext). */ -#undef HAVE_LIBXEXT - -/* Define to 1 if you have the libxml library (-lxml2). */ -#undef HAVE_LIBXML2 - -/* Define to 1 if you have the `Xmu' library (-lXmu). */ -#undef HAVE_LIBXMU - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIMITS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_VERSION_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LOCALE_H - -/* Define to 1 if you have the `localtime_r' function. */ -#undef HAVE_LOCALTIME_R - -/* Define to 1 if you have the `logb' function. */ -#undef HAVE_LOGB - -/* Define to 1 if you support file names longer than 14 characters. */ -#undef HAVE_LONG_FILE_NAMES - -/* Define to 1 if the system has the type `long long int'. */ -#undef HAVE_LONG_LONG_INT - -/* Define to 1 if you have the `lrand48' function. */ -#undef HAVE_LRAND48 - -/* Define to 1 if you have the `lstat' function. */ -#undef HAVE_LSTAT - -/* Define to 1 if using libm17n-flt. */ -#undef HAVE_M17N_FLT - -/* Define to 1 if you have the header file. */ -#undef HAVE_MACHINE_SOUNDCARD_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MACH_MACH_H - -/* Define to 1 if you have the `MagickExportImagePixels' function. */ -#undef HAVE_MAGICKEXPORTIMAGEPIXELS - -/* Define to 1 if you have the header file. */ -#undef HAVE_MAILLOCK_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MALLOC_MALLOC_H - -/* Define to 1 if you have the `mblen' function. */ -#undef HAVE_MBLEN - -/* Define to 1 if you have the `mbrlen' function. */ -#undef HAVE_MBRLEN - -/* Define to 1 if you have the `mbsinit' function. */ -#undef HAVE_MBSINIT - -/* Define to 1 if declares mbstate_t. */ -#undef HAVE_MBSTATE_T - -/* Define to 1 if you have the `memcmp' function. */ -#undef HAVE_MEMCMP - -/* Define to 1 if you have the `memcpy' function. */ -#undef HAVE_MEMCPY - -/* Define to 1 if you have the `memmove' function. */ -#undef HAVE_MEMMOVE - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the `mempcpy' function. */ -#undef HAVE_MEMPCPY - -/* Define to 1 if you have the `memset' function. */ -#undef HAVE_MEMSET - -/* Define to 1 if you have mouse menus. (This is automatic if you use X, but - the option to specify it remains.) It is also defined with other window - systems that support xmenu.c. */ -#undef HAVE_MENUS - -/* Define to 1 if you have the `mkdir' function. */ -#undef HAVE_MKDIR - -/* Define to 1 if you have the `mkstemp' function. */ -#undef HAVE_MKSTEMP - -/* Define to 1 if you have a working `mmap' system call. */ -#undef HAVE_MMAP - -/* Define if you have mouse support. */ -#undef HAVE_MOUSE - -/* Define to 1 if you have the `mremap' function. */ -#undef HAVE_MREMAP - -/* Define to 1 if you have the header file. */ -#undef HAVE_NET_IF_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NLIST_H - -/* Define to 1 if you are using the NeXTstep API, either GNUstep or Cocoa on - Mac OS X. */ -#undef HAVE_NS - -/* Define to 1 if libotf has OTF_get_variation_glyphs. */ -#undef HAVE_OTF_GET_VARIATION_GLYPHS - -/* Define to 1 if personality LINUX32 can be set. */ -#undef HAVE_PERSONALITY_LINUX32 - -/* Define to 1 if you have the png library (-lpng). */ -#undef HAVE_PNG - -/* Define to 1 if you have the header file. */ -#undef HAVE_PNG_H - -/* Define to 1 if you have the `posix_memalign' function. */ -#undef HAVE_POSIX_MEMALIGN - -/* Define to 1 if you have the `pstat_getdynamic' function. */ -#undef HAVE_PSTAT_GETDYNAMIC - -/* Define to 1 if you have the header file. */ -#undef HAVE_PTHREAD_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_PTY_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_PWD_H - -/* Define to 1 if you have the `random' function. */ -#undef HAVE_RANDOM - -/* Define to 1 if you have the `readlink' function. */ -#undef HAVE_READLINK - -/* Define to 1 if you have the `recvfrom' function. */ -#undef HAVE_RECVFROM - -/* Define to 1 if you have the `rename' function. */ -#undef HAVE_RENAME - -/* Define to 1 if res_init is available. */ -#undef HAVE_RES_INIT - -/* Define to 1 if you have the `rint' function. */ -#undef HAVE_RINT - -/* Define to 1 if you have the `rmdir' function. */ -#undef HAVE_RMDIR - -/* Define to 1 if using librsvg. */ -#undef HAVE_RSVG - -/* Define to 1 if you have the `select' function. */ -#undef HAVE_SELECT - -/* Define to 1 if you have the `sendto' function. */ -#undef HAVE_SENDTO - -/* Define to 1 if you have the `setitimer' function. */ -#undef HAVE_SETITIMER - -/* Define to 1 if you have the `setlocale' function. */ -#undef HAVE_SETLOCALE - -/* Define to 1 if you have the `setpgid' function. */ -#undef HAVE_SETPGID - -/* Define to 1 if you have the `setrlimit' function. */ -#undef HAVE_SETRLIMIT - -/* Define to 1 if you have the `setsid' function. */ -#undef HAVE_SETSID - -/* Define to 1 if you have the `setsockopt' function. */ -#undef HAVE_SETSOCKOPT - -/* Define to 1 if you have the `shutdown' function. */ -#undef HAVE_SHUTDOWN - -/* Define to 1 if 'sig_atomic_t' is a signed integer type. */ -#undef HAVE_SIGNED_SIG_ATOMIC_T - -/* Define to 1 if 'wchar_t' is a signed integer type. */ -#undef HAVE_SIGNED_WCHAR_T - -/* Define to 1 if 'wint_t' is a signed integer type. */ -#undef HAVE_SIGNED_WINT_T - -/* Define to 1 if the system has the type `size_t'. */ -#undef HAVE_SIZE_T - -/* Define to 1 if you have sound support. */ -#undef HAVE_SOUND - -/* Define to 1 if you have the header file. */ -#undef HAVE_SOUNDCARD_H - -/* Define to 1 if `speed_t' is declared by . */ -#undef HAVE_SPEED_T - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDIO_EXT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the `strchr' function. */ -#undef HAVE_STRCHR - -/* Define to 1 if you have the `strerror' function. */ -#undef HAVE_STRERROR - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the `strrchr' function. */ -#undef HAVE_STRRCHR - -/* Define to 1 if you have the `strsignal' function. */ -#undef HAVE_STRSIGNAL - -/* Define to 1 if `ifr_addr' is a member of `struct ifreq'. */ -#undef HAVE_STRUCT_IFREQ_IFR_ADDR - -/* Define to 1 if `ifr_broadaddr' is a member of `struct ifreq'. */ -#undef HAVE_STRUCT_IFREQ_IFR_BROADADDR - -/* Define to 1 if `ifr_flags' is a member of `struct ifreq'. */ -#undef HAVE_STRUCT_IFREQ_IFR_FLAGS - -/* Define to 1 if `ifr_hwaddr' is a member of `struct ifreq'. */ -#undef HAVE_STRUCT_IFREQ_IFR_HWADDR - -/* Define to 1 if `ifr_netmask' is a member of `struct ifreq'. */ -#undef HAVE_STRUCT_IFREQ_IFR_NETMASK - -/* Define to 1 if `n_un.n_name' is a member of `struct nlist'. */ -#undef HAVE_STRUCT_NLIST_N_UN_N_NAME - -/* Define to 1 if `tm_zone' is a member of `struct tm'. */ -#undef HAVE_STRUCT_TM_TM_ZONE - -/* Define to 1 if `struct utimbuf' is declared by . */ -#undef HAVE_STRUCT_UTIMBUF - -/* Define if struct stat has an st_dm_mode member. */ -#undef HAVE_ST_DM_MODE - -/* Define to 1 if you have the `symlink' function. */ -#undef HAVE_SYMLINK - -/* Define to 1 if you have the `sync' function. */ -#undef HAVE_SYNC - -/* Define to 1 if you have the `sysinfo' function. */ -#undef HAVE_SYSINFO - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_BITYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_INTTYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_LOADAVG_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_MMAN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_RESOURCE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SELECT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SOCKET_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SOUNDCARD_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SYSTEMINFO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TIME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_UN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_UTSNAME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_VLIMIT_H - -/* Define to 1 if you have that is POSIX.1 compatible. */ -#undef HAVE_SYS_WAIT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS__MBSTATE_T_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_TERM_H - -/* Define to 1 if you have the tiff library (-ltiff). */ -#undef HAVE_TIFF - -/* Define to 1 if `struct timeval' is declared by . */ -#undef HAVE_TIMEVAL - -/* Define if struct tm has the tm_gmtoff member. */ -#undef HAVE_TM_GMTOFF - -/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use - `HAVE_STRUCT_TM_TM_ZONE' instead. */ -#undef HAVE_TM_ZONE - -/* Define to 1 if you have the `touchlock' function. */ -#undef HAVE_TOUCHLOCK - -/* Define to 1 if you don't have `tm_zone' but do have the external array - `tzname'. */ -#undef HAVE_TZNAME - -/* Define to 1 if you have the `tzset' function. */ -#undef HAVE_TZSET - -/* Define to 1 if you have the `ualarm' function. */ -#undef HAVE_UALARM - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if the system has the type `unsigned long long int'. */ -#undef HAVE_UNSIGNED_LONG_LONG_INT - -/* Define to 1 if you have the header file. */ -#undef HAVE_UTIL_H - -/* Define to 1 if you have the `utimes' function. */ -#undef HAVE_UTIMES - -/* Define to 1 if you have the header file. */ -#undef HAVE_UTIME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UTMP_H - -/* Define to 1 if you have the `vfork' function. */ -#undef HAVE_VFORK - -/* Define to 1 if you have the header file. */ -#undef HAVE_VFORK_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_WCHAR_H - -/* Define if you have the 'wchar_t' type. */ -#undef HAVE_WCHAR_T - -/* Define if you have a window system. */ -#undef HAVE_WINDOW_SYSTEM - -/* Define to 1 if `fork' works. */ -#undef HAVE_WORKING_FORK - -/* Define to 1 if `vfork' works. */ -#undef HAVE_WORKING_VFORK - -/* Define to 1 if you have the header file. */ -#undef HAVE_WS2TCPIP_H - -/* Define to 1 if you want to use version 11 of X windows. Otherwise, Emacs - expects to use version 10. */ -#undef HAVE_X11 - -/* Define to 1 if you have the X11R6 or newer version of Xlib. */ -#undef HAVE_X11R6 - -/* Define if you have usable X11R6-style XIM support. */ -#undef HAVE_X11R6_XIM - -/* Define to 1 if you have the X11R6 or newer version of Xt. */ -#undef HAVE_X11XTR6 - -/* Define to 1 if you have the Xaw3d library (-lXaw3d). */ -#undef HAVE_XAW3D - -/* Define to 1 if you have the Xft library. */ -#undef HAVE_XFT - -/* Define to 1 if XIM is available */ -#undef HAVE_XIM - -/* Define to 1 if you have the XkbGetKeyboard function. */ -#undef HAVE_XKBGETKEYBOARD - -/* Define to 1 if you have the Xpm libary (-lXpm). */ -#undef HAVE_XPM - -/* Define to 1 if you have the `XrmSetDatabase' function. */ -#undef HAVE_XRMSETDATABASE - -/* Define to 1 if you have the `XScreenNumberOfScreen' function. */ -#undef HAVE_XSCREENNUMBEROFSCREEN - -/* Define to 1 if you have the `XScreenResourceString' function. */ -#undef HAVE_XSCREENRESOURCESTRING - -/* Define to 1 if you have the `XSetWMProtocols' function. */ -#undef HAVE_XSETWMPROTOCOLS - -/* Define if you have usable i18n support. */ -#undef HAVE_X_I18N - -/* Define to 1 if you have the SM library (-lSM). */ -#undef HAVE_X_SM - -/* Define to 1 if you want to use the X window system. */ -#undef HAVE_X_WINDOWS - -/* Define to 1 if the system has the type `_Bool'. */ -#undef HAVE__BOOL - -/* Define to 1 if you have the `__builtin_unwind_init' function. */ -#undef HAVE___BUILTIN_UNWIND_INIT - -/* Define to 1 if you have the `__executable_start' function. */ -#undef HAVE___EXECUTABLE_START - -/* Define to 1 if you have the `__fpending' function. */ -#undef HAVE___FPENDING - -/* Define to support using a Hesiod database to find the POP server. */ -#undef HESIOD - -/* Define to support Kerberos-authenticated POP mail retrieval. */ -#undef KERBEROS - -/* Define to use Kerberos 5 instead of Kerberos 4. */ -#undef KERBEROS5 - -/* Define to 1 if localtime caches TZ. */ -#undef LOCALTIME_CACHE - -/* Define to 1 if `lstat' dereferences a symlink specified with a trailing - slash. */ -#undef LSTAT_FOLLOWS_SLASHED_SYMLINK - -/* String giving fallback POP mail host. */ -#undef MAILHOST - -/* Define to unlink, rather than empty, mail spool after reading. */ -#undef MAIL_UNLINK_SPOOL - -/* Define if the mailer uses flock to interlock the mail spool. */ -#undef MAIL_USE_FLOCK - -/* Define if the mailer uses lockf to interlock the mail spool. */ -#undef MAIL_USE_LOCKF - -/* Define to support MMDF mailboxes in movemail. */ -#undef MAIL_USE_MMDF - -/* Define to support POP mail retrieval. */ -#undef MAIL_USE_POP - -/* Define to 1 if you don't have struct exception in math.h. */ -#undef NO_MATHERR - -/* Define to 1 if your C compiler doesn't accept -c and -o together. */ -#undef NO_MINUS_C_MINUS_O - -/* Define to 1 if `NSInteger' is defined. */ -#undef NS_HAVE_NSINTEGER - -/* Define to 1 if you are using NS windowing under MacOS X. */ -#undef NS_IMPL_COCOA - -/* Define to 1 if you are using NS windowing under GNUstep. */ -#undef NS_IMPL_GNUSTEP - -/* Define to 1 if the nlist n_name member is a pointer */ -#undef N_NAME_POINTER - -/* Define if the C compiler is the linker. */ -#undef ORDINARY_LINK - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define as `void' if your compiler accepts `void *'; otherwise define as - `char'. */ -#undef POINTER_TYPE - -/* Define to 1 if the C compiler supports function prototypes. */ -#undef PROTOTYPES - -/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type - 'ptrdiff_t'. */ -#undef PTRDIFF_T_SUFFIX - -/* Define to 1 if readlink fails to recognize a trailing slash. */ -#undef READLINK_TRAILING_SLASH_BUG - -/* Define REL_ALLOC if you want to use the relocating allocator for buffer - space. */ -#undef REL_ALLOC - -/* Define to 1 if stat needs help when passed a directory name with a trailing - slash */ -#undef REPLACE_FUNC_STAT_DIR - -/* Define to 1 if stat needs help when passed a file name with a trailing - slash */ -#undef REPLACE_FUNC_STAT_FILE - -/* Define as the return type of signal handlers (`int' or `void'). */ -#undef RETSIGTYPE - -/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type - 'sig_atomic_t'. */ -#undef SIG_ATOMIC_T_SUFFIX - -/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type - 'size_t'. */ -#undef SIZE_T_SUFFIX - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at runtime. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ -#undef STACK_DIRECTION - -/* Define to 1 if the `S_IS*' macros in do not work properly. */ -#undef STAT_MACROS_BROKEN - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define to 1 on System V Release 4. */ -#undef SVR4 - -/* Process async input synchronously. */ -#undef SYNC_INPUT - -/* Define to use system malloc. */ -#undef SYSTEM_MALLOC - -/* Define to 1 if you use terminfo instead of termcap. */ -#undef TERMINFO - -/* Define to 1 if you can safely include both and . */ -#undef TIME_WITH_SYS_TIME - -/* Define to 1 if your declares `struct tm'. */ -#undef TM_IN_SYS_TIME - -/* Define to 1 for Encore UMAX. */ -#undef UMAX - -/* Define to 1 for Encore UMAX 4.3 that has instead of - . */ -#undef UMAX4_3 - -/* Define to 1 if using GTK. */ -#undef USE_GTK - -/* Define this to use a lisp union for the Lisp_Object data type. */ -#undef USE_LISP_UNION_TYPE - -/* Define to 1 if using the Lucid X toolkit. */ -#undef USE_LUCID - -/* Define to use mmap to allocate buffer text. */ -#undef USE_MMAP_FOR_BUFFERS - -/* Define to 1 if using the Motif X toolkit. */ -#undef USE_MOTIF - -/* Define to 1 if we should use toolkit scroll bars. */ -#undef USE_TOOLKIT_SCROLL_BARS - -/* Define to 1 if we should use XIM, if it is available. */ -#undef USE_XIM - -/* Define to 1 if using an X toolkit. */ -#undef USE_X_TOOLKIT - -/* Version number of package */ -#undef VERSION - -/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type - 'wchar_t'. */ -#undef WCHAR_T_SUFFIX - -/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type - 'wint_t'. */ -#undef WINT_T_SUFFIX - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -# undef WORDS_BIGENDIAN -# endif -#endif - -/* Define this to check for malloc buffer overrun. */ -#undef XMALLOC_OVERRUN_CHECK - -/* Define to the type of the 6th arg of XRegisterIMInstantiateCallback, either - XPointer or XPointer*. */ -#undef XRegisterIMInstantiateCallback_arg6 - -/* Number of bits in a file offset, on hosts where this is settable. */ -#undef _FILE_OFFSET_BITS - -/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ -#undef _LARGEFILE_SOURCE - -/* Define for large files, on AIX-style hosts. */ -#undef _LARGE_FILES - -/* Define to 1 if on MINIX. */ -#undef _MINIX - -/* Define to 2 if the system does not provide POSIX.1 features except with - this defined. */ -#undef _POSIX_1_SOURCE - -/* Define to 1 if you need to in order for `stat' and other things to work. */ -#undef _POSIX_SOURCE - -/* Define to 500 only on HP-UX. */ -#undef _XOPEN_SOURCE - -/* Enable extensions on AIX 3, Interix. */ -#ifndef _ALL_SOURCE -# undef _ALL_SOURCE -#endif -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# undef _GNU_SOURCE -#endif -/* Enable threading extensions on Solaris. */ -#ifndef _POSIX_PTHREAD_SEMANTICS -# undef _POSIX_PTHREAD_SEMANTICS -#endif -/* Enable extensions on HP NonStop. */ -#ifndef _TANDEM_SOURCE -# undef _TANDEM_SOURCE -#endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ -#endif - - -/* Define to rpl_ if the getopt replacement functions and variables should be - used. */ -#undef __GETOPT_PREFIX - -/* Define like PROTOTYPES; this can be used by system headers. */ -#undef __PROTOTYPES - -/* Define to compiler's equivalent of C99 restrict keyword in array - declarations. Define as empty for no equivalent. */ -#undef __restrict_arr - -/* Define to the used machine dependent file. */ -#undef config_machfile - -/* Define to the used os dependent file. */ -#undef config_opsysfile - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -#undef inline -#endif - -/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports - the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of - earlier versions), but does not display it by setting __GNUC_STDC_INLINE__. - __APPLE__ && __MACH__ test for MacOS X. - __APPLE_CC__ tests for the Apple compiler and its version. - __STDC_VERSION__ tests for the C99 mode. */ -#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__ -# define __GNUC_STDC_INLINE__ 1 -#endif - -/* Define to a type if does not define. */ -#undef mbstate_t - -/* Define to the name of the strftime replacement function. */ -#undef my_strftime - -/* Define to the type of st_nlink in struct stat, or a supertype. */ -#undef nlink_t - -/* Define to `int' if does not define. */ -#undef pid_t - -/* Define to the equivalent of the C99 'restrict' keyword, or to - nothing if this is not supported. Do not define if restrict is - supported directly. */ -#undef restrict -/* Work around a bug in Sun C++: it does not support _Restrict or - __restrict__, even though the corresponding Sun C compiler ends up with - "#define restrict _Restrict" or "#define restrict __restrict__" in the - previous line. Perhaps some future version of Sun C++ will work with - restrict; if so, hopefully it defines __RESTRICT like Sun C does. */ -#if defined __SUNPRO_CC && !defined __RESTRICT -# define _Restrict -# define __restrict__ -#endif - -/* Define to `unsigned int' if does not define. */ -#undef size_t - -/* type to use in place of socklen_t if not defined */ -#undef socklen_t - -/* Define to any substitute for sys_siglist. */ -#undef sys_siglist - -/* Define as a marker that can be attached to declarations that might not - be used. This helps to reduce warnings, such as from - GCC -Wunused-parameter. */ -#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) -# define _GL_UNUSED __attribute__ ((__unused__)) -#else -# define _GL_UNUSED -#endif -/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name - is a misnomer outside of parameter lists. */ -#define _UNUSED_PARAMETER_ _GL_UNUSED - - -/* Define as `fork' if `vfork' does not work. */ -#undef vfork - -/* Define to empty if the keyword `volatile' does not work. Warning: valid - code using `volatile' can become incorrect without. Disable with care. */ -#undef volatile - - -/* Define AMPERSAND_FULL_NAME if you use the convention - that & in the full name stands for the login id. */ -/* Turned on June 1996 supposing nobody will mind it. */ -#define AMPERSAND_FULL_NAME - -/* If using GNU, then support inline function declarations. */ -/* Don't try to switch on inline handling as detected by AC_C_INLINE - generally, because even if non-gcc compilers accept `inline', they - may reject `extern inline'. */ -#if defined (__GNUC__) -#define INLINE __inline__ -#else -#define INLINE -#endif - -/* `subprocesses' should be defined if you want to - have code for asynchronous subprocesses - (as used in M-x compile and M-x shell). - Only MSDOS does not support this (it overrides - this in its config_opsysfile below). */ - -#define subprocesses - -/* Include the os and machine dependent files. */ -#include config_opsysfile -#ifdef config_machfile -# include config_machfile -#endif - -/* GNUstep needs a bit more pure memory. Of the existing knobs, - SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems. - (There is probably a better place to do this, but right now the - Cocoa side does this in s/darwin.h and we cannot parallel this - exactly since GNUstep is multi-OS. */ -#if defined HAVE_NS && defined NS_IMPL_GNUSTEP -# define SYSTEM_PURESIZE_EXTRA 30000 -#endif - -/* SIGTYPE is the macro we actually use. */ -#ifndef SIGTYPE -#define SIGTYPE RETSIGTYPE -#endif - -#ifdef emacs /* Don't do this for lib-src. */ -/* Tell regex.c to use a type compatible with Emacs. */ -#define RE_TRANSLATE_TYPE Lisp_Object -#define RE_TRANSLATE(TBL, C) CHAR_TABLE_TRANSLATE (TBL, C) -#ifdef make_number -/* If make_number is a macro, use it. */ -#define RE_TRANSLATE_P(TBL) (!EQ (TBL, make_number (0))) -#else -/* If make_number is a function, avoid it. */ -#define RE_TRANSLATE_P(TBL) (!(INTEGERP (TBL) && XINT (TBL) == 0)) -#endif -#endif - -/* These default definitions are good for almost all machines. - The exceptions override them in m/MACHINE.h. */ - -#ifndef BITS_PER_CHAR -#define BITS_PER_CHAR 8 -#endif - -#ifndef BITS_PER_SHORT -#define BITS_PER_SHORT 16 -#endif - -/* Note that lisp.h uses this in a preprocessor conditional, so it - would not work to use sizeof. That being so, we do all of them - without sizeof, for uniformity's sake. */ -#ifndef BITS_PER_INT -#define BITS_PER_INT 32 -#endif - -#ifndef BITS_PER_LONG -#ifdef _LP64 -#define BITS_PER_LONG 64 -#else -#define BITS_PER_LONG 32 -#endif -#endif - -/* Define if the compiler supports function prototypes. It may do so but - not define __STDC__ (e.g. DEC C by default) or may define it as zero. */ -#undef PROTOTYPES - -#include -#include - -#ifdef HAVE_ALLOCA_H -# include -#elif defined __GNUC__ -# define alloca __builtin_alloca -#elif defined _AIX -# define alloca __alloca -#else -# include -# ifdef __cplusplus -extern "C" -# endif -void *alloca (size_t); -#endif - -#ifndef HAVE_SIZE_T -typedef unsigned size_t; -#endif - -#ifndef HAVE_STRCHR -#define strchr(a, b) index (a, b) -#endif - -#ifndef HAVE_STRRCHR -#define strrchr(a, b) rindex (a, b) -#endif - -#if defined __GNUC__ && (__GNUC__ > 2 \ - || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5)) -#define NO_RETURN __attribute__ ((__noreturn__)) -#else -#define NO_RETURN /* nothing */ -#endif - -#if __GNUC__ >= 3 /* On GCC 3.0 we might get a warning. */ -#define NO_INLINE __attribute__((noinline)) -#else -#define NO_INLINE -#endif - -#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) -#define EXTERNALLY_VISIBLE __attribute__((externally_visible)) -#else -#define EXTERNALLY_VISIBLE -#endif - -/* Some versions of GNU/Linux define noinline in their headers. */ -#ifdef noinline -#undef noinline -#endif - -/* These won't be used automatically yet. We also need to know, at least, - that the stack is continuous. */ -#ifdef __GNUC__ -# ifndef GC_SETJMP_WORKS - /* GC_SETJMP_WORKS is nearly always appropriate for GCC. */ -# define GC_SETJMP_WORKS 1 -# endif -# ifndef GC_LISP_OBJECT_ALIGNMENT -# define GC_LISP_OBJECT_ALIGNMENT (__alignof__ (Lisp_Object)) -# endif -#endif - -#endif /* EMACS_CONFIG_H */ - -/* -Local Variables: -mode: c -End: -*/ - -- cgit v1.2.1 From fe7be2210f2e43142f9280a43b912273923186d4 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Tue, 22 Mar 2011 20:32:55 -0700 Subject: Fix ChangeLog typo. --- src/ChangeLog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index a4312efceb9..4994aaa9fa8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -10474,8 +10474,8 @@ (POSIX_SIGNALS): Do not define. Remove support for old UNIX System V systems. - * s/unixware.h: Add the contents of s/usg-5-4-2.h. - * s/usg-5-4-2.h: Remove. + * s/unixware.h: Add the contents of s/usg5-4-2.h. + * s/usg5-4-2.h: Remove. Remove support for Solaris on PPC and for old versions. * s/sol2-6.h: Add the contents of s/sol-2.3.h, s/sol-2.4.h, s/sol-2.5.h. -- cgit v1.2.1 From 12ea59a297551086de418573f6ee201fc3ef2768 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 23 Mar 2011 01:06:21 -0700 Subject: * cm.c (calccost): Turn while-do into do-while, for clarity. --- src/ChangeLog | 2 ++ src/cm.c | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 4994aaa9fa8..1d3d4d65174 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-23 Paul Eggert + * cm.c (calccost): Turn while-do into do-while, for clarity. + Fix more problems found by GCC 4.5.2's static checks. * coding.c (encode_coding_raw_text): Avoid unnecessary test diff --git a/src/cm.c b/src/cm.c index 6379955b48c..42f855f1694 100644 --- a/src/cm.c +++ b/src/cm.c @@ -214,8 +214,9 @@ calccost (struct tty_display_info *tty, } totalcost = c * deltay; if (doit) - while (--deltay >= 0) + do emacs_tputs (tty, p, 1, cmputc); + while (0 < --deltay); x: if ((deltax = dstx - srcx) == 0) goto done; @@ -296,8 +297,9 @@ fail: } totalcost += c * deltax; if (doit) - while (--deltax >= 0) + do emacs_tputs (tty, p, 1, cmputc); + while (0 < --deltax); done: return totalcost; } -- cgit v1.2.1 From d284567f963fcbd340feef4d6fa46aa371c09b29 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 23 Mar 2011 01:09:13 -0700 Subject: * term.c (produce_glyphless_glyph): Remove unnecessary test. --- src/ChangeLog | 2 ++ src/term.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 1d3d4d65174..47d9dbe5aa2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-23 Paul Eggert + * term.c (produce_glyphless_glyph): Remove unnecessary test. + * cm.c (calccost): Turn while-do into do-while, for clarity. Fix more problems found by GCC 4.5.2's static checks. diff --git a/src/term.c b/src/term.c index e84bbe125f8..94fafd73ed8 100644 --- a/src/term.c +++ b/src/term.c @@ -1952,7 +1952,7 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) it->pixel_width = len; it->nglyphs = len; - if (len > 0 && it->glyph_row) + if (it->glyph_row) append_glyphless_glyph (it, face_id, str); } -- cgit v1.2.1 From 6ae5284811ba17222b14424a5fd71005c14ae131 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 23 Mar 2011 01:13:33 -0700 Subject: * chartab.c (sub_char_table_ref_and_range): Redo to avoid overflow concerns. --- src/ChangeLog | 3 +++ src/chartab.c | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 47d9dbe5aa2..b2686811875 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-23 Paul Eggert + * chartab.c (sub_char_table_ref_and_range): Redo to avoid overflow + concerns. + * term.c (produce_glyphless_glyph): Remove unnecessary test. * cm.c (calccost): Turn while-do into do-while, for clarity. diff --git a/src/chartab.c b/src/chartab.c index 85aa5932ac3..9a140eb8560 100644 --- a/src/chartab.c +++ b/src/chartab.c @@ -215,7 +215,7 @@ sub_char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to, Lisp struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table); int depth = XINT (tbl->depth); int min_char = XINT (tbl->min_char); - int max_char = min_char + chartab_chars[depth - 1] - 1; + int char_offset_lim = chartab_chars[depth - 1]; int chartab_idx = CHARTAB_IDX (c, depth, min_char), idx; Lisp_Object val; @@ -244,8 +244,9 @@ sub_char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to, Lisp break; } } - while ((c = min_char + (chartab_idx + 1) * chartab_chars[depth]) <= max_char - && *to >= c) + + while ((c = (chartab_idx + 1) * chartab_chars[depth]) < char_offset_lim + && (c += min_char) <= *to) { Lisp_Object this_val; -- cgit v1.2.1 From f86c98305dbfd21b29a4c358d08662da0c135522 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 23 Mar 2011 01:15:28 -0700 Subject: * xterm.c (x_make_frame_visible, same_x_server): Redo to avoid overflow concerns. --- src/ChangeLog | 3 +++ src/xterm.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index b2686811875..a8bda0915f6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-23 Paul Eggert + * xterm.c (x_make_frame_visible, same_x_server): Redo to avoid overflow + concerns. + * chartab.c (sub_char_table_ref_and_range): Redo to avoid overflow concerns. diff --git a/src/xterm.c b/src/xterm.c index f87c22912a4..cdbce2f1c86 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -9121,7 +9121,7 @@ x_make_frame_visible (struct frame *f) unknown reason, the call to XtMapWidget is completely ignored. Mapping the widget a second time works. */ - if (!FRAME_VISIBLE_P (f) && --retry_count > 0) + if (!FRAME_VISIBLE_P (f) && --retry_count != 0) goto retry; } } @@ -9726,7 +9726,7 @@ same_x_server (const char *name1, const char *name2) for (; *name1 != '\0' && *name1 == *name2; name1++, name2++) { if (*name1 == ':') - seen_colon++; + seen_colon = 1; if (seen_colon && *name1 == '.') return 1; } -- cgit v1.2.1 From dee091a37f6486dbbcf7bf00f6ee54d77033f997 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 23 Mar 2011 11:06:57 +0100 Subject: Use Frun_hooks rather than calling Vrun_hooks manually --- src/ChangeLog | 18 ++++++++++++++++++ src/buffer.c | 3 +-- src/callint.c | 3 +-- src/cmds.c | 2 +- src/editfns.c | 25 ++++++++++++++----------- src/emacs.c | 5 +++-- src/fileio.c | 6 +++--- src/frame.c | 2 +- src/insdel.c | 8 ++++---- src/keyboard.c | 35 +++++++++++++++-------------------- src/minibuf.c | 12 ++---------- src/term.c | 26 +++++++++++--------------- src/window.c | 38 +++++++++++++++++--------------------- 13 files changed, 91 insertions(+), 92 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 4994aaa9fa8..f9766115042 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,21 @@ +2011-03-23 Julien Danjou + + * term.c (Fsuspend_tty, Fresume_tty): + * minibuf.c (read_minibuf, run_exit_minibuf_hook): + * window.c (temp_output_buffer_show): + * insdel.c (signal_before_change): + * frame.c (Fhandle_switch_frame): + * fileio.c (Fdo_auto_save): + * emacs.c (Fkill_emacs): + * editfns.c (save_excursion_restore): + * cmds.c (internal_self_insert): + * callint.c (Fcall_interactively): + * buffer.c (Fkill_all_local_variables): + * keyboard.c (Fcommand_execute, Fsuspend_emacs, safe_run_hooks_1): + Use Frun_hooks. + (command_loop_1): Use Frun_hooks. Call safe_run_hooks + unconditionnaly since it does the check itself. + 2011-03-23 Paul Eggert Fix more problems found by GCC 4.5.2's static checks. diff --git a/src/buffer.c b/src/buffer.c index c0e6866dee1..da2cc1573c8 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -2520,8 +2520,7 @@ The first thing this function does is run the normal hook `change-major-mode-hook'. */) (void) { - if (!NILP (Vrun_hooks)) - call1 (Vrun_hooks, Qchange_major_mode_hook); + Frun_hooks (1, &Qchange_major_mode_hook); /* Make sure none of the bindings in local_var_alist remain swapped in, in their symbols. */ diff --git a/src/callint.c b/src/callint.c index 282d8a82aa7..bb815a5bd01 100644 --- a/src/callint.c +++ b/src/callint.c @@ -423,8 +423,7 @@ invoke it. If KEYS is omitted or nil, the return value of error ("Attempt to select inactive minibuffer window"); /* If the current buffer wants to clean up, let it. */ - if (!NILP (Vmouse_leave_buffer_hook)) - call1 (Vrun_hooks, Qmouse_leave_buffer_hook); + Frun_hooks (1, &Qmouse_leave_buffer_hook); Fselect_window (w, Qnil); } diff --git a/src/cmds.c b/src/cmds.c index fa1ac5028ae..ebbb223c2db 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -501,7 +501,7 @@ internal_self_insert (int c, EMACS_INT n) } /* Run hooks for electric keys. */ - call1 (Vrun_hooks, Qpost_self_insert_hook); + Frun_hooks (1, &Qpost_self_insert_hook); return hairy; } diff --git a/src/editfns.c b/src/editfns.c index 1f98ff040b3..009e1d34bde 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -928,18 +928,21 @@ save_excursion_restore (Lisp_Object info) tem1 = BVAR (current_buffer, mark_active); BVAR (current_buffer, mark_active) = tem; - if (!NILP (Vrun_hooks)) + /* If mark is active now, and either was not active + or was at a different place, run the activate hook. */ + if (! NILP (tem)) { - /* If mark is active now, and either was not active - or was at a different place, run the activate hook. */ - if (! NILP (BVAR (current_buffer, mark_active))) - { - if (! EQ (omark, nmark)) - call1 (Vrun_hooks, intern ("activate-mark-hook")); - } - /* If mark has ceased to be active, run deactivate hook. */ - else if (! NILP (tem1)) - call1 (Vrun_hooks, intern ("deactivate-mark-hook")); + if (! EQ (omark, nmark)) + { + tem = intern ("activate-mark-hook"); + Frun_hooks (1, &tem); + } + } + /* If mark has ceased to be active, run deactivate hook. */ + else if (! NILP (tem1)) + { + tem = intern ("deactivate-mark-hook"); + Frun_hooks (1, &tem); } /* If buffer was visible in a window, and a different window was diff --git a/src/emacs.c b/src/emacs.c index bc7c07a9326..0382ade728d 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -1972,14 +1972,15 @@ all of which are called before Emacs is actually killed. */) (Lisp_Object arg) { struct gcpro gcpro1; + Lisp_Object hook; GCPRO1 (arg); if (feof (stdin)) arg = Qt; - if (!NILP (Vrun_hooks)) - call1 (Vrun_hooks, intern ("kill-emacs-hook")); + hook = intern ("kill-emacs-hook"); + Frun_hooks (1, &hook); UNGCPRO; diff --git a/src/fileio.c b/src/fileio.c index 7d2f10d517c..64dda0a78e4 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -5180,7 +5180,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) (Lisp_Object no_message, Lisp_Object current_only) { struct buffer *old = current_buffer, *b; - Lisp_Object tail, buf; + Lisp_Object tail, buf, hook; int auto_saved = 0; int do_handled_files; Lisp_Object oquit; @@ -5210,8 +5210,8 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) /* No GCPRO needed, because (when it matters) all Lisp_Object variables point to non-strings reached from Vbuffer_alist. */ - if (!NILP (Vrun_hooks)) - call1 (Vrun_hooks, intern ("auto-save-hook")); + hook = intern ("auto-save-hook"); + Frun_hooks (1, &hook); if (STRINGP (Vauto_save_list_file_name)) { diff --git a/src/frame.c b/src/frame.c index 3e00e1bf107..cdcb313280b 100644 --- a/src/frame.c +++ b/src/frame.c @@ -890,7 +890,7 @@ to that frame. */) { /* Preserve prefix arg that the command loop just cleared. */ KVAR (current_kboard, Vprefix_arg) = Vcurrent_prefix_arg; - call1 (Vrun_hooks, Qmouse_leave_buffer_hook); + Frun_hooks (1, &Qmouse_leave_buffer_hook); return do_switch_frame (event, 0, 0, Qnil); } diff --git a/src/insdel.c b/src/insdel.c index ad3460f9a64..1cbe3de20d2 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -2137,14 +2137,14 @@ signal_before_change (EMACS_INT start_int, EMACS_INT end_int, specbind (Qinhibit_modification_hooks, Qt); - /* If buffer is unmodified, run a special hook for that case. */ + /* If buffer is unmodified, run a special hook for that case. The + check for Vfirst_change_hook is just a minor optimization. */ if (SAVE_MODIFF >= MODIFF - && !NILP (Vfirst_change_hook) - && !NILP (Vrun_hooks)) + && !NILP (Vfirst_change_hook)) { PRESERVE_VALUE; PRESERVE_START_END; - call1 (Vrun_hooks, Qfirst_change_hook); + Frun_hooks (1, &Qfirst_change_hook); } /* Now run the before-change-functions if any. */ diff --git a/src/keyboard.c b/src/keyboard.c index fc8622de0a1..39848ee490d 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1492,10 +1492,7 @@ command_loop_1 (void) Vthis_command = cmd; real_this_command = cmd; - /* Note that the value cell will never directly contain nil - if the symbol is a local variable. */ - if (!NILP (Vpre_command_hook) && !NILP (Vrun_hooks)) - safe_run_hooks (Qpre_command_hook); + safe_run_hooks (Qpre_command_hook); already_adjusted = 0; @@ -1541,18 +1538,14 @@ command_loop_1 (void) } KVAR (current_kboard, Vlast_prefix_arg) = Vcurrent_prefix_arg; - /* Note that the value cell will never directly contain nil - if the symbol is a local variable. */ - if (!NILP (Vpost_command_hook) && !NILP (Vrun_hooks)) - safe_run_hooks (Qpost_command_hook); + safe_run_hooks (Qpost_command_hook); /* If displaying a message, resize the echo area window to fit that message's size exactly. */ if (!NILP (echo_area_buffer[0])) resize_echo_area_exactly (); - if (!NILP (Vdeferred_action_list)) - safe_run_hooks (Qdeferred_action_function); + safe_run_hooks (Qdeferred_action_function); /* If there is a prefix argument, 1) We don't want Vlast_command to be ``universal-argument'' @@ -1621,7 +1614,10 @@ command_loop_1 (void) } if (current_buffer != prev_buffer || MODIFF != prev_modiff) - call1 (Vrun_hooks, intern ("activate-mark-hook")); + { + Lisp_Object hook = intern ("activate-mark-hook"); + Frun_hooks (1, &hook); + } } Vsaved_region_selection = Qnil; @@ -1819,9 +1815,7 @@ adjust_point_for_property (EMACS_INT last_pt, int modified) static Lisp_Object safe_run_hooks_1 (void) { - if (NILP (Vrun_hooks)) - return Qnil; - return call1 (Vrun_hooks, Vinhibit_quit); + return Frun_hooks (1, &Vinhibit_quit); } /* Subroutine for safe_run_hooks: handle an error by clearing out the hook. */ @@ -10129,11 +10123,11 @@ a special event, so ignore the prefix argument and don't clear it. */) if (SYMBOLP (cmd)) { tem = Fget (cmd, Qdisabled); - if (!NILP (tem) && !NILP (Vrun_hooks)) + if (!NILP (tem)) { tem = Fsymbol_value (Qdisabled_command_function); if (!NILP (tem)) - return call1 (Vrun_hooks, Qdisabled_command_function); + return Frun_hooks (1, &Qdisabled_command_function); } } @@ -10617,6 +10611,7 @@ On such systems, Emacs starts a subshell instead of suspending. */) int old_height, old_width; int width, height; struct gcpro gcpro1; + Lisp_Object hook; if (tty_list && tty_list->next) error ("There are other tty frames open; close them before suspending Emacs"); @@ -10625,8 +10620,8 @@ On such systems, Emacs starts a subshell instead of suspending. */) CHECK_STRING (stuffstring); /* Run the functions in suspend-hook. */ - if (!NILP (Vrun_hooks)) - call1 (Vrun_hooks, intern ("suspend-hook")); + hook = intern ("suspend-hook"); + Frun_hooks (1, &hook); GCPRO1 (stuffstring); get_tty_size (fileno (CURTTY ()->input), &old_width, &old_height); @@ -10650,8 +10645,8 @@ On such systems, Emacs starts a subshell instead of suspending. */) change_frame_size (SELECTED_FRAME (), height, width, 0, 0, 0); /* Run suspend-resume-hook. */ - if (!NILP (Vrun_hooks)) - call1 (Vrun_hooks, intern ("suspend-resume-hook")); + hook = intern ("suspend-resume-hook"); + Frun_hooks (1, &hook); UNGCPRO; return Qnil; diff --git a/src/minibuf.c b/src/minibuf.c index b6b79be9d3f..7bed9bb2f2d 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -649,12 +649,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, if (STRINGP (input_method) && !NILP (Ffboundp (Qactivate_input_method))) call1 (Qactivate_input_method, input_method); - /* Run our hook, but not if it is empty. - (run-hooks would do nothing if it is empty, - but it's important to save time here in the usual case.) */ - if (!NILP (Vminibuffer_setup_hook) && !EQ (Vminibuffer_setup_hook, Qunbound) - && !NILP (Vrun_hooks)) - call1 (Vrun_hooks, Qminibuffer_setup_hook); + Frun_hooks (1, &Qminibuffer_setup_hook); /* Don't allow the user to undo past this point. */ BVAR (current_buffer, undo_list) = Qnil; @@ -806,10 +801,7 @@ get_minibuffer (int depth) static Lisp_Object run_exit_minibuf_hook (Lisp_Object data) { - if (!NILP (Vminibuffer_exit_hook) && !EQ (Vminibuffer_exit_hook, Qunbound) - && !NILP (Vrun_hooks)) - safe_run_hooks (Qminibuffer_exit_hook); - + safe_run_hooks (Qminibuffer_exit_hook); return Qnil; } diff --git a/src/term.c b/src/term.c index e84bbe125f8..b3392df76fd 100644 --- a/src/term.c +++ b/src/term.c @@ -2500,13 +2500,10 @@ A suspended tty may be resumed by calling `resume-tty' on it. */) /* First run `suspend-tty-functions' and then clean up the tty state because `suspend-tty-functions' might need to change the tty state. */ - if (!NILP (Vrun_hooks)) - { - Lisp_Object args[2]; - args[0] = intern ("suspend-tty-functions"); - XSETTERMINAL (args[1], t); - Frun_hook_with_args (2, args); - } + Lisp_Object args[2]; + args[0] = intern ("suspend-tty-functions"); + XSETTERMINAL (args[1], t); + Frun_hook_with_args (2, args); reset_sys_modes (t->display_info.tty); delete_keyboard_wait_descriptor (fileno (f)); @@ -2596,14 +2593,13 @@ frame's terminal). */) init_sys_modes (t->display_info.tty); - /* Run `resume-tty-functions'. */ - if (!NILP (Vrun_hooks)) - { - Lisp_Object args[2]; - args[0] = intern ("resume-tty-functions"); - XSETTERMINAL (args[1], t); - Frun_hook_with_args (2, args); - } + { + /* Run `resume-tty-functions'. */ + Lisp_Object args[2]; + args[0] = intern ("resume-tty-functions"); + XSETTERMINAL (args[1], t); + Frun_hook_with_args (2, args); + } } set_tty_hooks (t); diff --git a/src/window.c b/src/window.c index eaa910571e0..9ab9fab2c13 100644 --- a/src/window.c +++ b/src/window.c @@ -3690,27 +3690,23 @@ temp_output_buffer_show (register Lisp_Object buf) /* Run temp-buffer-show-hook, with the chosen window selected and its buffer current. */ - - if (!NILP (Vrun_hooks) - && !NILP (Fboundp (Qtemp_buffer_show_hook)) - && !NILP (Fsymbol_value (Qtemp_buffer_show_hook))) - { - int count = SPECPDL_INDEX (); - Lisp_Object prev_window, prev_buffer; - prev_window = selected_window; - XSETBUFFER (prev_buffer, old); - - /* Select the window that was chosen, for running the hook. - Note: Both Fselect_window and select_window_norecord may - set-buffer to the buffer displayed in the window, - so we need to save the current buffer. --stef */ - record_unwind_protect (Fset_buffer, prev_buffer); - record_unwind_protect (select_window_norecord, prev_window); - Fselect_window (window, Qt); - Fset_buffer (w->buffer); - call1 (Vrun_hooks, Qtemp_buffer_show_hook); - unbind_to (count, Qnil); - } + { + int count = SPECPDL_INDEX (); + Lisp_Object prev_window, prev_buffer; + prev_window = selected_window; + XSETBUFFER (prev_buffer, old); + + /* Select the window that was chosen, for running the hook. + Note: Both Fselect_window and select_window_norecord may + set-buffer to the buffer displayed in the window, + so we need to save the current buffer. --stef */ + record_unwind_protect (Fset_buffer, prev_buffer); + record_unwind_protect (select_window_norecord, prev_window); + Fselect_window (window, Qt); + Fset_buffer (w->buffer); + Frun_hooks (1, &Qtemp_buffer_show_hook); + unbind_to (count, Qnil); + } } } -- cgit v1.2.1 From 9c88f339493465e8e200b21885f2ac886b299169 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Wed, 23 Mar 2011 17:25:38 +0100 Subject: w32: Fix some warnings reported by -Wall -Wextra. * lib-src/ntlib.c: Include . * nt/cmdproxy.c: Include . (make_absolute): Remove unused variable `i'. * src/w32fns.c (x_set_menu_bar_lines): Remove unused variable `olines'. (w32_wnd_proc): Pass NULL to Windows API, not uninitialized buffer. (Fx_close_connection): Remove unused variable `i'. * src/w32font.c (w32font_draw): Return number of glyphs. (w32font_open_internal): Remove unused variable `i'. (w32font_driver): Add missing initializer. * src/w32menu.c (utf8to16): Remove unused variable `utf16'. (fill_in_menu): Remove unused variable `items_added'. * src/w32term.c (last_mouse_press_frame): Remove static global variable. (w32_clip_to_row): Remove unused variable `f'. (x_delete_terminal): Remove unused variable `i'. * src/w32uniscribe.c (uniscribe_shape): Remove unused variable `nclusters'. (NOTHING): Remove unused static global variable. (uniscribe_check_otf): Remove unused variable `table'. (uniscribe_font_driver): Add missing initializers. --- src/ChangeLog | 22 ++++++++++++++++++++++ src/w32fns.c | 4 +--- src/w32font.c | 10 +++++++--- src/w32menu.c | 3 --- src/w32term.c | 3 --- src/w32uniscribe.c | 11 ++++++----- 6 files changed, 36 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index f9766115042..b306ff78ff9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,25 @@ +2011-03-23 Juanma Barranquero + + * w32fns.c (x_set_menu_bar_lines): Remove unused variable `olines'. + (w32_wnd_proc): Pass NULL to Windows API, not uninitialized buffer. + (Fx_close_connection): Remove unused variable `i'. + + * w32font.c (w32font_draw): Return number of glyphs. + (w32font_open_internal): Remove unused variable `i'. + (w32font_driver): Add missing initializer. + + * w32menu.c (utf8to16): Remove unused variable `utf16'. + (fill_in_menu): Remove unused variable `items_added'. + + * w32term.c (last_mouse_press_frame): Remove static global variable. + (w32_clip_to_row): Remove unused variable `f'. + (x_delete_terminal): Remove unused variable `i'. + + * w32uniscribe.c (uniscribe_shape): Remove unused variable `nclusters'. + (NOTHING): Remove unused static global variable. + (uniscribe_check_otf): Remove unused variable `table'. + (uniscribe_font_driver): Add missing initializers. + 2011-03-23 Julien Danjou * term.c (Fsuspend_tty, Fresume_tty): diff --git a/src/w32fns.c b/src/w32fns.c index 0c899cdceff..d833f9d550f 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -1527,7 +1527,6 @@ void x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) { int nlines; - int olines = FRAME_MENU_BAR_LINES (f); /* Right now, menu bars don't work properly in minibuf-only frames; most of the commands try to apply themselves to the minibuffer @@ -2951,7 +2950,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) HIMC context = get_ime_context_fn (hwnd); wmsg.dwModifiers = w32_get_key_modifiers (wParam, lParam); /* Get buffer size. */ - size = get_composition_string_fn (context, GCS_RESULTSTR, buffer, 0); + size = get_composition_string_fn (context, GCS_RESULTSTR, NULL, 0); buffer = alloca (size); size = get_composition_string_fn (context, GCS_RESULTSTR, buffer, size); @@ -4820,7 +4819,6 @@ If DISPLAY is nil, that stands for the selected frame's display. */) (Lisp_Object display) { struct w32_display_info *dpyinfo = check_x_display_info (display); - int i; if (dpyinfo->reference_count > 0) error ("Display still has frames on it"); diff --git a/src/w32font.c b/src/w32font.c index 40ff0782b88..d86107bc6d5 100644 --- a/src/w32font.c +++ b/src/w32font.c @@ -533,6 +533,7 @@ w32font_draw (struct glyph_string *s, int from, int to, { UINT options; HRGN orig_clip = NULL; + int len = to - from; struct w32font_info *w32font = (struct w32font_info *) s->font; options = w32font->glyph_idx; @@ -581,14 +582,14 @@ w32font_draw (struct glyph_string *s, int from, int to, if (s->padding_p) { - int len = to - from, i; + int i; for (i = 0; i < len; i++) ExtTextOutW (s->hdc, x + i, y, options, NULL, s->char2b + from + i, 1, NULL); } else - ExtTextOutW (s->hdc, x, y, options, NULL, s->char2b + from, to - from, NULL); + ExtTextOutW (s->hdc, x, y, options, NULL, s->char2b + from, len, NULL); /* Restore clip region. */ if (s->num_clips > 0) @@ -596,6 +597,8 @@ w32font_draw (struct glyph_string *s, int from, int to, if (orig_clip) DeleteObject (orig_clip); + + return len; } /* w32 implementation of free_entity for font backend. @@ -774,7 +777,7 @@ int w32font_open_internal (FRAME_PTR f, Lisp_Object font_entity, int pixel_size, Lisp_Object font_object) { - int len, size, i; + int len, size; LOGFONT logfont; HDC dc; HFONT hfont, old_font; @@ -2418,6 +2421,7 @@ struct font_driver w32font_driver = NULL, /* check */ NULL, /* get_variation_glyphs */ w32font_filter_properties, + NULL, /* cached_font_ok */ }; diff --git a/src/w32menu.c b/src/w32menu.c index a2e62f24f6a..c363fdd72cb 100644 --- a/src/w32menu.c +++ b/src/w32menu.c @@ -1320,7 +1320,6 @@ utf8to16 (unsigned char * src, int len, WCHAR * dest) { while (len > 0) { - int utf16; if (*src < 0x80) { *dest = (WCHAR) *src; @@ -1546,8 +1545,6 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item) static int fill_in_menu (HMENU menu, widget_value *wv) { - int items_added = 0; - for ( ; wv != NULL; wv = wv->next) { if (wv->contents) diff --git a/src/w32term.c b/src/w32term.c index f31c4e90e77..56454faddb9 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -160,7 +160,6 @@ int last_scroll_bar_drag_pos; /* Where the mouse was last time we reported a mouse event. */ static RECT last_mouse_glyph; static FRAME_PTR last_mouse_glyph_frame; -static Lisp_Object last_mouse_press_frame; /* The scroll bar in which the last motion event occurred. @@ -4842,7 +4841,6 @@ w32_read_socket (struct terminal *terminal, int expected, static void w32_clip_to_row (struct window *w, struct glyph_row *row, int area, HDC hdc) { - struct frame *f = XFRAME (WINDOW_FRAME (w)); RECT clip_rect; int window_x, window_y, window_width; @@ -6089,7 +6087,6 @@ static void x_delete_terminal (struct terminal *terminal) { struct w32_display_info *dpyinfo = terminal->display_info.w32; - int i; /* Protect against recursive calls. delete_frame in delete_terminal calls us back when it deletes our last frame. */ diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c index 39d1ee5c851..f6347bb88f7 100644 --- a/src/w32uniscribe.c +++ b/src/w32uniscribe.c @@ -320,7 +320,7 @@ uniscribe_shape (Lisp_Object lgstring) } if (SUCCEEDED (result)) { - int j, nclusters, from, to; + int j, from, to; from = 0; to = from; @@ -629,8 +629,6 @@ add_opentype_font_name_to_list (ENUMLOGFONTEX *logical_font, STR[4] = '\0'; \ } while (0) -static char* NOTHING = " "; - #define SNAME(VAL) SDATA (SYMBOL_NAME (VAL)) /* Check if font supports the otf script/language/features specified. @@ -646,7 +644,6 @@ uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec) struct frame * f; HDC context; HFONT check_font, old_font; - DWORD table; int i, retval = 0; struct gcpro gcpro1; @@ -936,7 +933,11 @@ struct font_driver uniscribe_font_driver = NULL, /* otf_drive - use shape instead. */ NULL, /* start_for_frame */ NULL, /* end_for_frame */ - uniscribe_shape + uniscribe_shape, + NULL, /* check */ + NULL, /* get_variation_glyphs */ + NULL, /* filter_properties */ + NULL, /* cached_font_ok */ }; /* Note that this should be called at every startup, not just when dumping, -- cgit v1.2.1 From 1149507c7fe8c24d93448eea2d0114746c580782 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Thu, 24 Mar 2011 03:30:26 +0100 Subject: src/w32term.c (x_set_glyph_string_clipping): Don't pass uninitialized region to CombineRgn. --- src/ChangeLog | 5 +++++ src/w32term.c | 12 ++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index b306ff78ff9..ae40e4638fa 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2011-03-24 Juanma Barranquero + + * w32term.c (x_set_glyph_string_clipping): + Don't pass uninitialized region to CombineRgn. + 2011-03-23 Juanma Barranquero * w32fns.c (x_set_menu_bar_lines): Remove unused variable `olines'. diff --git a/src/w32term.c b/src/w32term.c index 56454faddb9..2252c930711 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -1068,16 +1068,12 @@ x_set_glyph_string_clipping (struct glyph_string *s) w32_set_clip_rectangle (s->hdc, r); else if (n > 1) { - HRGN full_clip, clip1, clip2; - clip1 = CreateRectRgnIndirect (r); - clip2 = CreateRectRgnIndirect (r + 1); - if (CombineRgn (full_clip, clip1, clip2, RGN_OR) != ERROR) - { - SelectClipRgn (s->hdc, full_clip); - } + HRGN clip1 = CreateRectRgnIndirect (r); + HRGN clip2 = CreateRectRgnIndirect (r + 1); + if (CombineRgn (clip1, clip1, clip2, RGN_OR) != ERROR) + SelectClipRgn (s->hdc, clip1); DeleteObject (clip1); DeleteObject (clip2); - DeleteObject (full_clip); } s->num_clips = n; } -- cgit v1.2.1 From 44f730c85e90d32d205e4d6ea2284de2eda4aacf Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 23 Mar 2011 21:17:44 -0700 Subject: * xselect.c (x_check_property_data): Return correct size (Bug#8335). --- src/ChangeLog | 4 ++++ src/xselect.c | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index a8bda0915f6..cdde9673fbd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2011-03-24 Paul Eggert + + * xselect.c (x_check_property_data): Return correct size (Bug#8335). + 2011-03-23 Paul Eggert * xterm.c (x_make_frame_visible, same_x_server): Redo to avoid overflow diff --git a/src/xselect.c b/src/xselect.c index 5254fa96838..451b2a0b13f 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -2190,7 +2190,8 @@ and t is the same as `SECONDARY'. */) ***********************************************************************/ /* Check that lisp values are of correct type for x_fill_property_data. That is, number, string or a cons with two numbers (low and high 16 - bit parts of a 32 bit number). */ + bit parts of a 32 bit number). Return the number of items in DATA, + or -1 if there is an error. */ int x_check_property_data (Lisp_Object data) @@ -2198,15 +2199,16 @@ x_check_property_data (Lisp_Object data) Lisp_Object iter; int size = 0; - for (iter = data; CONSP (iter) && size != -1; iter = XCDR (iter), ++size) + for (iter = data; CONSP (iter); iter = XCDR (iter)) { Lisp_Object o = XCAR (iter); if (! NUMBERP (o) && ! STRINGP (o) && ! CONSP (o)) - size = -1; + return -1; else if (CONSP (o) && (! NUMBERP (XCAR (o)) || ! NUMBERP (XCDR (o)))) - size = -1; + return -1; + size++; } return size; -- cgit v1.2.1 From 03d0a10961746346940115a5ff1779f4e7a455f7 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 24 Mar 2011 00:36:32 -0700 Subject: * image.c (tiff_load): Fix off-by-one image count (Bug#8336). --- src/ChangeLog | 2 ++ src/image.c | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index cdde9673fbd..998e2014c69 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-24 Paul Eggert + * image.c (tiff_load): Fix off-by-one image count (Bug#8336). + * xselect.c (x_check_property_data): Return correct size (Bug#8335). 2011-03-23 Paul Eggert diff --git a/src/image.c b/src/image.c index 7584f9bb2c0..695ac143fde 100644 --- a/src/image.c +++ b/src/image.c @@ -6754,7 +6754,7 @@ tiff_load (struct frame *f, struct image *img) TIFF *tiff; int width, height, x, y, count; uint32 *buf; - int rc, rc2; + int rc; XImagePtr ximg; tiff_memory_source memsrc; Lisp_Object image; @@ -6842,8 +6842,8 @@ tiff_load (struct frame *f, struct image *img) rc = fn_TIFFReadRGBAImage (tiff, width, height, buf, 0); /* Count the number of images in the file. */ - for (count = 1, rc2 = 1; rc2; count++) - rc2 = fn_TIFFSetDirectory (tiff, count); + for (count = 1; fn_TIFFSetDirectory (tiff, count); count++) + continue; if (count > 1) img->data.lisp_val = Fcons (Qcount, -- cgit v1.2.1 From 9a2c6e0545bc418137abab8fb675f53c4f461853 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 24 Mar 2011 01:03:03 -0700 Subject: * keyboard.c (syms_of_keyboard): Use the same style as later in this function when indexing through an array. This also works around GCC bug 48267. --- src/ChangeLog | 4 ++++ src/keyboard.c | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 998e2014c69..88190f46179 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2011-03-24 Paul Eggert + * keyboard.c (syms_of_keyboard): Use the same style as later + in this function when indexing through an array. This also + works around GCC bug 48267. + * image.c (tiff_load): Fix off-by-one image count (Bug#8336). * xselect.c (x_check_property_data): Return correct size (Bug#8335). diff --git a/src/keyboard.c b/src/keyboard.c index fc8622de0a1..72d955637b3 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -11574,12 +11574,12 @@ syms_of_keyboard (void) last_point_position_window = Qnil; { - const struct event_head *p; + int i; + int len = sizeof (head_table) / sizeof (head_table[0]); - for (p = head_table; - p < head_table + (sizeof (head_table) / sizeof (head_table[0])); - p++) + for (i = 0; i < len; i++) { + const struct event_head *p = &head_table[i]; *p->var = intern_c_string (p->name); staticpro (p->var); Fput (*p->var, Qevent_kind, *p->kind); -- cgit v1.2.1 From 0f4a96b5d7de244a7be6fc98f6a66d3d1e6a7569 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Fri, 25 Mar 2011 16:39:59 +0100 Subject: nt/*.c, src/*.c: Remove unused variables. * nt/addpm.c (main): Remove unused variable `retval'. * nt/preprep.c (main): Remove unused variable `ptr'. * src/dispextern.h (glyph_matric): Use #if GLYPH_DEBUG, not #ifdef. * src/fileio.c (check_executable) [DOS_NT]: Remove unused variables `len' and `suffix'. (Fset_file_selinux_context) [HAVE_LIBSELINUX]: Move here declaration of variables specific to SELinux and computation of `encoded_absname'. * src/image.c (XPutPixel): Remove unused variable `height'. * src/keyboard.c (make_lispy_event): Remove unused variable `hpos'. * src/unexw32.c (get_section_info): Remove unused variable `section'. * src/w32.c (stat): Remove unused variables `drive_root' and `devtype'. (system_process_attributes): Remove unused variable `sess'. (sys_read): Remove unused variable `err'. * src/w32fns.c (top): Wrap variables with #if GLYPH_DEBUG, not #ifdef. (w32_wnd_proc): Remove unused variable `isdead'. (unwind_create_frame): Use #if GLYPH_DEBUG, not #ifdef. (Fx_server_max_request_size): Remove unused variable `dpyinfo'. (x_create_tip_frame): Remove unused variable `tem'. * src/w32inevt.c (w32_console_read_socket): Remove unused variable `no_events'. * src/w32term.c (x_draw_composite_glyph_string_foreground): Remove unused variable `width'. --- src/ChangeLog | 33 ++++++++++++++++++++++++++++++++- src/dispextern.h | 2 +- src/fileio.c | 9 ++++----- src/image.c | 1 - src/keyboard.c | 1 - src/unexw32.c | 1 - src/w32.c | 4 ---- src/w32fns.c | 9 +++------ src/w32inevt.c | 1 - src/w32term.c | 1 - 10 files changed, 40 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index ae40e4638fa..3dfc86a4778 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,34 @@ +2011-03-25 Juanma Barranquero + + * dispextern.h (glyph_matric): Use #if GLYPH_DEBUG, not #ifdef. + + * fileio.c (check_executable) [DOS_NT]: Remove unused variables `len' + and `suffix'. + (Fset_file_selinux_context) [HAVE_LIBSELINUX]: Move here declaration + of variables specific to SELinux and computation of `encoded_absname'. + + * image.c (XPutPixel): Remove unused variable `height'. + + * keyboard.c (make_lispy_event): Remove unused variable `hpos'. + + * unexw32.c (get_section_info): Remove unused variable `section'. + + * w32.c (stat): Remove unused variables `drive_root' and `devtype'. + (system_process_attributes): Remove unused variable `sess'. + (sys_read): Remove unused variable `err'. + + * w32fns.c (top): Wrap variables with #if GLYPH_DEBUG, not #ifdef. + (w32_wnd_proc): Remove unused variable `isdead'. + (unwind_create_frame): Use #if GLYPH_DEBUG, not #ifdef. + (Fx_server_max_request_size): Remove unused variable `dpyinfo'. + (x_create_tip_frame): Remove unused variable `tem'. + + * w32inevt.c (w32_console_read_socket): + Remove unused variable `no_events'. + + * w32term.c (x_draw_composite_glyph_string_foreground): + Remove unused variable `width'. + 2011-03-24 Juanma Barranquero * w32term.c (x_set_glyph_string_clipping): @@ -40,7 +71,7 @@ * buffer.c (Fkill_all_local_variables): * keyboard.c (Fcommand_execute, Fsuspend_emacs, safe_run_hooks_1): Use Frun_hooks. - (command_loop_1): Use Frun_hooks. Call safe_run_hooks + (command_loop_1): Use Frun_hooks. Call safe_run_hooks unconditionnaly since it does the check itself. 2011-03-23 Paul Eggert diff --git a/src/dispextern.h b/src/dispextern.h index 9843dfd1fcd..d1e0475dd15 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -662,7 +662,7 @@ struct glyph_matrix line. */ unsigned header_line_p : 1; -#ifdef GLYPH_DEBUG +#if GLYPH_DEBUG /* A string identifying the method used to display the matrix. */ char method[512]; #endif diff --git a/src/fileio.c b/src/fileio.c index 64dda0a78e4..bab9360d3bc 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2359,8 +2359,6 @@ static int check_executable (char *filename) { #ifdef DOS_NT - int len = strlen (filename); - char *suffix; struct stat st; if (stat (filename, &st) < 0) return 0; @@ -2786,13 +2784,14 @@ as a list ("user", "role", "type", "range"). Has no effect if SELinux is disabled. */) (Lisp_Object filename, Lisp_Object context) { - Lisp_Object absname, encoded_absname; + Lisp_Object absname; Lisp_Object handler; +#if HAVE_LIBSELINUX + Lisp_Object encoded_absname; Lisp_Object user = CAR_SAFE (context); Lisp_Object role = CAR_SAFE (CDR_SAFE (context)); Lisp_Object type = CAR_SAFE (CDR_SAFE (CDR_SAFE (context))); Lisp_Object range = CAR_SAFE (CDR_SAFE (CDR_SAFE (CDR_SAFE (context)))); -#if HAVE_LIBSELINUX security_context_t con; int fail, conlength; context_t parsed_con; @@ -2806,9 +2805,9 @@ is disabled. */) if (!NILP (handler)) return call3 (handler, Qset_file_selinux_context, absname, context); +#if HAVE_LIBSELINUX encoded_absname = ENCODE_FILE (absname); -#if HAVE_LIBSELINUX if (is_selinux_enabled ()) { /* Get current file context. */ diff --git a/src/image.c b/src/image.c index 7584f9bb2c0..04c6b1a2ad5 100644 --- a/src/image.c +++ b/src/image.c @@ -4485,7 +4485,6 @@ static void XPutPixel (XImagePtr ximg, int x, int y, COLORREF color) { int width = ximg->info.bmiHeader.biWidth; - int height = ximg->info.bmiHeader.biHeight; unsigned char * pixel; /* True color images. */ diff --git a/src/keyboard.c b/src/keyboard.c index 39848ee490d..6ce102c7d65 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -5399,7 +5399,6 @@ make_lispy_event (struct input_event *event) && (event->modifiers & down_modifier)) { Lisp_Object items, item; - int hpos; int i; /* Find the menu bar item under `column'. */ diff --git a/src/unexw32.c b/src/unexw32.c index cd8211d6bee..e03fa6c9b9a 100644 --- a/src/unexw32.c +++ b/src/unexw32.c @@ -341,7 +341,6 @@ get_section_info (file_data *p_infile) { PIMAGE_DOS_HEADER dos_header; PIMAGE_NT_HEADERS nt_header; - PIMAGE_SECTION_HEADER section; int overlap; dos_header = (PIMAGE_DOS_HEADER) p_infile->file_base; diff --git a/src/w32.c b/src/w32.c index 721cea07d20..bbf777b2e1d 100644 --- a/src/w32.c +++ b/src/w32.c @@ -3250,8 +3250,6 @@ int stat (const char * path, struct stat * buf) { char *name, *r; - char drive_root[4]; - UINT devtype; WIN32_FIND_DATA wfd; HANDLE fh; unsigned __int64 fake_inode; @@ -4043,7 +4041,6 @@ system_process_attributes (Lisp_Object pid) TOKEN_PRIMARY_GROUP group_token; unsigned euid; unsigned egid; - DWORD sess; PROCESS_MEMORY_COUNTERS mem; PROCESS_MEMORY_COUNTERS_EX mem_ex; DWORD minrss, maxrss; @@ -5408,7 +5405,6 @@ sys_read (int fd, char * buffer, unsigned int count) { HANDLE hnd = fd_info[fd].hnd; OVERLAPPED *ovl = &fd_info[fd].cp->ovl_read; - DWORD err = 0; int rc = 0; COMMTIMEOUTS ct; diff --git a/src/w32fns.c b/src/w32fns.c index d833f9d550f..821cc671646 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -183,7 +183,7 @@ unsigned int msh_mousewheel = 0; #define MENU_FREE_DELAY 1000 static unsigned menu_free_timer = 0; -#ifdef GLYPH_DEBUG +#if GLYPH_DEBUG int image_cache_refcount, dpyinfo_refcount; #endif @@ -2862,7 +2862,6 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) base character (ie. translating the base key plus shift modifier). */ int add; - int isdead = 0; KEY_EVENT_RECORD key; key.bKeyDown = TRUE; @@ -3980,7 +3979,7 @@ unwind_create_frame (Lisp_Object frame) /* If frame is ``official'', nothing to do. */ if (!CONSP (Vframe_list) || !EQ (XCAR (Vframe_list), frame)) { -#ifdef GLYPH_DEBUG +#if GLYPH_DEBUG struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); #endif @@ -4521,8 +4520,6 @@ DISPLAY should be either a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display. */) (Lisp_Object display) { - struct w32_display_info *dpyinfo = check_x_display_info (display); - return make_number (1); } @@ -5171,7 +5168,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, Lisp_Object parms, Lisp_Object text) { struct frame *f; - Lisp_Object frame, tem; + Lisp_Object frame; Lisp_Object name; long window_prompting = 0; int width, height; diff --git a/src/w32inevt.c b/src/w32inevt.c index c4858dea908..465f5ccb70f 100644 --- a/src/w32inevt.c +++ b/src/w32inevt.c @@ -677,7 +677,6 @@ w32_console_read_socket (struct terminal *terminal, int expected, struct input_event *hold_quit) { - BOOL no_events = TRUE; int nev, ret = 0, add; int isdead; diff --git a/src/w32term.c b/src/w32term.c index 2252c930711..f6a6ba3e82f 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -1289,7 +1289,6 @@ x_draw_composite_glyph_string_foreground (struct glyph_string *s) else if (! s->first_glyph->u.cmp.automatic) { int y = s->ybase; - int width = 0; HFONT old_font; old_font = SelectObject (s->hdc, FONT_HANDLE (font)); -- cgit v1.2.1 From a9b53ad3778a9d61fdf66681e33d2dc75f7bd8f3 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Fri, 25 Mar 2011 18:37:15 +0100 Subject: src/fileio.c: Move computation of encoded_absname inside `if'. --- src/fileio.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/fileio.c b/src/fileio.c index bab9360d3bc..85431dfd5b1 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2806,11 +2806,10 @@ is disabled. */) return call3 (handler, Qset_file_selinux_context, absname, context); #if HAVE_LIBSELINUX - encoded_absname = ENCODE_FILE (absname); - if (is_selinux_enabled ()) { /* Get current file context. */ + encoded_absname = ENCODE_FILE (absname); conlength = lgetfilecon (SSDATA (encoded_absname), &con); if (conlength > 0) { -- cgit v1.2.1 From 6b1f9ba4770e8f488c378cfa87dc868cad62c436 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Fri, 25 Mar 2011 19:06:33 +0100 Subject: src/*.c: Remove unused function parameters. * buffer.c (defvar_per_buffer): Remove unused parameter `doc'. (DEFVAR_PER_BUFFER): Don't pass it. * dispnew.c (row_equal_p, add_row_entry): Remove unused parameter `w'. (scrolling_window): Don't pass it. --- src/ChangeLog | 8 ++++++++ src/buffer.c | 4 ++-- src/dispnew.c | 24 ++++++++++-------------- 3 files changed, 20 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 3dfc86a4778..bd06cd1869e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2011-03-25 Juanma Barranquero + + * buffer.c (defvar_per_buffer): Remove unused parameter `doc'. + (DEFVAR_PER_BUFFER): Don't pass it. + + * dispnew.c (row_equal_p, add_row_entry): Remove unused parameter `w'. + (scrolling_window): Don't pass it. + 2011-03-25 Juanma Barranquero * dispextern.h (glyph_matric): Use #if GLYPH_DEBUG, not #ifdef. diff --git a/src/buffer.c b/src/buffer.c index da2cc1573c8..8b56b285e48 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5224,12 +5224,12 @@ init_buffer (void) #define DEFVAR_PER_BUFFER(lname, vname, type, doc) \ do { \ static struct Lisp_Buffer_Objfwd bo_fwd; \ - defvar_per_buffer (&bo_fwd, lname, vname, type, 0); \ + defvar_per_buffer (&bo_fwd, lname, vname, type); \ } while (0) static void defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, const char *namestring, - Lisp_Object *address, Lisp_Object type, char *doc) + Lisp_Object *address, Lisp_Object type) { struct Lisp_Symbol *sym; int offset; diff --git a/src/dispnew.c b/src/dispnew.c index 1408bea2fc6..093ed9524e4 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -1297,13 +1297,11 @@ line_draw_cost (struct glyph_matrix *matrix, int vpos) /* Test two glyph rows A and B for equality. Value is non-zero if A - and B have equal contents. W is the window to which the glyphs - rows A and B belong. It is needed here to test for partial row - visibility. MOUSE_FACE_P non-zero means compare the mouse_face_p - flags of A and B, too. */ + and B have equal contents. MOUSE_FACE_P non-zero means compare the + mouse_face_p flags of A and B, too. */ static INLINE int -row_equal_p (struct window *w, struct glyph_row *a, struct glyph_row *b, int mouse_face_p) +row_equal_p (struct glyph_row *a, struct glyph_row *b, int mouse_face_p) { if (a == b) return 1; @@ -4251,17 +4249,16 @@ static int runs_size; static struct run **runs; -/* Add glyph row ROW to the scrolling hash table during the scrolling - of window W. */ +/* Add glyph row ROW to the scrolling hash table. */ static INLINE struct row_entry * -add_row_entry (struct window *w, struct glyph_row *row) +add_row_entry (struct glyph_row *row) { struct row_entry *entry; int i = row->hash % row_table_size; entry = row_table[i]; - while (entry && !row_equal_p (w, entry->row, row, 1)) + while (entry && !row_equal_p (entry->row, row, 1)) entry = entry->next; if (entry == NULL) @@ -4328,7 +4325,7 @@ scrolling_window (struct window *w, int header_line_p) && c->y == d->y && MATRIX_ROW_BOTTOM_Y (c) <= yb && MATRIX_ROW_BOTTOM_Y (d) <= yb - && row_equal_p (w, c, d, 1)) + && row_equal_p (c, d, 1)) { assign_row (c, d); d->enabled_p = 0; @@ -4381,8 +4378,7 @@ scrolling_window (struct window *w, int header_line_p) && (MATRIX_ROW (current_matrix, i - 1)->y == MATRIX_ROW (desired_matrix, j - 1)->y) && !MATRIX_ROW (desired_matrix, j - 1)->redraw_fringe_bitmaps_p - && row_equal_p (w, - MATRIX_ROW (desired_matrix, i - 1), + && row_equal_p (MATRIX_ROW (desired_matrix, i - 1), MATRIX_ROW (current_matrix, j - 1), 1)) --i, --j; last_new = i; @@ -4443,7 +4439,7 @@ scrolling_window (struct window *w, int header_line_p) { if (MATRIX_ROW (current_matrix, i)->enabled_p) { - entry = add_row_entry (w, MATRIX_ROW (current_matrix, i)); + entry = add_row_entry (MATRIX_ROW (current_matrix, i)); old_lines[i] = entry; ++entry->old_uses; } @@ -4454,7 +4450,7 @@ scrolling_window (struct window *w, int header_line_p) for (i = first_new; i < last_new; ++i) { xassert (MATRIX_ROW_ENABLED_P (desired_matrix, i)); - entry = add_row_entry (w, MATRIX_ROW (desired_matrix, i)); + entry = add_row_entry (MATRIX_ROW (desired_matrix, i)); ++entry->new_uses; entry->new_line_number = i; new_lines[i] = entry; -- cgit v1.2.1 From 2ecf6fdb2806188ebf9f54a9bbead89be4803e75 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Fri, 25 Mar 2011 16:00:25 -0400 Subject: Discard changes to buffer->clip_changed incurred during fontification. * src/xdisp.c (handle_fontified_prop): Discard changes to clip_changed incurred during fontification. --- src/ChangeLog | 5 +++++ src/xdisp.c | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index bd06cd1869e..c7b0edede3f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2011-03-25 Chong Yidong + + * xdisp.c (handle_fontified_prop): Discard changes to clip_changed + incurred during fontification. + 2011-03-25 Juanma Barranquero * buffer.c (defvar_per_buffer): Remove unused parameter `doc'. diff --git a/src/xdisp.c b/src/xdisp.c index 457a5e3e11b..cc5d61abdb2 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -3164,6 +3164,9 @@ handle_fontified_prop (struct it *it) { int count = SPECPDL_INDEX (); Lisp_Object val; + struct buffer *obuf = current_buffer; + int begv = BEGV, zv = ZV; + int old_clip_changed = current_buffer->clip_changed; val = Vfontification_functions; specbind (Qfontification_functions, Qnil); @@ -3209,6 +3212,23 @@ handle_fontified_prop (struct it *it) unbind_to (count, Qnil); + /* Fontification functions routinely call `save-restriction'. + Normally, this tags clip_changed, which can confuse redisplay + (see discussion in Bug#6671). Since we don't perform any + special handling of fontification changes in the case where + `save-restriction' isn't called, there's no point doing so in + this case either. So, if the buffer's restrictions are + actually left unchanged, reset clip_changed. */ + if (obuf == current_buffer) + { + if (begv == BEGV && zv == ZV) + current_buffer->clip_changed = old_clip_changed; + } + /* There isn't much we can reasonably do to protect against + misbehaving fontification, but here's a fig leaf. */ + else if (!NILP (BVAR (obuf, name))) + set_buffer_internal_1 (obuf); + /* The fontification code may have added/removed text. It could do even a lot worse, but let's at least protect against the most obvious case where only the text past `pos' gets changed', -- cgit v1.2.1 From f868cd8a7186e86e4c9bbd52de2aca99fa94648f Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Sat, 26 Mar 2011 02:23:15 +0100 Subject: src/*.h: Remove unused parameters and functions. * keyboard.h (timer_check, show_help_echo): Remove unused parameters. * keyboard.c (timer_check): Remove parameter `do_it_now', unused since 1996-04-12T06:01:29Z!rms@gnu.org. (show_help_echo): Remove parameter `ok_to_overwrite_keystroke_echo', unused since 2008-04-19T19:30:53Z!monnier@iro.umontreal.ca. * keyboard.c (read_char): * w32menu.c (w32_menu_display_help): * xmenu.c (show_help_event, menu_help_callback): Adjust calls to `show_help_echo'. * gtkutil.c (xg_maybe_add_timer): * keyboard.c (readable_events): * process.c (wait_reading_process_output): * xmenu.c (x_menu_wait_for_event): Adjust calls to `timer_check'. * insdel.c (adjust_markers_gap_motion): Remove; no-op since 1998-01-02T21:29:48Z!rms@gnu.org. (gap_left, gap_right): Don't call it. --- src/ChangeLog | 23 +++++++++++++++++++ src/gtkutil.c | 2 +- src/insdel.c | 72 +++------------------------------------------------------- src/keyboard.c | 20 +++++----------- src/keyboard.h | 4 ++-- src/process.c | 4 ++-- src/w32menu.c | 2 +- src/xmenu.c | 6 ++--- 8 files changed, 41 insertions(+), 92 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index c7b0edede3f..69e850610bc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,26 @@ +2011-03-26 Juanma Barranquero + + * keyboard.h (timer_check, show_help_echo): Remove unused parameters. + + * keyboard.c (timer_check): Remove parameter `do_it_now', + unused since 1996-04-12T06:01:29Z!rms@gnu.org. + (show_help_echo): Remove parameter `ok_to_overwrite_keystroke_echo', + unused since 2008-04-19T19:30:53Z!monnier@iro.umontreal.ca. + + * keyboard.c (read_char): + * w32menu.c (w32_menu_display_help): + * xmenu.c (show_help_event, menu_help_callback): + Adjust calls to `show_help_echo'. + + * gtkutil.c (xg_maybe_add_timer): + * keyboard.c (readable_events): + * process.c (wait_reading_process_output): + * xmenu.c (x_menu_wait_for_event): Adjust calls to `timer_check'. + + * insdel.c (adjust_markers_gap_motion): + Remove; no-op since 1998-01-02T21:29:48Z!rms@gnu.org. + (gap_left, gap_right): Don't call it. + 2011-03-25 Chong Yidong * xdisp.c (handle_fontified_prop): Discard changes to clip_changed diff --git a/src/gtkutil.c b/src/gtkutil.c index 754f61e366d..4e5ecce76c7 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -1555,7 +1555,7 @@ static gboolean xg_maybe_add_timer (gpointer data) { struct xg_dialog_data *dd = (struct xg_dialog_data *) data; - EMACS_TIME next_time = timer_check (1); + EMACS_TIME next_time = timer_check (); long secs = EMACS_SECS (next_time); long usecs = EMACS_USECS (next_time); diff --git a/src/insdel.c b/src/insdel.c index 1cbe3de20d2..4bdcb4bc0b7 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -41,8 +41,6 @@ static void insert_from_buffer_1 (struct buffer *buf, int inherit); static void gap_left (EMACS_INT charpos, EMACS_INT bytepos, int newgap); static void gap_right (EMACS_INT charpos, EMACS_INT bytepos); -static void adjust_markers_gap_motion (EMACS_INT from, EMACS_INT to, - EMACS_INT amount); static void adjust_markers_for_insert (EMACS_INT from, EMACS_INT from_byte, EMACS_INT to, EMACS_INT to_byte, int before_markers); @@ -162,10 +160,9 @@ gap_left (EMACS_INT charpos, EMACS_INT bytepos, int newgap) memmove (to, from, i); } - /* Adjust markers, and buffer data structure, to put the gap at BYTEPOS. - BYTEPOS is where the loop above stopped, which may be what was specified - or may be where a quit was detected. */ - adjust_markers_gap_motion (bytepos, GPT_BYTE, GAP_SIZE); + /* Adjust buffer data structure, to put the gap at BYTEPOS. + BYTEPOS is where the loop above stopped, which may be what + was specified or may be where a quit was detected. */ GPT_BYTE = bytepos; GPT = charpos; if (bytepos < charpos) @@ -217,8 +214,6 @@ gap_right (EMACS_INT charpos, EMACS_INT bytepos) from += i, to += i; } - adjust_markers_gap_motion (GPT_BYTE + GAP_SIZE, bytepos + GAP_SIZE, - - GAP_SIZE); GPT = charpos; GPT_BYTE = bytepos; if (bytepos < charpos) @@ -227,67 +222,6 @@ gap_right (EMACS_INT charpos, EMACS_INT bytepos) QUIT; } -/* Add AMOUNT to the byte position of every marker in the current buffer - whose current byte position is between FROM (exclusive) and TO (inclusive). - - Also, any markers past the outside of that interval, in the direction - of adjustment, are first moved back to the near end of the interval - and then adjusted by AMOUNT. - - When the latter adjustment is done, if AMOUNT is negative, - we record the adjustment for undo. (This case happens only for - deletion.) - - The markers' character positions are not altered, - because gap motion does not affect character positions. */ - -int adjust_markers_test; - -static void -adjust_markers_gap_motion (EMACS_INT from, EMACS_INT to, EMACS_INT amount) -{ - /* Now that a marker has a bytepos, not counting the gap, - nothing needs to be done here. */ -#if 0 - Lisp_Object marker; - register struct Lisp_Marker *m; - register EMACS_INT mpos; - - marker = BUF_MARKERS (current_buffer); - - while (!NILP (marker)) - { - m = XMARKER (marker); - mpos = m->bytepos; - if (amount > 0) - { - if (mpos > to && mpos < to + amount) - { - if (adjust_markers_test) - abort (); - mpos = to + amount; - } - } - else - { - /* Here's the case where a marker is inside text being deleted. - AMOUNT can be negative for gap motion, too, - but then this range contains no markers. */ - if (mpos > from + amount && mpos <= from) - { - if (adjust_markers_test) - abort (); - mpos = from + amount; - } - } - if (mpos > from && mpos <= to) - mpos += amount; - m->bufpos = mpos; - marker = m->chain; - } -#endif -} - /* Adjust all markers for a deletion whose range in bytes is FROM_BYTE to TO_BYTE. The range in charpos is FROM to TO. diff --git a/src/keyboard.c b/src/keyboard.c index 6ce102c7d65..c4ef2795f6a 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -351,7 +351,7 @@ Lisp_Object Qmenu_bar; Lisp_Object recursive_edit_unwind (Lisp_Object buffer), command_loop (void); Lisp_Object Fthis_command_keys (void); Lisp_Object Qextended_command_history; -EMACS_TIME timer_check (int do_it_now); +EMACS_TIME timer_check (void); static void record_menu_key (Lisp_Object c); static int echo_length (void); @@ -2068,16 +2068,12 @@ make_ctrl_char (int c) the `display' property). POS is the position in that string under the mouse. - OK_TO_OVERWRITE_KEYSTROKE_ECHO non-zero means it's okay if the help - echo overwrites a keystroke echo currently displayed in the echo - area. - Note: this function may only be called with HELP nil or a string from X code running asynchronously. */ void show_help_echo (Lisp_Object help, Lisp_Object window, Lisp_Object object, - Lisp_Object pos, int ok_to_overwrite_keystroke_echo) + Lisp_Object pos) { if (!NILP (help) && !STRINGP (help)) { @@ -3007,7 +3003,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event htem = Fcdr (htem); position = Fcar (htem); - show_help_echo (help, window, object, position, 0); + show_help_echo (help, window, object, position); /* We stopped being idle for this event; undo that. */ if (!end_time) @@ -3309,7 +3305,7 @@ static int readable_events (int flags) { if (flags & READABLE_EVENTS_DO_TIMERS_NOW) - timer_check (1); + timer_check (); /* If the buffer contains only FOCUS_IN_EVENT events, and READABLE_EVENTS_FILTER_EVENTS is set, report it as empty. */ @@ -4383,14 +4379,10 @@ timer_check_2 (void) Returns the time to wait until the next timer fires. If no timer is active, return -1. - As long as any timer is ripe, we run it. - - DO_IT_NOW is now ignored. It used to mean that we should - run the timer directly instead of queueing a timer-event. - Now we always run timers directly. */ + As long as any timer is ripe, we run it. */ EMACS_TIME -timer_check (int do_it_now) +timer_check (void) { EMACS_TIME nexttime; diff --git a/src/keyboard.h b/src/keyboard.h index 00745a09140..ba3c909c4dd 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -507,7 +507,7 @@ extern void kbd_buffer_store_event_hold (struct input_event *, extern void kbd_buffer_unget_event (struct input_event *); extern void poll_for_input_1 (void); extern void show_help_echo (Lisp_Object, Lisp_Object, Lisp_Object, - Lisp_Object, int); + Lisp_Object); extern void gen_help_event (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, EMACS_INT); extern void kbd_buffer_store_help_event (Lisp_Object, Lisp_Object); @@ -517,7 +517,7 @@ extern void add_user_signal (int, const char *); extern int tty_read_avail_input (struct terminal *, int, struct input_event *); -extern EMACS_TIME timer_check (int); +extern EMACS_TIME timer_check (void); extern void mark_kboards (void); #ifdef WINDOWSNT diff --git a/src/process.c b/src/process.c index 4a7202388bf..639b6a49fce 100644 --- a/src/process.c +++ b/src/process.c @@ -4548,7 +4548,7 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd, struct buffer *old_buffer = current_buffer; Lisp_Object old_window = selected_window; - timer_delay = timer_check (1); + timer_delay = timer_check (); /* If a timer has run, this might have changed buffers an alike. Make read_key_sequence aware of that. */ @@ -6946,7 +6946,7 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd, do { int old_timers_run = timers_run; - timer_delay = timer_check (1); + timer_delay = timer_check (); if (timers_run != old_timers_run && do_display) /* We must retry, since a timer may have requeued itself and that could alter the time delay. */ diff --git a/src/w32menu.c b/src/w32menu.c index c363fdd72cb..f092ff87bf2 100644 --- a/src/w32menu.c +++ b/src/w32menu.c @@ -1616,7 +1616,7 @@ w32_menu_display_help (HWND owner, HMENU menu, UINT item, UINT flags) else /* X version has a loop through frames here, which doesn't appear to do anything, unless it has some side effect. */ - show_help_echo (help, Qnil, Qnil, Qnil, 1); + show_help_echo (help, Qnil, Qnil, Qnil); } } diff --git a/src/xmenu.c b/src/xmenu.c index 60ac27a5b8f..8ecef00c88e 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -383,7 +383,7 @@ x_menu_wait_for_event (void *data) #endif ) { - EMACS_TIME next_time = timer_check (1), *ntp; + EMACS_TIME next_time = timer_check (), *ntp; long secs = EMACS_SECS (next_time); long usecs = EMACS_USECS (next_time); SELECT_TYPE read_fds; @@ -712,7 +712,7 @@ show_help_event (FRAME_PTR f, xt_or_gtk_widget widget, Lisp_Object help) break; } #endif - show_help_echo (help, Qnil, Qnil, Qnil, 1); + show_help_echo (help, Qnil, Qnil, Qnil); } } @@ -2201,7 +2201,7 @@ menu_help_callback (char *help_string, int pane, int item) Fcons (pane_name, Fcons (make_number (pane), Qnil))); show_help_echo (help_string ? build_string (help_string) : Qnil, - Qnil, menu_object, make_number (item), 1); + Qnil, menu_object, make_number (item)); } static Lisp_Object -- cgit v1.2.1 From 59eb0929f7ae29f9c970c4188c90c1b460e820a9 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Sat, 26 Mar 2011 03:48:03 +0100 Subject: src/*.c: Fix more warnings about unused parameters. * keymap.c (describe_vector): Remove parameters `indices' and `char_table_depth', unused since 2002-03-01T01:43:26Z!handa@m17n.org. (describe_map, Fdescribe_vector): Adjust calls to `describe_vector'. * w32.c (read_unc_volume): Use parameter `henum', instead of global variable `wget_enum_handle'. --- src/ChangeLog | 7 +++++++ src/keymap.c | 13 ++++--------- src/w32.c | 6 +++--- 3 files changed, 14 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 69e850610bc..cc40c863e97 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,12 @@ 2011-03-26 Juanma Barranquero + * w32.c (read_unc_volume): Use parameter `henum', instead of + global variable `wget_enum_handle'. + + * keymap.c (describe_vector): Remove parameters `indices' and + `char_table_depth', unused since 2002-03-01T01:43:26Z!handa@m17n.org. + (describe_map, Fdescribe_vector): Adjust calls to `describe_vector'. + * keyboard.h (timer_check, show_help_echo): Remove unused parameters. * keyboard.c (timer_check): Remove parameter `do_it_now', diff --git a/src/keymap.c b/src/keymap.c index 06968a0d944..440df06ba4e 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -81,8 +81,7 @@ static void describe_map (Lisp_Object, Lisp_Object, int, Lisp_Object, Lisp_Object*, int, int); static void describe_vector (Lisp_Object, Lisp_Object, Lisp_Object, void (*) (Lisp_Object, Lisp_Object), int, - Lisp_Object, Lisp_Object, int *, - int, int, int); + Lisp_Object, Lisp_Object, int, int); static void silly_event_symbol_error (Lisp_Object); static Lisp_Object get_keyelt (Lisp_Object, int); @@ -3353,7 +3352,7 @@ describe_map (Lisp_Object map, Lisp_Object prefix, || CHAR_TABLE_P (XCAR (tail))) describe_vector (XCAR (tail), prefix, Qnil, elt_describer, partial, shadow, map, - (int *)0, 0, 1, mention_shadow); + 1, mention_shadow); else if (CONSP (XCAR (tail))) { int this_shadowed = 0; @@ -3506,7 +3505,7 @@ DESCRIBER is the output function used; nil means use `princ'. */) specbind (Qstandard_output, Fcurrent_buffer ()); CHECK_VECTOR_OR_CHAR_TABLE (vector); describe_vector (vector, Qnil, describer, describe_vector_princ, 0, - Qnil, Qnil, (int *)0, 0, 0, 0); + Qnil, Qnil, 0, 0); return unbind_to (count, Qnil); } @@ -3539,9 +3538,6 @@ DESCRIBER is the output function used; nil means use `princ'. */) ARGS is simply passed as the second argument to ELT_DESCRIBER. - INDICES and CHAR_TABLE_DEPTH are ignored. They will be removed in - the near future. - KEYMAP_P is 1 if vector is known to be a keymap, so map ESC to M-. ARGS is simply passed as the second argument to ELT_DESCRIBER. */ @@ -3550,8 +3546,7 @@ static void describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args, void (*elt_describer) (Lisp_Object, Lisp_Object), int partial, Lisp_Object shadow, Lisp_Object entire_map, - int *indices, int char_table_depth, int keymap_p, - int mention_shadow) + int keymap_p, int mention_shadow) { Lisp_Object definition; Lisp_Object tem2; diff --git a/src/w32.c b/src/w32.c index bbf777b2e1d..5643b3f073e 100644 --- a/src/w32.c +++ b/src/w32.c @@ -2376,8 +2376,8 @@ readdir (DIR *dirp) if (wnet_enum_handle != INVALID_HANDLE_VALUE) { if (!read_unc_volume (wnet_enum_handle, - dir_find_data.cFileName, - MAX_PATH)) + dir_find_data.cFileName, + MAX_PATH)) return NULL; } /* If we aren't dir_finding, do a find-first, otherwise do a find-next. */ @@ -2487,7 +2487,7 @@ read_unc_volume (HANDLE henum, char *readbuf, int size) count = 1; buffer = alloca (bufsize); - result = WNetEnumResource (wnet_enum_handle, &count, buffer, &bufsize); + result = WNetEnumResource (henum, &count, buffer, &bufsize); if (result != NO_ERROR) return NULL; -- cgit v1.2.1 From dd3f25f792d724f59fac3e2d4faa21b311f21137 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 25 Mar 2011 21:17:38 -0700 Subject: * alloc.c (garbage_collect): Don't assume stack size fits in int. (stack_copy_size): Now size_t, not int. (stack_copy, stack_copy_size): Define only if MAX_SAVE_STACK > 0. --- src/ChangeLog | 6 ++++++ src/alloc.c | 33 ++++++++++++++++++++------------- 2 files changed, 26 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index cc40c863e97..cf9ca86a798 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2011-03-26 Paul Eggert + + * alloc.c (garbage_collect): Don't assume stack size fits in int. + (stack_copy_size): Now size_t, not int. + (stack_copy, stack_copy_size): Define only if MAX_SAVE_STACK > 0. + 2011-03-26 Juanma Barranquero * w32.c (read_unc_volume): Use parameter `henum', instead of diff --git a/src/alloc.c b/src/alloc.c index 66695e7a9bc..00f053e9090 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -254,8 +254,10 @@ const char *pending_malloc_warning; /* Buffer in which we save a copy of the C stack at each GC. */ +#if MAX_SAVE_STACK > 0 static char *stack_copy; -static int stack_copy_size; +static size_t stack_copy_size; +#endif /* Non-zero means ignore malloc warnings. Set during initialization. Currently not used. */ @@ -4903,21 +4905,26 @@ returns nil, because real GC can't be done. */) #if MAX_SAVE_STACK > 0 if (NILP (Vpurify_flag)) { - i = &stack_top_variable - stack_bottom; - if (i < 0) i = -i; - if (i < MAX_SAVE_STACK) + char *stack; + size_t stack_size; + if (&stack_top_variable < stack_bottom) + { + stack = &stack_top_variable; + stack_size = stack_bottom - &stack_top_variable; + } + else + { + stack = stack_bottom; + stack_size = &stack_top_variable - stack_bottom; + } + if (stack_size <= MAX_SAVE_STACK) { - if (stack_copy == 0) - stack_copy = (char *) xmalloc (stack_copy_size = i); - else if (stack_copy_size < i) - stack_copy = (char *) xrealloc (stack_copy, (stack_copy_size = i)); - if (stack_copy) + if (stack_copy_size < stack_size) { - if ((EMACS_INT) (&stack_top_variable - stack_bottom) > 0) - memcpy (stack_copy, stack_bottom, i); - else - memcpy (stack_copy, &stack_top_variable, i); + stack_copy = (char *) xrealloc (stack_copy, stack_size); + stack_copy_size = stack_size; } + memcpy (stack_copy, stack, stack_size); } } #endif /* MAX_SAVE_STACK > 0 */ -- cgit v1.2.1 From 665370491941c11a541eb62411147b73853e8aa3 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 26 Mar 2011 14:20:20 +0200 Subject: Call try_scrolling even if buffer's clip_changed flag is set. src/xdisp.c (redisplay_window): Don't check buffer's clip_changed flag as a prerequisite for invoking try_scrolling. (Bug#6671) --- src/ChangeLog | 5 +++++ src/xdisp.c | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index cc40c863e97..06972a5bcb1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2011-03-26 Eli Zaretskii + + * xdisp.c (redisplay_window): Don't check buffer's clip_changed + flag as a prerequisite for invoking try_scrolling. (Bug#6671) + 2011-03-26 Juanma Barranquero * w32.c (read_unc_volume): Use parameter `henum', instead of diff --git a/src/xdisp.c b/src/xdisp.c index cc5d61abdb2..6f9f56df979 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -14176,7 +14176,6 @@ redisplay_window (Lisp_Object window, int just_this_one_p) || temp_scroll_step || NUMBERP (BVAR (current_buffer, scroll_up_aggressively)) || NUMBERP (BVAR (current_buffer, scroll_down_aggressively))) - && !current_buffer->clip_changed && CHARPOS (startp) >= BEGV && CHARPOS (startp) <= ZV) { -- cgit v1.2.1 From c5101a77a4066d979698d356c3a9c7f387007359 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 26 Mar 2011 19:12:36 -0700 Subject: Variadic C functions now count arguments with size_t, not int. --- src/ChangeLog | 19 +++++++++++++ src/alloc.c | 14 +++++----- src/callint.c | 5 ++-- src/callproc.c | 14 +++++----- src/character.c | 10 ++++--- src/charset.c | 7 ++--- src/coding.c | 18 ++++++------- src/data.c | 31 +++++++++++----------- src/dbusbind.c | 51 +++++++++++++++++------------------ src/editfns.c | 38 +++++++++++++------------- src/eval.c | 82 ++++++++++++++++++++++++++++++--------------------------- src/fns.c | 63 +++++++++++++++++++++----------------------- src/font.c | 4 +-- src/frame.c | 4 +-- src/lisp.h | 10 +++---- src/process.c | 15 ++++++----- src/xdisp.c | 4 +-- 17 files changed, 208 insertions(+), 181 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index cf9ca86a798..32f64893ae6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,22 @@ +2011-03-27 Paul Eggert + + Variadic C functions now count arguments with size_t, not int. + This avoids an unnecessary limitation on 64-bit machines, which + caused (substring ...) to crash on large vectors (Bug#8344). + * lisp.h (struct Lisp_Subr.function.aMANY): Now takes size_t, not int. + (DEFUN_ARGS_MANY, internal_condition_case_n, safe_call): Likewise. + All variadic functions changed accordingly. + (struct gcpro.nvars): Now size_t, not int. All uses changed. + * data.c (arith_driver, float_arith_driver): Likewise. + * editfns.c (general_insert_function): Likewise. + * eval.c (struct backtrace.nargs, interactive_p) + (internal_condition_case_n, run_hook_with_args, apply_lambda) + (funcall_lambda, mark_backtrace): Likewise. + * fns.c (concat): Likewise. + * frame.c (x_set_frame_parameters): Likewise. + * fns.c (get_key_arg): Now accepts and returns size_t, and returns + 0 if not found, not -1. All callers changed. + 2011-03-26 Paul Eggert * alloc.c (garbage_collect): Don't assume stack size fits in int. diff --git a/src/alloc.c b/src/alloc.c index 00f053e9090..177a2266fb6 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -2707,7 +2707,7 @@ DEFUN ("list", Flist, Slist, 0, MANY, 0, doc: /* Return a newly created list with specified arguments as elements. Any number of arguments, even zero arguments, are allowed. usage: (list &rest OBJECTS) */) - (int nargs, register Lisp_Object *args) + (size_t nargs, register Lisp_Object *args) { register Lisp_Object val; val = Qnil; @@ -2923,10 +2923,10 @@ DEFUN ("vector", Fvector, Svector, 0, MANY, 0, doc: /* Return a newly created vector with specified arguments as elements. Any number of arguments, even zero arguments, are allowed. usage: (vector &rest OBJECTS) */) - (register int nargs, Lisp_Object *args) + (register size_t nargs, Lisp_Object *args) { register Lisp_Object len, val; - register int i; + register size_t i; register struct Lisp_Vector *p; XSETFASTINT (len, nargs); @@ -2945,10 +2945,10 @@ stack size, (optional) doc string, and (optional) interactive spec. The first four arguments are required; at most six have any significance. usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INTERACTIVE-SPEC &rest ELEMENTS) */) - (register int nargs, Lisp_Object *args) + (register size_t nargs, Lisp_Object *args) { register Lisp_Object len, val; - register int i; + register size_t i; register struct Lisp_Vector *p; XSETFASTINT (len, nargs); @@ -4230,7 +4230,7 @@ static void check_gcpros (void) { struct gcpro *p; - int i; + size_t i; for (p = gcprolist; p; p = p->next) for (i = 0; i < p->nvars; ++i) @@ -4839,7 +4839,7 @@ returns nil, because real GC can't be done. */) { register struct specbinding *bind; char stack_top_variable; - register int i; + register size_t i; int message_p; Lisp_Object total[8]; int count = SPECPDL_INDEX (); diff --git a/src/callint.c b/src/callint.c index bb815a5bd01..40d89acd16c 100644 --- a/src/callint.c +++ b/src/callint.c @@ -265,8 +265,9 @@ invoke it. If KEYS is omitted or nil, the return value of recorded as a call to the function named callint_argfuns[varies[i]]. */ int *varies; - register int i, j; - int count, foo; + register size_t i, j; + size_t count; + int foo; char prompt1[100]; char *tem1; int arg_from_tty = 0; diff --git a/src/callproc.c b/src/callproc.c index 75f239d1be2..acb7a0e24b1 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -177,7 +177,7 @@ and returns a numeric exit status or a signal description string. If you quit, the process is killed with SIGINT, or SIGKILL if you quit again. usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) - (int nargs, register Lisp_Object *args) + (size_t nargs, register Lisp_Object *args) { Lisp_Object infile, buffer, current_dir, path; volatile int display_p_volatile; @@ -221,7 +221,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) /* Decide the coding-system for giving arguments. */ { Lisp_Object val, *args2; - int i; + size_t i; /* If arguments are supplied, we may have to encode them. */ if (nargs >= 5) @@ -373,10 +373,10 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) path = Fsubstring (path, make_number (2), Qnil); new_argv_volatile = new_argv = (const unsigned char **) - alloca (max (2, nargs - 2) * sizeof (char *)); + alloca ((nargs > 4 ? nargs - 2 : 2) * sizeof (char *)); if (nargs > 4) { - register int i; + register size_t i; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; GCPRO5 (infile, buffer, current_dir, path, error_file); @@ -643,7 +643,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) { if (EQ (coding_systems, Qt)) { - int i; + size_t i; args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2); args2[0] = Qcall_process; @@ -864,7 +864,7 @@ and returns a numeric exit status or a signal description string. If you quit, the process is killed with SIGINT, or SIGKILL if you quit again. usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &rest ARGS) */) - (int nargs, register Lisp_Object *args) + (size_t nargs, register Lisp_Object *args) { struct gcpro gcpro1; Lisp_Object filename_string; @@ -873,7 +873,7 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r /* Qt denotes we have not yet called Ffind_operation_coding_system. */ Lisp_Object coding_systems; Lisp_Object val, *args2; - int i; + size_t i; char *tempfile; Lisp_Object tmpdir, pattern; diff --git a/src/character.c b/src/character.c index fdaf22f04f8..c106fc0ba20 100644 --- a/src/character.c +++ b/src/character.c @@ -893,9 +893,10 @@ DEFUN ("string", Fstring, Sstring, 0, MANY, 0, doc: /* Concatenate all the argument characters and make the result a string. usage: (string &rest CHARACTERS) */) - (int n, Lisp_Object *args) + (size_t n, Lisp_Object *args) { - int i, c; + size_t i; + int c; unsigned char *buf, *p; Lisp_Object str; USE_SAFE_ALLOCA; @@ -918,9 +919,10 @@ usage: (string &rest CHARACTERS) */) DEFUN ("unibyte-string", Funibyte_string, Sunibyte_string, 0, MANY, 0, doc: /* Concatenate all the argument bytes and make the result a unibyte string. usage: (unibyte-string &rest BYTES) */) - (int n, Lisp_Object *args) + (size_t n, Lisp_Object *args) { - int i, c; + size_t i; + int c; unsigned char *buf, *p; Lisp_Object str; USE_SAFE_ALLOCA; diff --git a/src/charset.c b/src/charset.c index d82b29ae44b..32836d459f3 100644 --- a/src/charset.c +++ b/src/charset.c @@ -845,7 +845,7 @@ DEFUN ("define-charset-internal", Fdefine_charset_internal, Sdefine_charset_internal, charset_arg_max, MANY, 0, doc: /* For internal use only. usage: (define-charset-internal ...) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { /* Charset attr vector. */ Lisp_Object attrs; @@ -2171,11 +2171,12 @@ DEFUN ("set-charset-priority", Fset_charset_priority, Sset_charset_priority, 1, MANY, 0, doc: /* Assign higher priority to the charsets given as arguments. usage: (set-charset-priority &rest charsets) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { Lisp_Object new_head, old_list, arglist[2]; Lisp_Object list_2022, list_emacs_mule; - int i, id; + size_t i; + int id; old_list = Fcopy_sequence (Vcharset_ordered_list); new_head = Qnil; diff --git a/src/coding.c b/src/coding.c index 0596d16bf46..a93a9a4d0e4 100644 --- a/src/coding.c +++ b/src/coding.c @@ -9300,7 +9300,7 @@ function to call for FILENAME, that function should examine the contents of BUFFER instead of reading the file. usage: (find-operation-coding-system OPERATION ARGUMENTS...) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { Lisp_Object operation, target_idx, target, val; register Lisp_Object chain; @@ -9309,17 +9309,17 @@ usage: (find-operation-coding-system OPERATION ARGUMENTS...) */) error ("Too few arguments"); operation = args[0]; if (!SYMBOLP (operation) - || !INTEGERP (target_idx = Fget (operation, Qtarget_idx))) + || !NATNUMP (target_idx = Fget (operation, Qtarget_idx))) error ("Invalid first argument"); - if (nargs < 1 + XINT (target_idx)) + if (nargs < 1 + XFASTINT (target_idx)) error ("Too few arguments for operation: %s", SDATA (SYMBOL_NAME (operation))); - target = args[XINT (target_idx) + 1]; + target = args[XFASTINT (target_idx) + 1]; if (!(STRINGP (target) || (EQ (operation, Qinsert_file_contents) && CONSP (target) && STRINGP (XCAR (target)) && BUFFERP (XCDR (target))) || (EQ (operation, Qopen_network_stream) && INTEGERP (target)))) - error ("Invalid %dth argument", XINT (target_idx) + 1); + error ("Invalid %dth argument", XFASTINT (target_idx) + 1); if (CONSP (target)) target = XCAR (target); @@ -9376,9 +9376,9 @@ If multiple coding systems belong to the same category, all but the first one are ignored. usage: (set-coding-system-priority &rest coding-systems) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { - int i, j; + size_t i, j; int changed[coding_category_max]; enum coding_category priorities[coding_category_max]; @@ -9421,7 +9421,7 @@ usage: (set-coding-system-priority &rest coding-systems) */) /* Update `coding-category-list'. */ Vcoding_category_list = Qnil; - for (i = coding_category_max - 1; i >= 0; i--) + for (i = coding_category_max; i-- > 0; ) Vcoding_category_list = Fcons (AREF (Vcoding_category_table, priorities[i]), Vcoding_category_list); @@ -9482,7 +9482,7 @@ DEFUN ("define-coding-system-internal", Fdefine_coding_system_internal, Sdefine_coding_system_internal, coding_arg_max, MANY, 0, doc: /* For internal use only. usage: (define-coding-system-internal ...) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { Lisp_Object name; Lisp_Object spec_vec; /* [ ATTRS ALIASE EOL_TYPE ] */ diff --git a/src/data.c b/src/data.c index 01aafbcede4..0a5ce52c95f 100644 --- a/src/data.c +++ b/src/data.c @@ -2474,13 +2474,13 @@ enum arithop Amin }; -static Lisp_Object float_arith_driver (double, int, enum arithop, - int, Lisp_Object *); +static Lisp_Object float_arith_driver (double, size_t, enum arithop, + size_t, Lisp_Object *); static Lisp_Object -arith_driver (enum arithop code, int nargs, register Lisp_Object *args) +arith_driver (enum arithop code, size_t nargs, register Lisp_Object *args) { register Lisp_Object val; - register int argnum; + register size_t argnum; register EMACS_INT accum = 0; register EMACS_INT next; @@ -2562,7 +2562,8 @@ arith_driver (enum arithop code, int nargs, register Lisp_Object *args) #define isnan(x) ((x) != (x)) static Lisp_Object -float_arith_driver (double accum, register int argnum, enum arithop code, int nargs, register Lisp_Object *args) +float_arith_driver (double accum, register size_t argnum, enum arithop code, + size_t nargs, register Lisp_Object *args) { register Lisp_Object val; double next; @@ -2624,7 +2625,7 @@ float_arith_driver (double accum, register int argnum, enum arithop code, int na DEFUN ("+", Fplus, Splus, 0, MANY, 0, doc: /* Return sum of any number of arguments, which are numbers or markers. usage: (+ &rest NUMBERS-OR-MARKERS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { return arith_driver (Aadd, nargs, args); } @@ -2634,7 +2635,7 @@ DEFUN ("-", Fminus, Sminus, 0, MANY, 0, With one arg, negates it. With more than one arg, subtracts all but the first from the first. usage: (- &optional NUMBER-OR-MARKER &rest MORE-NUMBERS-OR-MARKERS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { return arith_driver (Asub, nargs, args); } @@ -2642,7 +2643,7 @@ usage: (- &optional NUMBER-OR-MARKER &rest MORE-NUMBERS-OR-MARKERS) */) DEFUN ("*", Ftimes, Stimes, 0, MANY, 0, doc: /* Return product of any number of arguments, which are numbers or markers. usage: (* &rest NUMBERS-OR-MARKERS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { return arith_driver (Amult, nargs, args); } @@ -2651,9 +2652,9 @@ DEFUN ("/", Fquo, Squo, 2, MANY, 0, doc: /* Return first argument divided by all the remaining arguments. The arguments must be numbers or markers. usage: (/ DIVIDEND DIVISOR &rest DIVISORS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { - int argnum; + size_t argnum; for (argnum = 2; argnum < nargs; argnum++) if (FLOATP (args[argnum])) return float_arith_driver (0, 0, Adiv, nargs, args); @@ -2735,7 +2736,7 @@ DEFUN ("max", Fmax, Smax, 1, MANY, 0, doc: /* Return largest of all the arguments (which must be numbers or markers). The value is always a number; markers are converted to numbers. usage: (max NUMBER-OR-MARKER &rest NUMBERS-OR-MARKERS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { return arith_driver (Amax, nargs, args); } @@ -2744,7 +2745,7 @@ DEFUN ("min", Fmin, Smin, 1, MANY, 0, doc: /* Return smallest of all the arguments (which must be numbers or markers). The value is always a number; markers are converted to numbers. usage: (min NUMBER-OR-MARKER &rest NUMBERS-OR-MARKERS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { return arith_driver (Amin, nargs, args); } @@ -2753,7 +2754,7 @@ DEFUN ("logand", Flogand, Slogand, 0, MANY, 0, doc: /* Return bitwise-and of all the arguments. Arguments may be integers, or markers converted to integers. usage: (logand &rest INTS-OR-MARKERS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { return arith_driver (Alogand, nargs, args); } @@ -2762,7 +2763,7 @@ DEFUN ("logior", Flogior, Slogior, 0, MANY, 0, doc: /* Return bitwise-or of all the arguments. Arguments may be integers, or markers converted to integers. usage: (logior &rest INTS-OR-MARKERS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { return arith_driver (Alogior, nargs, args); } @@ -2771,7 +2772,7 @@ DEFUN ("logxor", Flogxor, Slogxor, 0, MANY, 0, doc: /* Return bitwise-exclusive-or of all the arguments. Arguments may be integers, or markers converted to integers. usage: (logxor &rest INTS-OR-MARKERS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { return arith_driver (Alogxor, nargs, args); } diff --git a/src/dbusbind.c b/src/dbusbind.c index 2c8de20a4d4..8a6870555d0 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -1051,7 +1051,7 @@ object is returned instead of a list containing this single Lisp object. => "i686" usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TIMEOUT &rest ARGS) */) - (int nargs, register Lisp_Object *args) + (size_t nargs, register Lisp_Object *args) { Lisp_Object bus, service, path, interface, method; Lisp_Object result; @@ -1063,7 +1063,7 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI DBusError derror; unsigned int dtype; int timeout = -1; - int i = 5; + size_t i = 5; char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; /* Check parameters. */ @@ -1116,7 +1116,7 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); - XD_DEBUG_MESSAGE ("Parameter%d %s %s", i-4, + XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-4), SDATA (format2 ("%s", args[i], Qnil)), SDATA (format2 ("%s", args[i+1], Qnil))); ++i; @@ -1124,7 +1124,7 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI else { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); - XD_DEBUG_MESSAGE ("Parameter%d %s", i-4, + XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i-4), SDATA (format2 ("%s", args[i], Qnil))); } @@ -1233,7 +1233,7 @@ Example: -| i686 usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLER &optional :timeout TIMEOUT &rest ARGS) */) - (int nargs, register Lisp_Object *args) + (size_t nargs, register Lisp_Object *args) { Lisp_Object bus, service, path, interface, method, handler; Lisp_Object result; @@ -1243,7 +1243,7 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE DBusMessageIter iter; unsigned int dtype; int timeout = -1; - int i = 6; + size_t i = 6; char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; /* Check parameters. */ @@ -1298,7 +1298,7 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); - XD_DEBUG_MESSAGE ("Parameter%d %s %s", i-4, + XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-4), SDATA (format2 ("%s", args[i], Qnil)), SDATA (format2 ("%s", args[i+1], Qnil))); ++i; @@ -1306,7 +1306,7 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE else { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); - XD_DEBUG_MESSAGE ("Parameter%d %s", i-4, + XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i - 4), SDATA (format2 ("%s", args[i], Qnil))); } @@ -1357,7 +1357,7 @@ DEFUN ("dbus-method-return-internal", Fdbus_method_return_internal, This is an internal function, it shall not be used outside dbus.el. usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */) - (int nargs, register Lisp_Object *args) + (size_t nargs, register Lisp_Object *args) { Lisp_Object bus, serial, service; struct gcpro gcpro1, gcpro2, gcpro3; @@ -1365,7 +1365,7 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */) DBusMessage *dmessage; DBusMessageIter iter; unsigned int dtype; - int i; + size_t i; char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; /* Check parameters. */ @@ -1405,7 +1405,7 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */) { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); - XD_DEBUG_MESSAGE ("Parameter%d %s %s", i-2, + XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-2), SDATA (format2 ("%s", args[i], Qnil)), SDATA (format2 ("%s", args[i+1], Qnil))); ++i; @@ -1413,7 +1413,7 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */) else { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); - XD_DEBUG_MESSAGE ("Parameter%d %s", i-2, + XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i-2), SDATA (format2 ("%s", args[i], Qnil))); } @@ -1445,7 +1445,7 @@ DEFUN ("dbus-method-error-internal", Fdbus_method_error_internal, This is an internal function, it shall not be used outside dbus.el. usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */) - (int nargs, register Lisp_Object *args) + (size_t nargs, register Lisp_Object *args) { Lisp_Object bus, serial, service; struct gcpro gcpro1, gcpro2, gcpro3; @@ -1453,7 +1453,7 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */) DBusMessage *dmessage; DBusMessageIter iter; unsigned int dtype; - int i; + size_t i; char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; /* Check parameters. */ @@ -1494,7 +1494,7 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */) { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); - XD_DEBUG_MESSAGE ("Parameter%d %s %s", i-2, + XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-2), SDATA (format2 ("%s", args[i], Qnil)), SDATA (format2 ("%s", args[i+1], Qnil))); ++i; @@ -1502,7 +1502,7 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */) else { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); - XD_DEBUG_MESSAGE ("Parameter%d %s", i-2, + XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i-2), SDATA (format2 ("%s", args[i], Qnil))); } @@ -1557,7 +1557,7 @@ Example: "org.gnu.Emacs.FileManager" "FileModified" "/home/albinus/.emacs") usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */) - (int nargs, register Lisp_Object *args) + (size_t nargs, register Lisp_Object *args) { Lisp_Object bus, service, path, interface, signal; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; @@ -1565,7 +1565,7 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */) DBusMessage *dmessage; DBusMessageIter iter; unsigned int dtype; - int i; + size_t i; char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; /* Check parameters. */ @@ -1609,7 +1609,7 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */) { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); - XD_DEBUG_MESSAGE ("Parameter%d %s %s", i-4, + XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-4), SDATA (format2 ("%s", args[i], Qnil)), SDATA (format2 ("%s", args[i+1], Qnil))); ++i; @@ -1617,7 +1617,7 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */) else { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); - XD_DEBUG_MESSAGE ("Parameter%d %s", i-4, + XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i-4), SDATA (format2 ("%s", args[i], Qnil))); } @@ -1885,11 +1885,11 @@ Example: => :already-owner. usage: (dbus-register-service BUS SERVICE &rest FLAGS) */) - (int nargs, register Lisp_Object *args) + (size_t nargs, register Lisp_Object *args) { Lisp_Object bus, service; DBusConnection *connection; - unsigned int i; + size_t i; unsigned int value; unsigned int flags = 0; int result; @@ -1985,13 +1985,13 @@ INTERFACE, SIGNAL and HANDLER must not be nil. Example: `dbus-unregister-object' for removing the registration. usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARGS) */) - (int nargs, register Lisp_Object *args) + (size_t nargs, register Lisp_Object *args) { Lisp_Object bus, service, path, interface, signal, handler; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; Lisp_Object uname, key, key1, value; DBusConnection *connection; - int i; + size_t i; char rule[DBUS_MAXIMUM_MATCH_RULE_LENGTH]; char x[DBUS_MAXIMUM_MATCH_RULE_LENGTH]; DBusError derror; @@ -2061,7 +2061,8 @@ usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARG if (!NILP (args[i])) { CHECK_STRING (args[i]); - sprintf (x, ",arg%d='%s'", i-6, SDATA (args[i])); + sprintf (x, ",arg%lu='%s'", (unsigned long) (i-6), + SDATA (args[i])); strcat (rule, x); } diff --git a/src/editfns.c b/src/editfns.c index 009e1d34bde..99832db1b4c 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -101,7 +101,7 @@ static void general_insert_function (void (*) (const char *, EMACS_INT), void (*) (Lisp_Object, EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT, int), - int, int, Lisp_Object *); + int, size_t, Lisp_Object *); static Lisp_Object subst_char_in_region_unwind (Lisp_Object); static Lisp_Object subst_char_in_region_unwind_1 (Lisp_Object); static void transpose_markers (EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT, @@ -1871,7 +1871,7 @@ Years before 1970 are not guaranteed to work. On some systems, year values as low as 1901 do work. usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) - (int nargs, register Lisp_Object *args) + (size_t nargs, register Lisp_Object *args) { time_t value; struct tm tm; @@ -2207,9 +2207,9 @@ general_insert_function (void (*insert_func) void (*insert_from_string_func) (Lisp_Object, EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT, int), - int inherit, int nargs, Lisp_Object *args) + int inherit, size_t nargs, Lisp_Object *args) { - register int argnum; + register size_t argnum; register Lisp_Object val; for (argnum = 0; argnum < nargs; argnum++) @@ -2272,7 +2272,7 @@ buffer; to accomplish this, apply `string-as-multibyte' to the string and insert the result. usage: (insert &rest ARGS) */) - (int nargs, register Lisp_Object *args) + (size_t nargs, register Lisp_Object *args) { general_insert_function (insert, insert_from_string, 0, nargs, args); return Qnil; @@ -2291,7 +2291,7 @@ If the current buffer is unibyte, multibyte strings are converted to unibyte for insertion. usage: (insert-and-inherit &rest ARGS) */) - (int nargs, register Lisp_Object *args) + (size_t nargs, register Lisp_Object *args) { general_insert_function (insert_and_inherit, insert_from_string, 1, nargs, args); @@ -2308,7 +2308,7 @@ If the current buffer is unibyte, multibyte strings are converted to unibyte for insertion. usage: (insert-before-markers &rest ARGS) */) - (int nargs, register Lisp_Object *args) + (size_t nargs, register Lisp_Object *args) { general_insert_function (insert_before_markers, insert_from_string_before_markers, 0, @@ -2327,7 +2327,7 @@ If the current buffer is unibyte, multibyte strings are converted to unibyte for insertion. usage: (insert-before-markers-and-inherit &rest ARGS) */) - (int nargs, register Lisp_Object *args) + (size_t nargs, register Lisp_Object *args) { general_insert_function (insert_before_markers_and_inherit, insert_from_string_before_markers, 1, @@ -3399,7 +3399,7 @@ any existing message; this lets the minibuffer contents show. See also `current-message'. usage: (message FORMAT-STRING &rest ARGS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { if (NILP (args[0]) || (STRINGP (args[0]) @@ -3427,7 +3427,7 @@ If the first argument is nil or the empty string, clear any existing message; let the minibuffer contents show. usage: (message-box FORMAT-STRING &rest ARGS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { if (NILP (args[0])) { @@ -3484,7 +3484,7 @@ If the first argument is nil or the empty string, clear any existing message; let the minibuffer contents show. usage: (message-or-box FORMAT-STRING &rest ARGS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { #ifdef HAVE_MENUS if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) @@ -3508,14 +3508,14 @@ First argument is the string to copy. Remaining arguments form a sequence of PROPERTY VALUE pairs for text properties to add to the result. usage: (propertize STRING &rest PROPERTIES) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { Lisp_Object properties, string; struct gcpro gcpro1, gcpro2; - int i; + size_t i; /* Number of args must be odd. */ - if ((nargs & 1) == 0 || nargs < 1) + if ((nargs & 1) == 0) error ("Wrong number of arguments"); properties = string = Qnil; @@ -3590,10 +3590,10 @@ decimal point itself is omitted. For %s and %S, the precision specifier truncates the string to the given width. usage: (format STRING &rest OBJECTS) */) - (int nargs, register Lisp_Object *args) + (size_t nargs, register Lisp_Object *args) { - register int n; /* The number of the next arg to substitute */ - register EMACS_INT total; /* An estimate of the final length */ + register size_t n; /* The number of the next arg to substitute */ + register size_t total; /* An estimate of the final length */ char *buf, *p; register char *format, *end, *format_start; int nchars; @@ -3669,8 +3669,8 @@ usage: (format STRING &rest OBJECTS) */) /* Allocate the info and discarded tables. */ { - int nbytes = (nargs+1) * sizeof *info; - int i; + size_t nbytes = (nargs+1) * sizeof *info; + size_t i; if (!info) info = (struct info *) alloca (nbytes); memset (info, 0, nbytes); diff --git a/src/eval.c b/src/eval.c index f68274e6e8c..b9d9354f48a 100644 --- a/src/eval.c +++ b/src/eval.c @@ -38,9 +38,9 @@ struct backtrace struct backtrace *next; Lisp_Object *function; Lisp_Object *args; /* Points to vector of args. */ - int nargs; /* Length of vector. - If nargs is UNEVALLED, args points to slot holding - list of unevalled args */ + size_t nargs; /* Length of vector. + If nargs is (size_t) UNEVALLED, args points + to slot holding list of unevalled args */ char evalargs; /* Nonzero means call value of debugger when done with this operation. */ char debug_on_exit; @@ -111,7 +111,7 @@ Lisp_Object Vsignaling_function; int handling_signal; -static Lisp_Object funcall_lambda (Lisp_Object, int, Lisp_Object*); +static Lisp_Object funcall_lambda (Lisp_Object, size_t, Lisp_Object*); static void unwind_to_catch (struct catchtag *, Lisp_Object) NO_RETURN; static int interactive_p (int); static Lisp_Object apply_lambda (Lisp_Object, Lisp_Object, int); @@ -553,7 +553,7 @@ interactive_p (int exclude_subrs_p) looking at several frames for special forms. Skip past them. */ while (btp && (EQ (*btp->function, Qbytecode) - || btp->nargs == UNEVALLED)) + || btp->nargs == (size_t) UNEVALLED)) btp = btp->next; /* btp now points at the frame of the innermost function that isn't @@ -959,7 +959,7 @@ usage: (let VARLIST BODY...) */) Lisp_Object *temps, tem; register Lisp_Object elt, varlist; int count = SPECPDL_INDEX (); - register int argnum; + register size_t argnum; struct gcpro gcpro1, gcpro2; USE_SAFE_ALLOCA; @@ -1511,8 +1511,8 @@ internal_condition_case_2 (Lisp_Object (*bfun) (Lisp_Object, Lisp_Object), and ARGS as second argument. */ Lisp_Object -internal_condition_case_n (Lisp_Object (*bfun) (int, Lisp_Object*), - int nargs, +internal_condition_case_n (Lisp_Object (*bfun) (size_t, Lisp_Object *), + size_t nargs, Lisp_Object *args, Lisp_Object handlers, Lisp_Object (*hfun) (Lisp_Object)) @@ -2203,7 +2203,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, { /* Pass a vector of evaluated arguments */ Lisp_Object *vals; - register int argnum = 0; + register size_t argnum = 0; USE_SAFE_ALLOCA; SAFE_ALLOCA_LISP (vals, XINT (numargs)); @@ -2332,9 +2332,9 @@ DEFUN ("apply", Fapply, Sapply, 2, MANY, 0, Then return the value FUNCTION returns. Thus, (apply '+ 1 2 '(3 4)) returns 10. usage: (apply FUNCTION &rest ARGUMENTS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { - register int i, numargs; + register size_t i, numargs; register Lisp_Object spread_arg; register Lisp_Object *funcall_args; Lisp_Object fun, retval; @@ -2374,7 +2374,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) if (numargs < XSUBR (fun)->min_args || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs)) goto funcall; /* Let funcall get the error */ - else if (XSUBR (fun)->max_args > numargs) + else if (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args > numargs) { /* Avoid making funcall cons up a yet another new vector of arguments by explicitly supplying nil's for optional values */ @@ -2416,7 +2416,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) /* Run hook variables in various ways. */ enum run_hooks_condition {to_completion, until_success, until_failure}; -static Lisp_Object run_hook_with_args (int, Lisp_Object *, +static Lisp_Object run_hook_with_args (size_t, Lisp_Object *, enum run_hooks_condition); DEFUN ("run-hooks", Frun_hooks, Srun_hooks, 0, MANY, 0, @@ -2434,10 +2434,10 @@ hook; they should use `run-mode-hooks' instead. Do not use `make-local-variable' to make a hook variable buffer-local. Instead, use `add-hook' and specify t for the LOCAL argument. usage: (run-hooks &rest HOOKS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { Lisp_Object hook[1]; - register int i; + register size_t i; for (i = 0; i < nargs; i++) { @@ -2463,7 +2463,7 @@ as that may change. Do not use `make-local-variable' to make a hook variable buffer-local. Instead, use `add-hook' and specify t for the LOCAL argument. usage: (run-hook-with-args HOOK &rest ARGS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { return run_hook_with_args (nargs, args, to_completion); } @@ -2483,7 +2483,7 @@ However, if they all return nil, we return nil. Do not use `make-local-variable' to make a hook variable buffer-local. Instead, use `add-hook' and specify t for the LOCAL argument. usage: (run-hook-with-args-until-success HOOK &rest ARGS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { return run_hook_with_args (nargs, args, until_success); } @@ -2502,7 +2502,7 @@ Then we return nil. However, if they all return non-nil, we return non-nil. Do not use `make-local-variable' to make a hook variable buffer-local. Instead, use `add-hook' and specify t for the LOCAL argument. usage: (run-hook-with-args-until-failure HOOK &rest ARGS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { return run_hook_with_args (nargs, args, until_failure); } @@ -2516,7 +2516,8 @@ usage: (run-hook-with-args-until-failure HOOK &rest ARGS) */) except that it isn't necessary to gcpro ARGS[0]. */ static Lisp_Object -run_hook_with_args (int nargs, Lisp_Object *args, enum run_hooks_condition cond) +run_hook_with_args (size_t nargs, Lisp_Object *args, + enum run_hooks_condition cond) { Lisp_Object sym, val, ret; struct gcpro gcpro1, gcpro2, gcpro3; @@ -2763,16 +2764,16 @@ DEFUN ("funcall", Ffuncall, Sfuncall, 1, MANY, 0, Return the value that function returns. Thus, (funcall 'cons 'x 'y) returns (x . y). usage: (funcall FUNCTION &rest ARGUMENTS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { Lisp_Object fun, original_fun; Lisp_Object funcar; - int numargs = nargs - 1; + size_t numargs = nargs - 1; Lisp_Object lisp_numargs; Lisp_Object val; struct backtrace backtrace; register Lisp_Object *internal_args; - register int i; + register size_t i; QUIT; if ((consing_since_gc > gc_cons_threshold @@ -2925,21 +2926,21 @@ static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args, int eval_flag) { Lisp_Object args_left; - Lisp_Object numargs; + size_t numargs; register Lisp_Object *arg_vector; struct gcpro gcpro1, gcpro2, gcpro3; - register int i; + register size_t i; register Lisp_Object tem; USE_SAFE_ALLOCA; - numargs = Flength (args); - SAFE_ALLOCA_LISP (arg_vector, XINT (numargs)); + numargs = XINT (Flength (args)); + SAFE_ALLOCA_LISP (arg_vector, numargs); args_left = args; GCPRO3 (*arg_vector, args_left, fun); gcpro1.nvars = 0; - for (i = 0; i < XINT (numargs);) + for (i = 0; i < numargs; ) { tem = Fcar (args_left), args_left = Fcdr (args_left); if (eval_flag) tem = Feval (tem); @@ -2955,7 +2956,7 @@ apply_lambda (Lisp_Object fun, Lisp_Object args, int eval_flag) backtrace_list->nargs = i; } backtrace_list->evalargs = 0; - tem = funcall_lambda (fun, XINT (numargs), arg_vector); + tem = funcall_lambda (fun, numargs, arg_vector); /* Do the debug-on-exit now, while arg_vector still exists. */ if (backtrace_list->debug_on_exit) @@ -2971,11 +2972,13 @@ apply_lambda (Lisp_Object fun, Lisp_Object args, int eval_flag) FUN must be either a lambda-expression or a compiled-code object. */ static Lisp_Object -funcall_lambda (Lisp_Object fun, int nargs, register Lisp_Object *arg_vector) +funcall_lambda (Lisp_Object fun, size_t nargs, + register Lisp_Object *arg_vector) { Lisp_Object val, syms_left, next; int count = SPECPDL_INDEX (); - int i, optional, rest; + size_t i; + int optional, rest; if (CONSP (fun)) { @@ -3310,7 +3313,7 @@ Output stream used is value of `standard-output'. */) while (backlist) { write_string (backlist->debug_on_exit ? "* " : " ", 2); - if (backlist->nargs == UNEVALLED) + if (backlist->nargs == (size_t) UNEVALLED) { Fprin1 (Fcons (*backlist->function, *backlist->args), Qnil); write_string ("\n", -1); @@ -3320,7 +3323,7 @@ Output stream used is value of `standard-output'. */) tem = *backlist->function; Fprin1 (tem, Qnil); /* This can QUIT */ write_string ("(", -1); - if (backlist->nargs == MANY) + if (backlist->nargs == (size_t) MANY) { for (tail = *backlist->args, i = 0; !NILP (tail); @@ -3372,11 +3375,11 @@ If NFRAMES is more than the number of frames, the value is nil. */) if (!backlist) return Qnil; - if (backlist->nargs == UNEVALLED) + if (backlist->nargs == (size_t) UNEVALLED) return Fcons (Qnil, Fcons (*backlist->function, *backlist->args)); else { - if (backlist->nargs == MANY) + if (backlist->nargs == (size_t) MANY) tem = *backlist->args; else tem = Flist (backlist->nargs, backlist->args); @@ -3390,17 +3393,18 @@ void mark_backtrace (void) { register struct backtrace *backlist; - register int i; + register size_t i; for (backlist = backtrace_list; backlist; backlist = backlist->next) { mark_object (*backlist->function); - if (backlist->nargs == UNEVALLED || backlist->nargs == MANY) - i = 0; + if (backlist->nargs == (size_t) UNEVALLED + || backlist->nargs == (size_t) MANY) + i = 1; else - i = backlist->nargs - 1; - for (; i >= 0; i--) + i = backlist->nargs; + while (i--) mark_object (backlist->args[i]); } } diff --git a/src/fns.c b/src/fns.c index 71f49b9cdae..95e8badbaa5 100644 --- a/src/fns.c +++ b/src/fns.c @@ -348,7 +348,7 @@ Symbols are also allowed; their print names are used instead. */) return i1 < SCHARS (s2) ? Qt : Qnil; } -static Lisp_Object concat (int nargs, Lisp_Object *args, +static Lisp_Object concat (size_t nargs, Lisp_Object *args, enum Lisp_Type target_type, int last_special); /* ARGSUSED */ @@ -378,7 +378,7 @@ The result is a list whose elements are the elements of all the arguments. Each argument may be a list, vector or string. The last argument is not copied, just used as the tail of the new list. usage: (append &rest SEQUENCES) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { return concat (nargs, args, Lisp_Cons, 1); } @@ -388,7 +388,7 @@ DEFUN ("concat", Fconcat, Sconcat, 0, MANY, 0, The result is a string whose elements are the elements of all the arguments. Each argument may be a string or a list or vector of characters (integers). usage: (concat &rest SEQUENCES) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { return concat (nargs, args, Lisp_String, 0); } @@ -398,7 +398,7 @@ DEFUN ("vconcat", Fvconcat, Svconcat, 0, MANY, 0, The result is a vector whose elements are the elements of all the arguments. Each argument may be a list, vector or string. usage: (vconcat &rest SEQUENCES) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { return concat (nargs, args, Lisp_Vectorlike, 0); } @@ -446,7 +446,8 @@ struct textprop_rec }; static Lisp_Object -concat (int nargs, Lisp_Object *args, enum Lisp_Type target_type, int last_special) +concat (size_t nargs, Lisp_Object *args, + enum Lisp_Type target_type, int last_special) { Lisp_Object val; register Lisp_Object tail; @@ -455,7 +456,7 @@ concat (int nargs, Lisp_Object *args, enum Lisp_Type target_type, int last_speci EMACS_INT toindex_byte = 0; register EMACS_INT result_len; register EMACS_INT result_len_byte; - register int argnum; + register size_t argnum; Lisp_Object last_tail; Lisp_Object prev; int some_multibyte; @@ -2232,9 +2233,9 @@ DEFUN ("nconc", Fnconc, Snconc, 0, MANY, 0, doc: /* Concatenate any number of lists by altering them. Only the last argument is not altered, and need not be a list. usage: (nconc &rest LISTS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { - register int argnum; + register size_t argnum; register Lisp_Object tail, tem, val; val = tail = Qnil; @@ -2763,7 +2764,7 @@ DEFUN ("widget-apply", Fwidget_apply, Swidget_apply, 2, MANY, 0, doc: /* Apply the value of WIDGET's PROPERTY to the widget itself. ARGS are passed as extra arguments to the function. usage: (widget-apply WIDGET PROPERTY &rest ARGS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { /* This function can GC. */ Lisp_Object newargs[3]; @@ -3367,7 +3368,7 @@ Lisp_Object Qhash_table_test, Qkey_or_value, Qkey_and_value; /* Function prototypes. */ static struct Lisp_Hash_Table *check_hash_table (Lisp_Object); -static int get_key_arg (Lisp_Object, int, Lisp_Object *, char *); +static size_t get_key_arg (Lisp_Object, size_t, Lisp_Object *, char *); static void maybe_resize_hash_table (struct Lisp_Hash_Table *); static int cmpfn_eql (struct Lisp_Hash_Table *, Lisp_Object, unsigned, Lisp_Object, unsigned); @@ -3422,27 +3423,23 @@ next_almost_prime (int n) /* Find KEY in ARGS which has size NARGS. Don't consider indices for which USED[I] is non-zero. If found at index I in ARGS, set USED[I] and USED[I + 1] to 1, and return I + 1. Otherwise return - -1. This function is used to extract a keyword/argument pair from + 0. This function is used to extract a keyword/argument pair from a DEFUN parameter list. */ -static int -get_key_arg (Lisp_Object key, int nargs, Lisp_Object *args, char *used) +static size_t +get_key_arg (Lisp_Object key, size_t nargs, Lisp_Object *args, char *used) { - int i; - - for (i = 0; i < nargs - 1; ++i) - if (!used[i] && EQ (args[i], key)) - break; + size_t i; - if (i >= nargs - 1) - i = -1; - else - { - used[i++] = 1; - used[i] = 1; - } + for (i = 1; i < nargs; i++) + if (!used[i - 1] && EQ (args[i - 1], key)) + { + used[i - 1] = 1; + used[i] = 1; + return i; + } - return i; + return 0; } @@ -4290,12 +4287,12 @@ WEAK. WEAK t is equivalent to `key-and-value'. Default value of WEAK is nil. usage: (make-hash-table &rest KEYWORD-ARGS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { Lisp_Object test, size, rehash_size, rehash_threshold, weak; Lisp_Object user_test, user_hash; char *used; - int i; + size_t i; /* The vector `used' is used to keep track of arguments that have been consumed. */ @@ -4304,7 +4301,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */) /* See if there's a `:test TEST' among the arguments. */ i = get_key_arg (QCtest, nargs, args, used); - test = i < 0 ? Qeql : args[i]; + test = i ? args[i] : Qeql; if (!EQ (test, Qeq) && !EQ (test, Qeql) && !EQ (test, Qequal)) { /* See if it is a user-defined test. */ @@ -4321,7 +4318,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */) /* See if there's a `:size SIZE' argument. */ i = get_key_arg (QCsize, nargs, args, used); - size = i < 0 ? Qnil : args[i]; + size = i ? args[i] : Qnil; if (NILP (size)) size = make_number (DEFAULT_HASH_SIZE); else if (!INTEGERP (size) || XINT (size) < 0) @@ -4329,7 +4326,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */) /* Look for `:rehash-size SIZE'. */ i = get_key_arg (QCrehash_size, nargs, args, used); - rehash_size = i < 0 ? make_float (DEFAULT_REHASH_SIZE) : args[i]; + rehash_size = i ? args[i] : make_float (DEFAULT_REHASH_SIZE); if (!NUMBERP (rehash_size) || (INTEGERP (rehash_size) && XINT (rehash_size) <= 0) || XFLOATINT (rehash_size) <= 1.0) @@ -4337,7 +4334,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */) /* Look for `:rehash-threshold THRESHOLD'. */ i = get_key_arg (QCrehash_threshold, nargs, args, used); - rehash_threshold = i < 0 ? make_float (DEFAULT_REHASH_THRESHOLD) : args[i]; + rehash_threshold = i ? args[i] : make_float (DEFAULT_REHASH_THRESHOLD); if (!FLOATP (rehash_threshold) || XFLOATINT (rehash_threshold) <= 0.0 || XFLOATINT (rehash_threshold) > 1.0) @@ -4345,7 +4342,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */) /* Look for `:weakness WEAK'. */ i = get_key_arg (QCweakness, nargs, args, used); - weak = i < 0 ? Qnil : args[i]; + weak = i ? args[i] : Qnil; if (EQ (weak, Qt)) weak = Qkey_and_value; if (!NILP (weak) diff --git a/src/font.c b/src/font.c index 9e8b7029c22..6b2e2f2712d 100644 --- a/src/font.c +++ b/src/font.c @@ -3831,10 +3831,10 @@ be an OpenType font, and whose GPOS table of `thai' script's default language system must contain `mark' feature. usage: (font-spec ARGS...) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { Lisp_Object spec = font_make_spec (); - int i; + size_t i; for (i = 0; i < nargs; i += 2) { diff --git a/src/frame.c b/src/frame.c index cdcb313280b..1b6d36092ae 100644 --- a/src/frame.c +++ b/src/frame.c @@ -2902,7 +2902,7 @@ x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist) /* Record in these vectors all the parms specified. */ Lisp_Object *parms; Lisp_Object *values; - int i, p; + size_t i, p; int left_no_change = 0, top_no_change = 0; int icon_left_no_change = 0, icon_top_no_change = 0; int size_changed = 0; @@ -2975,7 +2975,7 @@ x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist) } /* Now process them in reverse of specified order. */ - for (i--; i >= 0; i--) + while (i-- != 0) { Lisp_Object prop, val; diff --git a/src/lisp.h b/src/lisp.h index e98172ec104..e8d77c83a79 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -964,7 +964,7 @@ struct Lisp_Subr Lisp_Object (*a7) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); Lisp_Object (*a8) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); Lisp_Object (*aUNEVALLED) (Lisp_Object args); - Lisp_Object (*aMANY) (int, Lisp_Object *); + Lisp_Object (*aMANY) (size_t, Lisp_Object *); } function; short min_args, max_args; const char *symbol_name; @@ -1809,7 +1809,7 @@ typedef struct { /* Note that the weird token-substitution semantics of ANSI C makes this work for MANY and UNEVALLED. */ -#define DEFUN_ARGS_MANY (int, Lisp_Object *) +#define DEFUN_ARGS_MANY (size_t, Lisp_Object *) #define DEFUN_ARGS_UNEVALLED (Lisp_Object) #define DEFUN_ARGS_0 (void) #define DEFUN_ARGS_1 (Lisp_Object) @@ -2079,7 +2079,7 @@ struct gcpro volatile Lisp_Object *var; /* Number of consecutive protected variables. */ - int nvars; + size_t nvars; #ifdef DEBUG_GCPRO int level; @@ -2860,7 +2860,7 @@ extern Lisp_Object internal_lisp_condition_case (Lisp_Object, Lisp_Object, Lisp_ extern Lisp_Object internal_condition_case (Lisp_Object (*) (void), Lisp_Object, Lisp_Object (*) (Lisp_Object)); extern Lisp_Object internal_condition_case_1 (Lisp_Object (*) (Lisp_Object), Lisp_Object, Lisp_Object, Lisp_Object (*) (Lisp_Object)); extern Lisp_Object internal_condition_case_2 (Lisp_Object (*) (Lisp_Object, Lisp_Object), Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object (*) (Lisp_Object)); -extern Lisp_Object internal_condition_case_n (Lisp_Object (*) (int, Lisp_Object *), int, Lisp_Object *, Lisp_Object, Lisp_Object (*) (Lisp_Object)); +extern Lisp_Object internal_condition_case_n (Lisp_Object (*) (size_t, Lisp_Object *), size_t, Lisp_Object *, Lisp_Object, Lisp_Object (*) (Lisp_Object)); extern void specbind (Lisp_Object, Lisp_Object); extern void record_unwind_protect (Lisp_Object (*) (Lisp_Object), Lisp_Object); extern Lisp_Object unbind_to (int, Lisp_Object); @@ -2870,7 +2870,7 @@ extern void do_autoload (Lisp_Object, Lisp_Object); extern Lisp_Object un_autoload (Lisp_Object); EXFUN (Ffetch_bytecode, 1); extern void init_eval_once (void); -extern Lisp_Object safe_call (int, Lisp_Object *); +extern Lisp_Object safe_call (size_t, Lisp_Object *); extern Lisp_Object safe_call1 (Lisp_Object, Lisp_Object); extern Lisp_Object safe_call2 (Lisp_Object, Lisp_Object, Lisp_Object); extern void init_eval (void); diff --git a/src/process.c b/src/process.c index 639b6a49fce..ecda8e08012 100644 --- a/src/process.c +++ b/src/process.c @@ -1512,11 +1512,11 @@ the command through a shell and redirect one of them using the shell syntax. usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) - (int nargs, register Lisp_Object *args) + (size_t nargs, register Lisp_Object *args) { Lisp_Object buffer, name, program, proc, current_dir, tem; register unsigned char **new_argv; - register int i; + register size_t i; int count = SPECPDL_INDEX (); buffer = args[1]; @@ -1722,7 +1722,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) new_argv = (unsigned char **) alloca ((nargs - 1) * sizeof (char *)); new_argv[nargs - 2] = 0; - for (i = nargs - 3; i >= 0; i--) + for (i = nargs - 2; i-- != 0; ) { new_argv[i] = SDATA (XCAR (tem)); tem = XCDR (tem); @@ -2681,7 +2681,7 @@ Examples: \(serial-process-configure :port "\\\\.\\COM13" :bytesize 7) usage: (serial-process-configure &rest ARGS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { struct Lisp_Process *p; Lisp_Object contact = Qnil; @@ -2799,7 +2799,7 @@ Examples: \(make-serial-process :port "/dev/tty.BlueConsole-SPP-1" :speed nil) usage: (make-serial-process &rest ARGS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { int fd = -1; Lisp_Object proc, contact, port; @@ -3077,7 +3077,7 @@ The original argument list, modified with the actual connection information, is available via the `process-contact' function. usage: (make-network-process &rest ARGS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { Lisp_Object proc; Lisp_Object contact; @@ -3393,7 +3393,8 @@ usage: (make-network-process &rest ARGS) */) for (lres = res; lres; lres = lres->ai_next) { - int optn, optbits; + size_t optn; + int optbits; #ifdef WINDOWSNT retry_connect: diff --git a/src/xdisp.c b/src/xdisp.c index cc5d61abdb2..4b196645720 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -2181,7 +2181,7 @@ safe_eval_handler (Lisp_Object arg) redisplay during the evaluation. */ Lisp_Object -safe_call (int nargs, Lisp_Object *args) +safe_call (size_t nargs, Lisp_Object *args) { Lisp_Object val; @@ -16389,7 +16389,7 @@ With ARG, turn tracing on if and only if ARG is positive. */) DEFUN ("trace-to-stderr", Ftrace_to_stderr, Strace_to_stderr, 1, MANY, "", doc: /* Like `format', but print result to stderr. usage: (trace-to-stderr STRING &rest OBJECTS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { Lisp_Object s = Fformat (nargs, args); fprintf (stderr, "%s", SDATA (s)); -- cgit v1.2.1 From ffa8c828c6c76d3c246443a6752f1038eab60413 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 26 Mar 2011 19:20:34 -0700 Subject: * keyboard.c, keyboard.h (num_input_events): Now size_t. This avoids undefined behavior on integer overflow, and is a bit more convenient anyway since it is compared to a size_t variable. --- src/ChangeLog | 4 ++++ src/keyboard.c | 4 ++-- src/keyboard.h | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 32f64893ae6..93c43b85184 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2011-03-27 Paul Eggert + * keyboard.c, keyboard.h (num_input_events): Now size_t. + This avoids undefined behavior on integer overflow, and is a bit + more convenient anyway since it is compared to a size_t variable. + Variadic C functions now count arguments with size_t, not int. This avoids an unnecessary limitation on 64-bit machines, which caused (substring ...) to crash on large vectors (Bug#8344). diff --git a/src/keyboard.c b/src/keyboard.c index c4ef2795f6a..09a0010cedc 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -201,8 +201,8 @@ Lisp_Object unread_switch_frame; /* Last size recorded for a current buffer which is not a minibuffer. */ static EMACS_INT last_non_minibuf_size; -/* Total number of times read_char has returned. */ -int num_input_events; +/* Total number of times read_char has returned, modulo SIZE_MAX + 1. */ +size_t num_input_events; /* Value of num_nonmacro_input_events as of last auto save. */ diff --git a/src/keyboard.h b/src/keyboard.h index ba3c909c4dd..31215199f14 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -194,8 +194,8 @@ extern KBOARD *all_kboards; /* Nonzero in the single-kboard state, 0 in the any-kboard state. */ extern int single_kboard; -/* Total number of times read_char has returned. */ -extern int num_input_events; +/* Total number of times read_char has returned, modulo SIZE_MAX + 1. */ +extern size_t num_input_events; /* Nonzero means polling for input is temporarily suppressed. */ extern int poll_suppress_count; -- cgit v1.2.1 From 9af30bdf17f8371664bc0c5854c91c2e46257b5e Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 26 Mar 2011 19:27:11 -0700 Subject: Remove (RET)SIGTYPE; it is identical to void on all supported systems. Ref: http://lists.gnu.org/archive/html/emacs-devel/2011-03/msg01068.html * configure.in (AC_TYPE_SIGNAL): Remove obsolete macro. (AH_BOTTOM): Do not define SIGTYPE. * lib-src/emacsclient.c: Replace SIGTYPE with void. * nt/config.nt: Remove RETSIGTYPE, SIGTYPE (identical to void). * src/syssignal.h: Replace RETSIGTYPE with void. * src/atimer.c, src/data.c, src/dispnew.c, src/emacs.c, src/floatfns.c: * src/keyboard.c, src/keyboard.h, src/lisp.h, src/process.c, src/sysdep.c: * src/xterm.c: Replace SIGTYPE with void everywhere. * src/s/template.h (SIGTYPE): Remove commented out definition. * src/s/usg5-4-common.h (SIGTYPE): Remove definition. * admin/CPP-DEFINES: Remove SIGTYPE. --- src/ChangeLog | 9 +++++++++ src/atimer.c | 4 ++-- src/data.c | 2 +- src/dispnew.c | 2 +- src/emacs.c | 4 ++-- src/floatfns.c | 6 +++--- src/keyboard.c | 12 ++++++------ src/keyboard.h | 2 +- src/lisp.h | 2 +- src/process.c | 8 ++++---- src/s/template.h | 9 --------- src/s/usg5-4-common.h | 3 --- src/sysdep.c | 4 ++-- src/syssignal.h | 2 +- src/xterm.c | 6 +++--- 15 files changed, 36 insertions(+), 39 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 06972a5bcb1..54b24c50a1c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2011-03-27 Glenn Morris + + * syssignal.h: Replace RETSIGTYPE with void. + * atimer.c, data.c, dispnew.c, emacs.c, floatfns.c, keyboard.c: + * keyboard.h, lisp.h, process.c, sysdep.c, xterm.c: + Replace SIGTYPE with void everywhere. + * s/usg5-4-common.h (SIGTYPE): Remove definition. + * s/template.h (SIGTYPE): Remove commented out definition. + 2011-03-26 Eli Zaretskii * xdisp.c (redisplay_window): Don't check buffer's clip_changed diff --git a/src/atimer.c b/src/atimer.c index e10add961eb..b947ea59ccd 100644 --- a/src/atimer.c +++ b/src/atimer.c @@ -64,7 +64,7 @@ static void set_alarm (void); static void schedule_atimer (struct atimer *); static struct atimer *append_atimer_lists (struct atimer *, struct atimer *); -SIGTYPE alarm_signal_handler (int signo); +void alarm_signal_handler (int signo); /* Start a new atimer of type TYPE. TIME specifies when the timer is @@ -388,7 +388,7 @@ run_timers (void) /* Signal handler for SIGALRM. SIGNO is the signal number, i.e. SIGALRM. */ -SIGTYPE +void alarm_signal_handler (int signo) { #ifndef SYNC_INPUT diff --git a/src/data.c b/src/data.c index 01aafbcede4..36a64d888de 100644 --- a/src/data.c +++ b/src/data.c @@ -3300,7 +3300,7 @@ syms_of_data (void) XSYMBOL (intern_c_string ("most-negative-fixnum"))->constant = 1; } -static SIGTYPE +static void arith_error (int signo) { sigsetmask (SIGEMPTYMASK); diff --git a/src/dispnew.c b/src/dispnew.c index 093ed9524e4..a15b5f45e60 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -5566,7 +5566,7 @@ marginal_area_string (struct window *w, enum window_part part, #ifdef SIGWINCH -static SIGTYPE +static void window_change_signal (int signalnum) /* If we don't have an argument, */ /* some compilers complain in signal calls. */ { diff --git a/src/emacs.c b/src/emacs.c index 0382ade728d..6bdd2550ed1 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -308,7 +308,7 @@ pthread_t main_thread; /* Handle bus errors, invalid instruction, etc. */ -SIGTYPE +void fatal_error_signal (int sig) { SIGNAL_THREAD_CHECK (sig); @@ -345,7 +345,7 @@ fatal_error_signal (int sig) #ifdef SIGDANGER /* Handler for SIGDANGER. */ -SIGTYPE +void memory_warning_signal (sig) int sig; { diff --git a/src/floatfns.c b/src/floatfns.c index bc03509b757..1232fc0afa1 100644 --- a/src/floatfns.c +++ b/src/floatfns.c @@ -103,7 +103,7 @@ extern double logb (double); #endif #ifdef FLOAT_CATCH_SIGILL -static SIGTYPE float_error (); +static void float_error (); #endif /* Nonzero while executing in floating point. @@ -126,7 +126,7 @@ static const char *float_error_fn_name; Handle errors which may result in signals or may set errno. Note that float_error may be declared to return void, so you can't - just cast the zero after the colon to (SIGTYPE) to make the types + just cast the zero after the colon to (void) to make the types check properly. */ #ifdef FLOAT_CHECK_ERRNO @@ -960,7 +960,7 @@ Rounds the value toward zero. */) } #ifdef FLOAT_CATCH_SIGILL -static SIGTYPE +static void float_error (signo) int signo; { diff --git a/src/keyboard.c b/src/keyboard.c index c4ef2795f6a..06f375e0d9c 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -434,15 +434,15 @@ static void restore_getcjmp (jmp_buf); static Lisp_Object apply_modifiers (int, Lisp_Object); static void clear_event (struct input_event *); static Lisp_Object restore_kboard_configuration (Lisp_Object); -static SIGTYPE interrupt_signal (int signalnum); +static void interrupt_signal (int signalnum); #ifdef SIGIO -static SIGTYPE input_available_signal (int signo); +static void input_available_signal (int signo); #endif static void handle_interrupt (void); static void timer_start_idle (void); static void timer_stop_idle (void); static void timer_resume_idle (void); -static SIGTYPE handle_user_signal (int); +static void handle_user_signal (int); static char *find_user_signal_name (int); static int store_user_signal_events (void); @@ -7082,7 +7082,7 @@ process_pending_signals (void) #ifdef SIGIO /* for entire page */ /* Note SIGIO has been undef'd if FIONREAD is missing. */ -static SIGTYPE +static void input_available_signal (int signo) { /* Must preserve main program's value of errno. */ @@ -7160,7 +7160,7 @@ add_user_signal (int sig, const char *name) signal (sig, handle_user_signal); } -static SIGTYPE +static void handle_user_signal (int sig) { int old_errno = errno; @@ -10712,7 +10712,7 @@ clear_waiting_for_input (void) SIGINT was generated by C-g, so we call handle_interrupt. Otherwise, the handler kills Emacs. */ -static SIGTYPE +static void interrupt_signal (int signalnum) /* If we don't have an argument, some */ /* compilers complain in signal calls. */ { diff --git a/src/keyboard.h b/src/keyboard.h index ba3c909c4dd..2ff370306b6 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -485,7 +485,7 @@ extern void push_frame_kboard (struct frame *); extern void pop_kboard (void); extern void temporarily_switch_to_single_kboard (struct frame *); extern void record_asynch_buffer_change (void); -extern SIGTYPE input_poll_signal (int); +extern void input_poll_signal (int); extern void start_polling (void); extern void stop_polling (void); extern void set_poll_suppress_count (int); diff --git a/src/lisp.h b/src/lisp.h index e98172ec104..8c7d4da8aa9 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3181,7 +3181,7 @@ extern Lisp_Object decode_env_path (const char *, const char *); extern Lisp_Object empty_unibyte_string, empty_multibyte_string; extern Lisp_Object Qfile_name_handler_alist; extern void (*fatal_error_signal_hook) (void); -extern SIGTYPE fatal_error_signal (int); +extern void fatal_error_signal (int); EXFUN (Fkill_emacs, 1) NO_RETURN; #if HAVE_SETLOCALE void fixup_locale (void); diff --git a/src/process.c b/src/process.c index 639b6a49fce..148f5b59f8a 100644 --- a/src/process.c +++ b/src/process.c @@ -5470,7 +5470,7 @@ read_process_output (Lisp_Object proc, register int channel) jmp_buf send_process_frame; Lisp_Object process_sent_to; -static SIGTYPE +static void send_process_trap (int ignore) { SIGNAL_THREAD_CHECK (SIGPIPE); @@ -5497,7 +5497,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf, EMACS_INT rv; struct coding_system *coding; struct gcpro gcpro1; - SIGTYPE (*volatile old_sigpipe) (int); + void (*volatile old_sigpipe) (int); GCPRO1 (object); @@ -5619,7 +5619,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf, while (this > 0) { int outfd = p->outfd; - old_sigpipe = (SIGTYPE (*) (int)) signal (SIGPIPE, send_process_trap); + old_sigpipe = (void (*) (int)) signal (SIGPIPE, send_process_trap); #ifdef DATAGRAM_SOCKETS if (DATAGRAM_CHAN_P (outfd)) { @@ -6379,7 +6379,7 @@ process has been transmitted to the serial port. */) indirectly; if it does, that is a bug */ #ifdef SIGCHLD -static SIGTYPE +static void sigchld_handler (int signo) { int old_errno = errno; diff --git a/src/s/template.h b/src/s/template.h index ee5afa81de4..4e0400e99e3 100644 --- a/src/s/template.h +++ b/src/s/template.h @@ -77,15 +77,6 @@ along with GNU Emacs. If not, see . */ a file that someone else has modified in his Emacs. */ #define CLASH_DETECTION -/* Define this if your operating system declares signal handlers to - have a type other than the usual. `The usual' is `void' for ANSI C - systems (i.e. when the __STDC__ macro is defined), and `int' for - pre-ANSI systems. If you're using GCC on an older system, __STDC__ - will be defined, but the system's include files will still say that - signal returns int or whatever; in situations like that, define - this to be what the system's include files want. */ -/* #define SIGTYPE int */ - /* If the character used to separate elements of the executable path is not ':', #define this to be the appropriate character constant. */ /* #define SEPCHAR ':' */ diff --git a/src/s/usg5-4-common.h b/src/s/usg5-4-common.h index aeedd7f4b15..236f71e3007 100644 --- a/src/s/usg5-4-common.h +++ b/src/s/usg5-4-common.h @@ -38,9 +38,6 @@ along with GNU Emacs. If not, see . */ /* The docs for system V/386 suggest v.3 has sigpause, so let's try it. */ #define HAVE_SYSV_SIGPAUSE -/* On USG systems signal handlers return void. */ -#define SIGTYPE void - /* Get FIONREAD from . Get to get struct tchars. But get first to make sure ttold.h doesn't interfere. And don't try to use SIGIO yet. */ diff --git a/src/sysdep.c b/src/sysdep.c index 14db0fd26d0..1bb400421f0 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -449,7 +449,7 @@ child_setup_tty (int out) struct save_signal { int code; - SIGTYPE (*handler) (int); + void (*handler) (int); }; static void save_signal_handlers (struct save_signal *); @@ -608,7 +608,7 @@ save_signal_handlers (struct save_signal *saved_handlers) while (saved_handlers->code) { saved_handlers->handler - = (SIGTYPE (*) (int)) signal (saved_handlers->code, SIG_IGN); + = (void (*) (int)) signal (saved_handlers->code, SIG_IGN); saved_handlers++; } } diff --git a/src/syssignal.h b/src/syssignal.h index 7b4070322d6..03768168e20 100644 --- a/src/syssignal.h +++ b/src/syssignal.h @@ -69,7 +69,7 @@ extern sigset_t sys_sigmask (); /* Whether this is what all systems want or not, this is what appears to be assumed in the source, for example data.c:arith_error. */ -typedef RETSIGTYPE (*signal_handler_t) (int); +typedef void (*signal_handler_t) (int); signal_handler_t sys_signal (int signal_number, signal_handler_t action); sigset_t sys_sigblock (sigset_t new_mask); diff --git a/src/xterm.c b/src/xterm.c index f87c22912a4..0b18356b0a3 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -349,7 +349,7 @@ static int handle_one_xevent (struct x_display_info *, XEvent *, int *, struct input_event *); /* Don't declare this NO_RETURN because we want no interference with debugging failing X calls. */ -static SIGTYPE x_connection_closed (Display *, const char *); +static void x_connection_closed (Display *, const char *); /* Flush display of frame F, or of all frames if F is null. */ @@ -7650,7 +7650,7 @@ x_trace_wire (void) SIGPIPE will fail, causing Xlib to invoke the X IO error handler, which will do the appropriate cleanup for us. */ -static SIGTYPE +static void x_connection_signal (int signalnum) /* If we don't have an argument, */ /* some compilers complain in signal calls. */ { @@ -7673,7 +7673,7 @@ static char *error_msg; /* Handle the loss of connection to display DPY. ERROR_MESSAGE is the text of an error message that lead to the connection loss. */ -static SIGTYPE +static void x_connection_closed (Display *dpy, const char *error_message) { struct x_display_info *dpyinfo = x_display_info_for_display (dpy); -- cgit v1.2.1 From fe75f92609a806701f8a4d0385f3a053bc00e63d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 27 Mar 2011 01:10:27 -0700 Subject: * chartab.c (sub_char_table_ref_and_range): Redo for slight efficiency gain, and to bypass a gcc -Wstrict-overflow warning. --- src/ChangeLog | 3 +++ src/chartab.c | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 8a20c06b41c..6127bc0e8da 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-27 Paul Eggert + * chartab.c (sub_char_table_ref_and_range): Redo for slight + efficiency gain, and to bypass a gcc -Wstrict-overflow warning. + * keyboard.c, keyboard.h (num_input_events): Now size_t. This avoids undefined behavior on integer overflow, and is a bit more convenient anyway since it is compared to a size_t variable. diff --git a/src/chartab.c b/src/chartab.c index 85aa5932ac3..9ad182131e9 100644 --- a/src/chartab.c +++ b/src/chartab.c @@ -215,7 +215,6 @@ sub_char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to, Lisp struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table); int depth = XINT (tbl->depth); int min_char = XINT (tbl->min_char); - int max_char = min_char + chartab_chars[depth - 1] - 1; int chartab_idx = CHARTAB_IDX (c, depth, min_char), idx; Lisp_Object val; @@ -244,8 +243,9 @@ sub_char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to, Lisp break; } } - while ((c = min_char + (chartab_idx + 1) * chartab_chars[depth]) <= max_char - && *to >= c) + while (((c = (chartab_idx + 1) * chartab_chars[depth]) + < chartab_chars[depth - 1]) + && (c += min_char) <= *to) { Lisp_Object this_val; -- cgit v1.2.1 From eb4d412de87ff7078f4c0923ea014db01b7ce551 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 27 Mar 2011 01:21:49 -0700 Subject: * syntax.c (scan_sexps_forward): Avoid pointer wraparound. --- src/ChangeLog | 2 ++ src/syntax.c | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 3d917d0e5a4..8704ba4b904 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-27 Paul Eggert + * syntax.c (scan_sexps_forward): Avoid pointer wraparound. + * xterm.c (x_make_frame_visible, same_x_server): Redo to avoid overflow concerns. diff --git a/src/syntax.c b/src/syntax.c index c1442c396c1..0a1525b54ea 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -3265,9 +3265,9 @@ do { prev_from = from; \ = (curlevel == levelstart) ? -1 : (curlevel - 1)->last; state.location = from; state.levelstarts = Qnil; - while (--curlevel >= levelstart) - state.levelstarts = Fcons (make_number (curlevel->last), - state.levelstarts); + while (curlevel > levelstart) + state.levelstarts = Fcons (make_number ((--curlevel)->last), + state.levelstarts); immediate_quit = 0; *stateptr = state; -- cgit v1.2.1 From a3eed4788d421bbb778a3832fe17d82cafe3ca41 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 27 Mar 2011 01:29:39 -0700 Subject: * eval.c (Fbacktrace): Don't assume nargs fits in int. --- src/ChangeLog | 2 ++ src/eval.c | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 8704ba4b904..57389f306be 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-03-27 Paul Eggert + * eval.c (Fbacktrace): Don't assume nargs fits in int. + * syntax.c (scan_sexps_forward): Avoid pointer wraparound. * xterm.c (x_make_frame_visible, same_x_server): Redo to avoid overflow diff --git a/src/eval.c b/src/eval.c index b9d9354f48a..b732cbc644a 100644 --- a/src/eval.c +++ b/src/eval.c @@ -3298,7 +3298,6 @@ Output stream used is value of `standard-output'. */) (void) { register struct backtrace *backlist = backtrace_list; - register int i; Lisp_Object tail; Lisp_Object tem; struct gcpro gcpro1; @@ -3325,9 +3324,10 @@ Output stream used is value of `standard-output'. */) write_string ("(", -1); if (backlist->nargs == (size_t) MANY) { + int i; for (tail = *backlist->args, i = 0; !NILP (tail); - tail = Fcdr (tail), i++) + tail = Fcdr (tail), i = 1) { if (i) write_string (" ", -1); Fprin1 (Fcar (tail), Qnil); @@ -3335,6 +3335,7 @@ Output stream used is value of `standard-output'. */) } else { + size_t i; for (i = 0; i < backlist->nargs; i++) { if (i) write_string (" ", -1); -- cgit v1.2.1 From 5d5d959d59d80e3beebc9788333ea5a2449a10df Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 27 Mar 2011 01:31:16 -0700 Subject: * eval.c (Fbacktrace_frame): Don't assume nframes fits in int. --- src/ChangeLog | 1 + src/eval.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 57389f306be..3998d74ba0c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,7 @@ 2011-03-27 Paul Eggert * eval.c (Fbacktrace): Don't assume nargs fits in int. + (Fbacktrace_frame): Don't assume nframes fits in int. * syntax.c (scan_sexps_forward): Avoid pointer wraparound. diff --git a/src/eval.c b/src/eval.c index b732cbc644a..982fec66bbf 100644 --- a/src/eval.c +++ b/src/eval.c @@ -3365,7 +3365,7 @@ If NFRAMES is more than the number of frames, the value is nil. */) (Lisp_Object nframes) { register struct backtrace *backlist = backtrace_list; - register int i; + register EMACS_INT i; Lisp_Object tem; CHECK_NATNUM (nframes); -- cgit v1.2.1 From 3c59b4c9d671ec0298a8489eabbd09af47039852 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 27 Mar 2011 02:07:38 -0700 Subject: * callproc.c (Fcall_process, Fcall_process_region): Use SAFE_ALLOCA instead of alloca (Bug#8344). --- src/ChangeLog | 3 +++ src/callproc.c | 58 ++++++++++++++++++++++++++++++++++------------------------ 2 files changed, 37 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 3998d74ba0c..6cb8ad8000d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-27 Paul Eggert + * callproc.c (Fcall_process, Fcall_process_region): Use SAFE_ALLOCA + instead of alloca (Bug#8344). + * eval.c (Fbacktrace): Don't assume nargs fits in int. (Fbacktrace_frame): Don't assume nframes fits in int. diff --git a/src/callproc.c b/src/callproc.c index acb7a0e24b1..eb2a2268fe1 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -189,6 +189,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) char buf[CALLPROC_BUFFER_SIZE_MAX]; int bufsize = CALLPROC_BUFFER_SIZE_MIN; int count = SPECPDL_INDEX (); + volatile USE_SAFE_ALLOCA; const unsigned char **volatile new_argv_volatile; register const unsigned char **new_argv; @@ -242,7 +243,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) val = Qraw_text; else { - args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2); + SAFE_ALLOCA (args2, Lisp_Object *, (nargs + 1) * sizeof *args2); args2[0] = Qcall_process; for (i = 0; i < nargs; i++) args2[i + 1] = args[i]; coding_systems = Ffind_operation_coding_system (nargs + 1, args2); @@ -372,8 +373,9 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) && SREF (path, 1) == ':') path = Fsubstring (path, make_number (2), Qnil); - new_argv_volatile = new_argv = (const unsigned char **) - alloca ((nargs > 4 ? nargs - 2 : 2) * sizeof (char *)); + SAFE_ALLOCA (new_argv, const unsigned char **, + (nargs > 4 ? nargs - 2 : 2) * sizeof *new_argv); + new_argv_volatile = new_argv; if (nargs > 4) { register size_t i; @@ -645,7 +647,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) { size_t i; - args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2); + SAFE_ALLOCA (args2, Lisp_Object *, (nargs + 1) * sizeof *args2); args2[0] = Qcall_process; for (i = 0; i < nargs; i++) args2[i + 1] = args[i]; coding_systems @@ -809,6 +811,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) when exiting. */ call_process_exited = 1; + SAFE_FREE (); unbind_to (count, Qnil); if (synch_process_termsig) @@ -897,30 +900,35 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r #endif } - pattern = Fexpand_file_name (Vtemp_file_name_pattern, tmpdir); - tempfile = (char *) alloca (SBYTES (pattern) + 1); - memcpy (tempfile, SDATA (pattern), SBYTES (pattern) + 1); - coding_systems = Qt; + { + USE_SAFE_ALLOCA; + pattern = Fexpand_file_name (Vtemp_file_name_pattern, tmpdir); + SAFE_ALLOCA (tempfile, char *, SBYTES (pattern) + 1); + memcpy (tempfile, SDATA (pattern), SBYTES (pattern) + 1); + coding_systems = Qt; #ifdef HAVE_MKSTEMP - { - int fd; - - BLOCK_INPUT; - fd = mkstemp (tempfile); - UNBLOCK_INPUT; - if (fd == -1) - report_file_error ("Failed to open temporary file", - Fcons (Vtemp_file_name_pattern, Qnil)); - else - close (fd); - } + { + int fd; + + BLOCK_INPUT; + fd = mkstemp (tempfile); + UNBLOCK_INPUT; + if (fd == -1) + report_file_error ("Failed to open temporary file", + Fcons (Vtemp_file_name_pattern, Qnil)); + else + close (fd); + } #else - mktemp (tempfile); + mktemp (tempfile); #endif - filename_string = build_string (tempfile); - GCPRO1 (filename_string); + filename_string = build_string (tempfile); + GCPRO1 (filename_string); + SAFE_FREE (); + } + start = args[0]; end = args[1]; /* Decide coding-system of the contents of the temporary file. */ @@ -930,11 +938,13 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r val = Qraw_text; else { - args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2); + USE_SAFE_ALLOCA; + SAFE_ALLOCA (args2, Lisp_Object *, (nargs + 1) * sizeof *args2); args2[0] = Qcall_process_region; for (i = 0; i < nargs; i++) args2[i + 1] = args[i]; coding_systems = Ffind_operation_coding_system (nargs + 1, args2); val = CONSP (coding_systems) ? XCDR (coding_systems) : Qnil; + SAFE_FREE (); } val = complement_process_encoding_system (val); -- cgit v1.2.1 From 5c380ffb17f2fb6f22d9f24a7732b7e4a1e0cd52 Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Sun, 27 Mar 2011 11:23:52 +0200 Subject: * nsmenu.m (runDialogAt): Remove argument to timer_check. --- src/ChangeLog | 4 ++++ src/nsmenu.m | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 54b24c50a1c..eb03806b33a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2011-03-27 Jan Djärv + + * nsmenu.m (runDialogAt): Remove argument to timer_check. + 2011-03-27 Glenn Morris * syssignal.h: Replace RETSIGTYPE with void. diff --git a/src/nsmenu.m b/src/nsmenu.m index e8d4a256906..623c933ce8e 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -1705,7 +1705,6 @@ void process_dialog (id window, Lisp_Object list) - (Lisp_Object)runDialogAt: (NSPoint)p { NSInteger ret; - extern EMACS_TIME timer_check (int do_it_now); /* TODO: add to a header */ /* initiate a session that will be ended by pop_down_menu */ popupSession = [NSApp beginModalSessionForWindow: self]; @@ -1715,7 +1714,7 @@ void process_dialog (id window, Lisp_Object list) { /* Run this for timers.el, indep of atimers; might not return. TODO: use return value to avoid calling every iteration. */ - timer_check (1); + timer_check (); [NSThread sleepUntilDate: [NSDate dateWithTimeIntervalSinceNow: 0.1]]; } -- cgit v1.2.1 From f0a1382af3afa31708d3ce2f4c28bce61565aada Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Sun, 27 Mar 2011 12:36:44 +0200 Subject: Introduce ns-auto-hide-menu-bar to hide menubar for Emacs frames. Code by Anders Lindgren. * nsterm.m (ns_menu_bar_is_hidden): New variable. (ns_constrain_all_frames, ns_menu_bar_should_be_hidden) (ns_update_auto_hide_menu_bar): New functions. (ns_update_begin): Call ns_update_auto_hide_menu_bar. (applicationDidBecomeActive): Call ns_update_auto_hide_menu_bar and ns_constrain_all_frames. (constrainFrameRect): Return at once if ns_menu_bar_should_be_hidden. (syms_of_nsterm): DEFVAR ns-auto-hide-menu-bar, init to Qnil. --- src/ChangeLog | 11 +++++ src/nsterm.m | 130 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 140 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index eb03806b33a..96f60877fce 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2011-03-27 Anders Lindgren + + * nsterm.m (ns_menu_bar_is_hidden): New variable. + (ns_constrain_all_frames, ns_menu_bar_should_be_hidden) + (ns_update_auto_hide_menu_bar): New functions. + (ns_update_begin): Call ns_update_auto_hide_menu_bar. + (applicationDidBecomeActive): Call ns_update_auto_hide_menu_bar and + ns_constrain_all_frames. + (constrainFrameRect): Return at once if ns_menu_bar_should_be_hidden. + (syms_of_nsterm): DEFVAR ns-auto-hide-menu-bar, init to Qnil. + 2011-03-27 Jan Djärv * nsmenu.m (runDialogAt): Remove argument to timer_check. diff --git a/src/nsterm.m b/src/nsterm.m index c7cd411c614..ebfa875ae0e 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -170,6 +170,7 @@ BOOL ns_in_resize = NO; static BOOL ns_fake_keydown = NO; int ns_tmp_flags; /* FIXME */ struct nsfont_info *ns_tmp_font; /* FIXME */ +static BOOL ns_menu_bar_is_hidden = NO; /*static int debug_lock = 0; */ /* event loop */ @@ -505,6 +506,118 @@ ns_resize_handle_rect (NSWindow *window) } +// +// Window constraining +// ------------------- +// +// To ensure that the windows are not placed under the menu bar, they +// are typically moved by the call-back constrainFrameRect. However, +// by overriding it, it's possible to inhibit this, leaving the window +// in it's original position. +// +// It's possible to hide the menu bar. However, technically, it's only +// possible to hide it when the application is active. To ensure that +// this work properly, the menu bar and window constraining are +// deferred until the application becomes active. +// +// Even though it's not possible to manually move a window above the +// top of the screen, it is allowed if it's done programmatically, +// when the menu is hidden. This allows the editable area to cover the +// full screen height. +// +// Test cases +// ---------- +// +// Use the following extra files: +// +// init.el: +// ;; Hide menu and place frame slightly above the top of the screen. +// (setq ns-auto-hide-menu-bar t) +// (set-frame-position (selected-frame) 0 -20) +// +// Test 1: +// +// emacs -Q -l init.el +// +// Result: No menu bar, and the title bar should be above the screen. +// +// Test 2: +// +// emacs -Q +// +// Result: Menu bar visible, frame placed immediately below the menu. +// + +static void +ns_constrain_all_frames (void) +{ + Lisp_Object tail, frame; + + FOR_EACH_FRAME (tail, frame) + { + struct frame *f = XFRAME (frame); + if (FRAME_NS_P (f)) + { + NSView *view = FRAME_NS_VIEW (f); + /* This no-op will trigger the default window placing + * constriant system. */ + f->output_data.ns->dont_constrain = 0; + [[view window] setFrameOrigin:[[view window] frame].origin]; + } + } +} + + +/* True, if the menu bar should be hidden. */ + +static BOOL +ns_menu_bar_should_be_hidden (void) +{ + return !NILP (ns_auto_hide_menu_bar) + && [NSApp respondsToSelector:@selector(setPresentationOptions:)]; +} + + +/* Show or hide the menu bar, based on user setting. */ + +static void +ns_update_auto_hide_menu_bar (void) +{ + BLOCK_INPUT; + + NSTRACE (ns_update_auto_hide_menu_bar); + + if (NSApp != nil + && [NSApp isActive] + && [NSApp respondsToSelector:@selector(setPresentationOptions:)]) + { + // Note, "setPresentationOptions" triggers an error unless the + // application is active. + BOOL menu_bar_should_be_hidden = ns_menu_bar_should_be_hidden (); + + if (menu_bar_should_be_hidden != ns_menu_bar_is_hidden) + { + NSApplicationPresentationOptions options + = NSApplicationPresentationAutoHideDock; + + if (menu_bar_should_be_hidden) + options |= NSApplicationPresentationAutoHideMenuBar; + + [NSApp setPresentationOptions: options]; + + ns_menu_bar_is_hidden = menu_bar_should_be_hidden; + + if (!ns_menu_bar_is_hidden) + { + ns_constrain_all_frames (); + } + } + } + + UNBLOCK_INPUT; +} + + static void ns_update_begin (struct frame *f) /* -------------------------------------------------------------------------- @@ -515,6 +628,8 @@ ns_update_begin (struct frame *f) NSView *view = FRAME_NS_VIEW (f); NSTRACE (ns_update_begin); + ns_update_auto_hide_menu_bar (); + ns_updating_frame = f; [view lockFocus]; @@ -4205,7 +4320,13 @@ ns_term_shutdown (int sig) } - (void)applicationDidBecomeActive: (NSNotification *)notification { + NSTRACE (applicationDidBecomeActive); + //ns_app_active=YES; + + ns_update_auto_hide_menu_bar (); + // No constrining takes place when the application is not active. + ns_constrain_all_frames (); } - (void)applicationDidResignActive: (NSNotification *)notification { @@ -5689,7 +5810,10 @@ ns_term_shutdown (int sig) /* When making the frame visible for the first time, we want to constrain. Other times not. */ struct frame *f = ((EmacsView *)[self delegate])->emacsframe; - if (f->output_data.ns->dont_constrain) + NSTRACE (constrainFrameRect); + + if (f->output_data.ns->dont_constrain + || ns_menu_bar_should_be_hidden ()) return frameRect; f->output_data.ns->dont_constrain = 1; @@ -6361,6 +6485,10 @@ allowing it to be used at a lower level for accented character entry."); staticpro (&last_mouse_motion_frame); last_mouse_motion_frame = Qnil; + DEFVAR_LISP ("ns-auto-hide-menu-bar", ns_auto_hide_menu_bar, + "Non-nil means that the menu bar is hidden, but appears when the mouse is near. Only works on OSX 10.6 or later."); + ns_auto_hide_menu_bar = Qnil; + /* TODO: move to common code */ DEFVAR_LISP ("x-toolkit-scroll-bars", Vx_toolkit_scroll_bars, doc: /* If not nil, Emacs uses toolkit scroll bars. */); -- cgit v1.2.1 From 5ffb62aa7e2a1f60e05399a0088e77a3e7a57d81 Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Sun, 27 Mar 2011 12:55:07 +0200 Subject: Format doc and add customize for ns-auto-hide-menu-bar. * lisp/cus-start.el (all): Add boolean ns-auto-hide-menu-bar. * src/nsterm.m (syms_of_nsterm): Use doc: for ns-auto-hide-menu-bar. --- src/ChangeLog | 4 ++++ src/nsterm.m | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 96f60877fce..0ed011884ca 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2011-03-27 Jan Djärv + + * nsterm.m (syms_of_nsterm): Use doc: for ns-auto-hide-menu-bar. + 2011-03-27 Anders Lindgren * nsterm.m (ns_menu_bar_is_hidden): New variable. diff --git a/src/nsterm.m b/src/nsterm.m index ebfa875ae0e..91f0cbba585 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -6486,7 +6486,8 @@ allowing it to be used at a lower level for accented character entry."); last_mouse_motion_frame = Qnil; DEFVAR_LISP ("ns-auto-hide-menu-bar", ns_auto_hide_menu_bar, - "Non-nil means that the menu bar is hidden, but appears when the mouse is near. Only works on OSX 10.6 or later."); + doc: /* Non-nil means that the menu bar is hidden, but appears when the mouse is near. +Only works on OSX 10.6 or later. */); ns_auto_hide_menu_bar = Qnil; /* TODO: move to common code */ -- cgit v1.2.1 From ba0165e1f14c55aaba73de35d75a9acea721c825 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 27 Mar 2011 10:14:11 -0700 Subject: * keyboard.c (parse_modifiers_uncached, parse_modifiers): Don't assume string length fits in int. --- src/ChangeLog | 3 +++ src/keyboard.c | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 6cb8ad8000d..bfee23b16d0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-27 Paul Eggert + * keyboard.c (parse_modifiers_uncached, parse_modifiers): + Don't assume string length fits in int. + * callproc.c (Fcall_process, Fcall_process_region): Use SAFE_ALLOCA instead of alloca (Bug#8344). diff --git a/src/keyboard.c b/src/keyboard.c index 28d65766664..e29c7e9bc5c 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -5959,10 +5959,10 @@ make_lispy_switch_frame (Lisp_Object frame) This doesn't use any caches. */ static int -parse_modifiers_uncached (Lisp_Object symbol, int *modifier_end) +parse_modifiers_uncached (Lisp_Object symbol, EMACS_INT *modifier_end) { Lisp_Object name; - int i; + EMACS_INT i; int modifiers; CHECK_SYMBOL (symbol); @@ -5972,7 +5972,7 @@ parse_modifiers_uncached (Lisp_Object symbol, int *modifier_end) for (i = 0; i+2 <= SBYTES (name); ) { - int this_mod_end = 0; + EMACS_INT this_mod_end = 0; int this_mod = 0; /* See if the name continues with a modifier word. @@ -6169,7 +6169,7 @@ parse_modifiers (Lisp_Object symbol) return elements; else { - int end; + EMACS_INT end; int modifiers = parse_modifiers_uncached (symbol, &end); Lisp_Object unmodified; Lisp_Object mask; -- cgit v1.2.1 From 32ad8845a456fef4118a657b79129e837b4ec778 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 27 Mar 2011 11:18:31 -0700 Subject: * keyboard.c (keyremap_step, read_key_sequence): Use size_t for sizes. --- src/ChangeLog | 1 + src/keyboard.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index bfee23b16d0..8b32aa78a6d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,6 +2,7 @@ * keyboard.c (parse_modifiers_uncached, parse_modifiers): Don't assume string length fits in int. + (keyremap_step, read_key_sequence): Use size_t for sizes. * callproc.c (Fcall_process, Fcall_process_region): Use SAFE_ALLOCA instead of alloca (Bug#8344). diff --git a/src/keyboard.c b/src/keyboard.c index e29c7e9bc5c..0fde344478e 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1270,7 +1270,7 @@ some_mouse_moved (void) /* This is the actual command reading loop, sans error-handling encapsulation. */ -static int read_key_sequence (Lisp_Object *, int, Lisp_Object, +static int read_key_sequence (Lisp_Object *, size_t, Lisp_Object, int, int, int); void safe_run_hooks (Lisp_Object); static void adjust_point_for_property (EMACS_INT, int); @@ -8748,7 +8748,7 @@ access_keymap_keyremap (Lisp_Object map, Lisp_Object key, Lisp_Object prompt, The return value is non-zero if the remapping actually took place. */ static int -keyremap_step (Lisp_Object *keybuf, int bufsize, volatile keyremap *fkey, +keyremap_step (Lisp_Object *keybuf, size_t bufsize, volatile keyremap *fkey, int input, int doit, int *diff, Lisp_Object prompt) { Lisp_Object next, key; @@ -8841,7 +8841,7 @@ keyremap_step (Lisp_Object *keybuf, int bufsize, volatile keyremap *fkey, from the selected window's buffer. */ static int -read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, +read_key_sequence (Lisp_Object *keybuf, size_t bufsize, Lisp_Object prompt, int dont_downcase_last, int can_return_switch_frame, int fix_current_buffer) { -- cgit v1.2.1 From 48011560d73038cbfebfd9d272eabec55005db78 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 27 Mar 2011 11:33:45 -0700 Subject: * keyboard.c (read_key_sequence): Don't check last_real_key_start redundantly. --- src/ChangeLog | 1 + src/keyboard.c | 134 +++++++++++++++++++++++++++++---------------------------- 2 files changed, 70 insertions(+), 65 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 8b32aa78a6d..eb1555db6fb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -3,6 +3,7 @@ * keyboard.c (parse_modifiers_uncached, parse_modifiers): Don't assume string length fits in int. (keyremap_step, read_key_sequence): Use size_t for sizes. + (read_key_sequence): Don't check last_real_key_start redundantly. * callproc.c (Fcall_process, Fcall_process_region): Use SAFE_ALLOCA instead of alloca (Bug#8344). diff --git a/src/keyboard.c b/src/keyboard.c index 0fde344478e..6c706590dc4 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -9359,80 +9359,84 @@ read_key_sequence (Lisp_Object *keybuf, size_t bufsize, Lisp_Object prompt, last_real_key_start = t - 1; } - /* Key sequences beginning with mouse clicks are - read using the keymaps in the buffer clicked on, - not the current buffer. If we're at the - beginning of a key sequence, switch buffers. */ - if (last_real_key_start == 0 - && WINDOWP (window) - && BUFFERP (XWINDOW (window)->buffer) - && XBUFFER (XWINDOW (window)->buffer) != current_buffer) + if (last_real_key_start == 0) { - XVECTOR (raw_keybuf)->contents[raw_keybuf_count++] = key; - keybuf[t] = key; - mock_input = t + 1; - - /* Arrange to go back to the original buffer once we're - done reading the key sequence. Note that we can't - use save_excursion_{save,restore} here, because they - save point as well as the current buffer; we don't - want to save point, because redisplay may change it, - to accommodate a Fset_window_start or something. We - don't want to do this at the top of the function, - because we may get input from a subprocess which - wants to change the selected window and stuff (say, - emacsclient). */ - record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); - - if (! FRAME_LIVE_P (XFRAME (selected_frame))) - Fkill_emacs (Qnil); - set_buffer_internal (XBUFFER (XWINDOW (window)->buffer)); - orig_local_map = get_local_map (PT, current_buffer, - Qlocal_map); - orig_keymap = get_local_map (PT, current_buffer, Qkeymap); - goto replay_sequence; - } + /* Key sequences beginning with mouse clicks are + read using the keymaps in the buffer clicked on, + not the current buffer. If we're at the + beginning of a key sequence, switch buffers. */ + if (WINDOWP (window) + && BUFFERP (XWINDOW (window)->buffer) + && XBUFFER (XWINDOW (window)->buffer) != current_buffer) + { + XVECTOR (raw_keybuf)->contents[raw_keybuf_count++] = key; + keybuf[t] = key; + mock_input = t + 1; + + /* Arrange to go back to the original buffer once we're + done reading the key sequence. Note that we can't + use save_excursion_{save,restore} here, because they + save point as well as the current buffer; we don't + want to save point, because redisplay may change it, + to accommodate a Fset_window_start or something. We + don't want to do this at the top of the function, + because we may get input from a subprocess which + wants to change the selected window and stuff (say, + emacsclient). */ + record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); + + if (! FRAME_LIVE_P (XFRAME (selected_frame))) + Fkill_emacs (Qnil); + set_buffer_internal (XBUFFER (XWINDOW (window)->buffer)); + orig_local_map = get_local_map (PT, current_buffer, + Qlocal_map); + orig_keymap = get_local_map (PT, current_buffer, + Qkeymap); + goto replay_sequence; + } - /* For a mouse click, get the local text-property keymap - of the place clicked on, rather than point. */ - if (last_real_key_start == 0 - && CONSP (XCDR (key)) - && ! localized_local_map) - { - Lisp_Object map_here, start, pos; + /* For a mouse click, get the local text-property keymap + of the place clicked on, rather than point. */ + if (CONSP (XCDR (key)) + && ! localized_local_map) + { + Lisp_Object map_here, start, pos; - localized_local_map = 1; - start = EVENT_START (key); + localized_local_map = 1; + start = EVENT_START (key); - if (CONSP (start) && POSN_INBUFFER_P (start)) - { - pos = POSN_BUFFER_POSN (start); - if (INTEGERP (pos) - && XINT (pos) >= BEGV - && XINT (pos) <= ZV) + if (CONSP (start) && POSN_INBUFFER_P (start)) { - map_here = get_local_map (XINT (pos), - current_buffer, Qlocal_map); - if (!EQ (map_here, orig_local_map)) + pos = POSN_BUFFER_POSN (start); + if (INTEGERP (pos) + && XINT (pos) >= BEGV + && XINT (pos) <= ZV) { - orig_local_map = map_here; - ++localized_local_map; - } + map_here = get_local_map (XINT (pos), + current_buffer, + Qlocal_map); + if (!EQ (map_here, orig_local_map)) + { + orig_local_map = map_here; + ++localized_local_map; + } - map_here = get_local_map (XINT (pos), - current_buffer, Qkeymap); - if (!EQ (map_here, orig_keymap)) - { - orig_keymap = map_here; - ++localized_local_map; - } + map_here = get_local_map (XINT (pos), + current_buffer, + Qkeymap); + if (!EQ (map_here, orig_keymap)) + { + orig_keymap = map_here; + ++localized_local_map; + } - if (localized_local_map > 1) - { - keybuf[t] = key; - mock_input = t + 1; + if (localized_local_map > 1) + { + keybuf[t] = key; + mock_input = t + 1; - goto replay_sequence; + goto replay_sequence; + } } } } -- cgit v1.2.1 From 1db5b1ad87a145871fc1120ec949fee9211de9cb Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Mon, 28 Mar 2011 05:29:18 +0200 Subject: src/*.c: Remove unused parameters and other warnings. * dispextern.h (string_buffer_position): Remove declaration. * print.c (strout): Remove parameter `multibyte', unused since 1999-08-21T19:30:21Z!gerd@gnu.org. All callers changed. * search.c (boyer_moore): Remove parameters `len', `pos' and `lim', never used since function introduction in 1998-02-08T21:33:56Z!rms@gnu.org. All callers changed. * w32.c (_wsa_errlist): Use braces for struct initializers. * xdisp.c (string_buffer_position_lim): Remove parameter `w', never used since function introduction in 2001-03-09T18:41:50Z!gerd@gnu.org. All callers changed. (string_buffer_position): Likewise. Also, make static (it's never used outside xdisp.c). (cursor_row_p): Remove parameter `w', unused since 2000-10-17T16:08:57Z!gerd@gnu.org. All callers changed. (decode_mode_spec): Remove parameter `precision', introduced during Gerd Moellmann's rewrite at 1999-07-21T21:43:52Z!gerd@gnu.org, but never used. All callers changed. --- src/ChangeLog | 24 ++++++++++ src/dispextern.h | 2 - src/print.c | 131 +++++++++++++++++++++++++++---------------------------- src/search.c | 28 ++++++------ src/w32.c | 130 +++++++++++++++++++++++++++--------------------------- src/xdisp.c | 72 ++++++++++++++---------------- 6 files changed, 199 insertions(+), 188 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 0ed011884ca..75b75ab522c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,27 @@ +2011-03-28 Juanma Barranquero + + * dispextern.h (string_buffer_position): Remove declaration. + + * print.c (strout): Remove parameter `multibyte', unused since + 1999-08-21T19:30:21Z!gerd@gnu.org. All callers changed. + + * search.c (boyer_moore): Remove parameters `len', `pos' and `lim', + never used since function introduction in 1998-02-08T21:33:56Z!rms@gnu.org. + All callers changed. + + * w32.c (_wsa_errlist): Use braces for struct initializers. + + * xdisp.c (string_buffer_position_lim): Remove parameter `w', + never used since function introduction in 2001-03-09T18:41:50Z!gerd@gnu.org. + All callers changed. + (string_buffer_position): Likewise. Also, make static (it's never + used outside xdisp.c). + (cursor_row_p): Remove parameter `w', unused since + 2000-10-17T16:08:57Z!gerd@gnu.org. All callers changed. + (decode_mode_spec): Remove parameter `precision', introduced during + Gerd Moellmann's rewrite at 1999-07-21T21:43:52Z!gerd@gnu.org, but never used. + All callers changed. + 2011-03-27 Jan Djärv * nsterm.m (syms_of_nsterm): Use doc: for ns-auto-hide-menu-bar. diff --git a/src/dispextern.h b/src/dispextern.h index d1e0475dd15..17a9bc39fb2 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -2953,8 +2953,6 @@ extern int bidi_mirror_char (int); struct glyph_row *row_containing_pos (struct window *, EMACS_INT, struct glyph_row *, struct glyph_row *, int); -EMACS_INT string_buffer_position (struct window *, Lisp_Object, - EMACS_INT); int line_bottom_y (struct it *); int display_prop_intangible_p (Lisp_Object); void resize_echo_area_exactly (void); diff --git a/src/print.c b/src/print.c index 5b2778cf251..e44d4d14f36 100644 --- a/src/print.c +++ b/src/print.c @@ -273,7 +273,7 @@ printchar (unsigned int ch, Lisp_Object fun) static void strout (const char *ptr, EMACS_INT size, EMACS_INT size_byte, - Lisp_Object printcharfun, int multibyte) + Lisp_Object printcharfun) { if (size < 0) size_byte = size = strlen (ptr); @@ -406,16 +406,13 @@ print_string (Lisp_Object string, Lisp_Object printcharfun) SAFE_ALLOCA (buffer, char *, nbytes); memcpy (buffer, SDATA (string), nbytes); - strout (buffer, chars, SBYTES (string), - printcharfun, STRING_MULTIBYTE (string)); + strout (buffer, chars, SBYTES (string), printcharfun); SAFE_FREE (); } else /* No need to copy, since output to print_buffer can't GC. */ - strout (SSDATA (string), - chars, SBYTES (string), - printcharfun, STRING_MULTIBYTE (string)); + strout (SSDATA (string), chars, SBYTES (string), printcharfun); } else { @@ -472,7 +469,7 @@ write_string (const char *data, int size) printcharfun = Vstandard_output; PRINTPREPARE; - strout (data, size, size, printcharfun, 0); + strout (data, size, size, printcharfun); PRINTFINISH; } @@ -486,7 +483,7 @@ write_string_1 (const char *data, int size, Lisp_Object printcharfun) PRINTDECLARE; PRINTPREPARE; - strout (data, size, size, printcharfun, 0); + strout (data, size, size, printcharfun); PRINTFINISH; } @@ -1404,7 +1401,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag if (EQ (obj, being_printed[i])) { sprintf (buf, "#%d", i); - strout (buf, -1, -1, printcharfun, 0); + strout (buf, -1, -1, printcharfun); return; } being_printed[print_depth] = obj; @@ -1420,7 +1417,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag { /* Add a prefix #n= if OBJ has not yet been printed; that is, its status field is nil. */ sprintf (buf, "#%d=", -n); - strout (buf, -1, -1, printcharfun, 0); + strout (buf, -1, -1, printcharfun); /* OBJ is going to be printed. Remember that fact. */ Fputhash (obj, make_number (- n), Vprint_number_table); } @@ -1428,7 +1425,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag { /* Just print #n# if OBJ has already been printed. */ sprintf (buf, "#%d#", n); - strout (buf, -1, -1, printcharfun, 0); + strout (buf, -1, -1, printcharfun); return; } } @@ -1446,7 +1443,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag sprintf (buf, "%ld", (long) XINT (obj)); else abort (); - strout (buf, -1, -1, printcharfun, 0); + strout (buf, -1, -1, printcharfun); break; case Lisp_Float: @@ -1454,7 +1451,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag char pigbuf[FLOAT_TO_STRING_BUFSIZE]; float_to_string (pigbuf, XFLOAT_DATA (obj)); - strout (pigbuf, -1, -1, printcharfun, 0); + strout (pigbuf, -1, -1, printcharfun); } break; @@ -1532,7 +1529,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag sprintf (outbuf, "\\x%04x", c); need_nonhex = 1; } - strout (outbuf, -1, -1, printcharfun, 0); + strout (outbuf, -1, -1, printcharfun); } else if (! multibyte && SINGLE_BYTE_CHAR_P (c) && ! ASCII_BYTE_P (c) @@ -1544,7 +1541,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag using octal escapes. */ char outbuf[5]; sprintf (outbuf, "\\%03o", c); - strout (outbuf, -1, -1, printcharfun, 0); + strout (outbuf, -1, -1, printcharfun); } else { @@ -1557,7 +1554,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag if ((c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F') || (c >= '0' && c <= '9')) - strout ("\\ ", -1, -1, printcharfun, 0); + strout ("\\ ", -1, -1, printcharfun); } if (c == '\"' || c == '\\') @@ -1645,7 +1642,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag /* If deeper than spec'd depth, print placeholder. */ if (INTEGERP (Vprint_level) && print_depth > XINT (Vprint_level)) - strout ("...", -1, -1, printcharfun, 0); + strout ("...", -1, -1, printcharfun); else if (print_quoted && CONSP (XCDR (obj)) && NILP (XCDR (XCDR (obj))) && (EQ (XCAR (obj), Qquote))) { @@ -1705,7 +1702,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag if (i != 0 && EQ (obj, halftail)) { sprintf (buf, " . #%d", i / 2); - strout (buf, -1, -1, printcharfun, 0); + strout (buf, -1, -1, printcharfun); goto end_of_list; } } @@ -1717,7 +1714,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag Lisp_Object num = Fgethash (obj, Vprint_number_table, Qnil); if (INTEGERP (num)) { - strout (" . ", 3, 3, printcharfun, 0); + strout (" . ", 3, 3, printcharfun); print_object (obj, printcharfun, escapeflag); goto end_of_list; } @@ -1729,7 +1726,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag if (print_length && i > print_length) { - strout ("...", 3, 3, printcharfun, 0); + strout ("...", 3, 3, printcharfun); goto end_of_list; } @@ -1744,7 +1741,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag /* OBJ non-nil here means it's the end of a dotted list. */ if (!NILP (obj)) { - strout (" . ", 3, 3, printcharfun, 0); + strout (" . ", 3, 3, printcharfun); print_object (obj, printcharfun, escapeflag); } @@ -1758,7 +1755,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag { if (escapeflag) { - strout ("#name, printcharfun); PRINTCHAR ('>'); } @@ -1779,7 +1776,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag PRINTCHAR ('#'); PRINTCHAR ('&'); sprintf (buf, "%ld", (long) XBOOL_VECTOR (obj)->size); - strout (buf, -1, -1, printcharfun, 0); + strout (buf, -1, -1, printcharfun); PRINTCHAR ('\"'); /* Don't print more characters than the specified maximum. @@ -1824,18 +1821,18 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag } else if (SUBRP (obj)) { - strout ("#symbol_name, -1, -1, printcharfun, 0); + strout ("#symbol_name, -1, -1, printcharfun); PRINTCHAR ('>'); } else if (WINDOWP (obj)) { - strout ("#sequence_number)); - strout (buf, -1, -1, printcharfun, 0); + strout (buf, -1, -1, printcharfun); if (!NILP (XWINDOW (obj)->buffer)) { - strout (" on ", -1, -1, printcharfun, 0); + strout (" on ", -1, -1, printcharfun); print_string (BVAR (XBUFFER (XWINDOW (obj)->buffer), name), printcharfun); } PRINTCHAR ('>'); @@ -1843,13 +1840,13 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag else if (TERMINALP (obj)) { struct terminal *t = XTERMINAL (obj); - strout ("#id); - strout (buf, -1, -1, printcharfun, 0); + strout (buf, -1, -1, printcharfun); if (t->name) { - strout (" on ", -1, -1, printcharfun, 0); - strout (t->name, -1, -1, printcharfun, 0); + strout (" on ", -1, -1, printcharfun); + strout (t->name, -1, -1, printcharfun); } PRINTCHAR ('>'); } @@ -1859,21 +1856,21 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag int i; EMACS_INT real_size, size; #if 0 - strout ("#test)) { PRINTCHAR (' '); PRINTCHAR ('\''); - strout (SDATA (SYMBOL_NAME (h->test)), -1, -1, printcharfun, 0); + strout (SDATA (SYMBOL_NAME (h->test)), -1, -1, printcharfun); PRINTCHAR (' '); - strout (SDATA (SYMBOL_NAME (h->weak)), -1, -1, printcharfun, 0); + strout (SDATA (SYMBOL_NAME (h->weak)), -1, -1, printcharfun); PRINTCHAR (' '); sprintf (buf, "%ld/%ld", (long) h->count, (long) XVECTOR (h->next)->size); - strout (buf, -1, -1, printcharfun, 0); + strout (buf, -1, -1, printcharfun); } sprintf (buf, " 0x%lx", (unsigned long) h); - strout (buf, -1, -1, printcharfun, 0); + strout (buf, -1, -1, printcharfun); PRINTCHAR ('>'); #endif /* Implement a readable output, e.g.: @@ -1881,33 +1878,33 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag /* Always print the size. */ sprintf (buf, "#s(hash-table size %ld", (long) XVECTOR (h->next)->size); - strout (buf, -1, -1, printcharfun, 0); + strout (buf, -1, -1, printcharfun); if (!NILP (h->test)) { - strout (" test ", -1, -1, printcharfun, 0); + strout (" test ", -1, -1, printcharfun); print_object (h->test, printcharfun, escapeflag); } if (!NILP (h->weak)) { - strout (" weakness ", -1, -1, printcharfun, 0); + strout (" weakness ", -1, -1, printcharfun); print_object (h->weak, printcharfun, escapeflag); } if (!NILP (h->rehash_size)) { - strout (" rehash-size ", -1, -1, printcharfun, 0); + strout (" rehash-size ", -1, -1, printcharfun); print_object (h->rehash_size, printcharfun, escapeflag); } if (!NILP (h->rehash_threshold)) { - strout (" rehash-threshold ", -1, -1, printcharfun, 0); + strout (" rehash-threshold ", -1, -1, printcharfun); print_object (h->rehash_threshold, printcharfun, escapeflag); } - strout (" data ", -1, -1, printcharfun, 0); + strout (" data ", -1, -1, printcharfun); /* Print the data here as a plist. */ real_size = HASH_TABLE_SIZE (h); @@ -1929,7 +1926,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag } if (size < real_size) - strout (" ...", 4, 4, printcharfun, 0); + strout (" ...", 4, 4, printcharfun); PRINTCHAR (')'); PRINTCHAR (')'); @@ -1938,10 +1935,10 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag else if (BUFFERP (obj)) { if (NILP (BVAR (XBUFFER (obj), name))) - strout ("#", -1, -1, printcharfun, 0); + strout ("#", -1, -1, printcharfun); else if (escapeflag) { - strout ("#'); } @@ -1950,16 +1947,16 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag } else if (WINDOW_CONFIGURATIONP (obj)) { - strout ("#", -1, -1, printcharfun, 0); + strout ("#", -1, -1, printcharfun); } else if (FRAMEP (obj)) { strout ((FRAME_LIVE_P (XFRAME (obj)) ? "#name, printcharfun); sprintf (buf, " 0x%lx", (unsigned long) (XFRAME (obj))); - strout (buf, -1, -1, printcharfun, 0); + strout (buf, -1, -1, printcharfun); PRINTCHAR ('>'); } else if (FONTP (obj)) @@ -1969,9 +1966,9 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag if (! FONT_OBJECT_P (obj)) { if (FONT_SPEC_P (obj)) - strout ("#insertion_type != 0) - strout ("(moves after insertion) ", -1, -1, printcharfun, 0); + strout ("(moves after insertion) ", -1, -1, printcharfun); if (! XMARKER (obj)->buffer) - strout ("in no buffer", -1, -1, printcharfun, 0); + strout ("in no buffer", -1, -1, printcharfun); else { sprintf (buf, "at %ld", (long)marker_position (obj)); - strout (buf, -1, -1, printcharfun, 0); - strout (" in ", -1, -1, printcharfun, 0); + strout (buf, -1, -1, printcharfun); + strout (" in ", -1, -1, printcharfun); print_string (BVAR (XMARKER (obj)->buffer, name), printcharfun); } PRINTCHAR ('>'); break; case Lisp_Misc_Overlay: - strout ("#buffer) - strout ("in no buffer", -1, -1, printcharfun, 0); + strout ("in no buffer", -1, -1, printcharfun); else { sprintf (buf, "from %ld to %ld in ", (long)marker_position (OVERLAY_START (obj)), (long)marker_position (OVERLAY_END (obj))); - strout (buf, -1, -1, printcharfun, 0); + strout (buf, -1, -1, printcharfun); print_string (BVAR (XMARKER (OVERLAY_START (obj))->buffer, name), printcharfun); } @@ -2082,15 +2079,15 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag /* Remaining cases shouldn't happen in normal usage, but let's print them anyway for the benefit of the debugger. */ case Lisp_Misc_Free: - strout ("#", -1, -1, printcharfun, 0); + strout ("#", -1, -1, printcharfun); break; case Lisp_Misc_Save_Value: - strout ("#pointer, XSAVE_VALUE (obj)->integer); - strout (buf, -1, -1, printcharfun, 0); + strout (buf, -1, -1, printcharfun); PRINTCHAR ('>'); break; @@ -2104,16 +2101,16 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag { /* We're in trouble if this happens! Probably should just abort () */ - strout ("#size); else sprintf (buf, "(0x%02x)", (int) XTYPE (obj)); - strout (buf, -1, -1, printcharfun, 0); + strout (buf, -1, -1, printcharfun); strout (" Save your buffers immediately and please report this bug>", - -1, -1, printcharfun, 0); + -1, -1, printcharfun); } } diff --git a/src/search.c b/src/search.c index bf93a7fe442..59a530eff61 100644 --- a/src/search.c +++ b/src/search.c @@ -95,10 +95,9 @@ static void save_search_regs (void); static EMACS_INT simple_search (EMACS_INT, unsigned char *, EMACS_INT, EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT); -static EMACS_INT boyer_moore (EMACS_INT, unsigned char *, EMACS_INT, EMACS_INT, - Lisp_Object, Lisp_Object, - EMACS_INT, EMACS_INT, - EMACS_INT, EMACS_INT, int); +static EMACS_INT boyer_moore (EMACS_INT, unsigned char *, EMACS_INT, + Lisp_Object, Lisp_Object, EMACS_INT, + EMACS_INT, int); static EMACS_INT search_buffer (Lisp_Object, EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT, int, Lisp_Object, Lisp_Object, int); @@ -1416,15 +1415,14 @@ search_buffer (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte, } len_byte = pat - patbuf; - len = raw_pattern_size; pat = base_pat = patbuf; if (boyer_moore_ok) - return boyer_moore (n, pat, len, len_byte, trt, inverse_trt, - pos, pos_byte, lim, lim_byte, + return boyer_moore (n, pat, len_byte, trt, inverse_trt, + pos_byte, lim_byte, char_base); else - return simple_search (n, pat, len, len_byte, trt, + return simple_search (n, pat, raw_pattern_size, len_byte, trt, pos, pos_byte, lim, lim_byte); } } @@ -1636,8 +1634,8 @@ simple_search (EMACS_INT n, unsigned char *pat, } /* Do Boyer-Moore search N times for the string BASE_PAT, - whose length is LEN/LEN_BYTE, - from buffer position POS/POS_BYTE until LIM/LIM_BYTE. + whose length is LEN_BYTE, + from buffer position POS_BYTE until LIM_BYTE. DIRECTION says which direction we search in. TRT and INVERSE_TRT are translation tables. Characters in PAT are already translated by TRT. @@ -1652,10 +1650,10 @@ simple_search (EMACS_INT n, unsigned char *pat, static EMACS_INT boyer_moore (EMACS_INT n, unsigned char *base_pat, - EMACS_INT len, EMACS_INT len_byte, + EMACS_INT len_byte, Lisp_Object trt, Lisp_Object inverse_trt, - EMACS_INT pos, EMACS_INT pos_byte, - EMACS_INT lim, EMACS_INT lim_byte, int char_base) + EMACS_INT pos_byte, EMACS_INT lim_byte, + int char_base) { int direction = ((n > 0) ? 1 : -1); register EMACS_INT dirlen; @@ -1776,8 +1774,8 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat, stride_for_teases = BM_tab[j]; BM_tab[j] = dirlen - i; - /* A translation table is accompanied by its inverse -- see */ - /* comment following downcase_table for details */ + /* A translation table is accompanied by its inverse -- see + comment following downcase_table for details. */ if (ch >= 0) { int starting_ch = ch; diff --git a/src/w32.c b/src/w32.c index 5643b3f073e..495f878d3a8 100644 --- a/src/w32.c +++ b/src/w32.c @@ -4517,75 +4517,75 @@ struct { int errnum; char * msg; } _wsa_errlist[] = { - WSAEINTR , "Interrupted function call", - WSAEBADF , "Bad file descriptor", - WSAEACCES , "Permission denied", - WSAEFAULT , "Bad address", - WSAEINVAL , "Invalid argument", - WSAEMFILE , "Too many open files", - - WSAEWOULDBLOCK , "Resource temporarily unavailable", - WSAEINPROGRESS , "Operation now in progress", - WSAEALREADY , "Operation already in progress", - WSAENOTSOCK , "Socket operation on non-socket", - WSAEDESTADDRREQ , "Destination address required", - WSAEMSGSIZE , "Message too long", - WSAEPROTOTYPE , "Protocol wrong type for socket", - WSAENOPROTOOPT , "Bad protocol option", - WSAEPROTONOSUPPORT , "Protocol not supported", - WSAESOCKTNOSUPPORT , "Socket type not supported", - WSAEOPNOTSUPP , "Operation not supported", - WSAEPFNOSUPPORT , "Protocol family not supported", - WSAEAFNOSUPPORT , "Address family not supported by protocol family", - WSAEADDRINUSE , "Address already in use", - WSAEADDRNOTAVAIL , "Cannot assign requested address", - WSAENETDOWN , "Network is down", - WSAENETUNREACH , "Network is unreachable", - WSAENETRESET , "Network dropped connection on reset", - WSAECONNABORTED , "Software caused connection abort", - WSAECONNRESET , "Connection reset by peer", - WSAENOBUFS , "No buffer space available", - WSAEISCONN , "Socket is already connected", - WSAENOTCONN , "Socket is not connected", - WSAESHUTDOWN , "Cannot send after socket shutdown", - WSAETOOMANYREFS , "Too many references", /* not sure */ - WSAETIMEDOUT , "Connection timed out", - WSAECONNREFUSED , "Connection refused", - WSAELOOP , "Network loop", /* not sure */ - WSAENAMETOOLONG , "Name is too long", - WSAEHOSTDOWN , "Host is down", - WSAEHOSTUNREACH , "No route to host", - WSAENOTEMPTY , "Buffer not empty", /* not sure */ - WSAEPROCLIM , "Too many processes", - WSAEUSERS , "Too many users", /* not sure */ - WSAEDQUOT , "Double quote in host name", /* really not sure */ - WSAESTALE , "Data is stale", /* not sure */ - WSAEREMOTE , "Remote error", /* not sure */ - - WSASYSNOTREADY , "Network subsystem is unavailable", - WSAVERNOTSUPPORTED , "WINSOCK.DLL version out of range", - WSANOTINITIALISED , "Winsock not initialized successfully", - WSAEDISCON , "Graceful shutdown in progress", + {WSAEINTR , "Interrupted function call"}, + {WSAEBADF , "Bad file descriptor"}, + {WSAEACCES , "Permission denied"}, + {WSAEFAULT , "Bad address"}, + {WSAEINVAL , "Invalid argument"}, + {WSAEMFILE , "Too many open files"}, + + {WSAEWOULDBLOCK , "Resource temporarily unavailable"}, + {WSAEINPROGRESS , "Operation now in progress"}, + {WSAEALREADY , "Operation already in progress"}, + {WSAENOTSOCK , "Socket operation on non-socket"}, + {WSAEDESTADDRREQ , "Destination address required"}, + {WSAEMSGSIZE , "Message too long"}, + {WSAEPROTOTYPE , "Protocol wrong type for socket"}, + {WSAENOPROTOOPT , "Bad protocol option"}, + {WSAEPROTONOSUPPORT , "Protocol not supported"}, + {WSAESOCKTNOSUPPORT , "Socket type not supported"}, + {WSAEOPNOTSUPP , "Operation not supported"}, + {WSAEPFNOSUPPORT , "Protocol family not supported"}, + {WSAEAFNOSUPPORT , "Address family not supported by protocol family"}, + {WSAEADDRINUSE , "Address already in use"}, + {WSAEADDRNOTAVAIL , "Cannot assign requested address"}, + {WSAENETDOWN , "Network is down"}, + {WSAENETUNREACH , "Network is unreachable"}, + {WSAENETRESET , "Network dropped connection on reset"}, + {WSAECONNABORTED , "Software caused connection abort"}, + {WSAECONNRESET , "Connection reset by peer"}, + {WSAENOBUFS , "No buffer space available"}, + {WSAEISCONN , "Socket is already connected"}, + {WSAENOTCONN , "Socket is not connected"}, + {WSAESHUTDOWN , "Cannot send after socket shutdown"}, + {WSAETOOMANYREFS , "Too many references"}, /* not sure */ + {WSAETIMEDOUT , "Connection timed out"}, + {WSAECONNREFUSED , "Connection refused"}, + {WSAELOOP , "Network loop"}, /* not sure */ + {WSAENAMETOOLONG , "Name is too long"}, + {WSAEHOSTDOWN , "Host is down"}, + {WSAEHOSTUNREACH , "No route to host"}, + {WSAENOTEMPTY , "Buffer not empty"}, /* not sure */ + {WSAEPROCLIM , "Too many processes"}, + {WSAEUSERS , "Too many users"}, /* not sure */ + {WSAEDQUOT , "Double quote in host name"}, /* really not sure */ + {WSAESTALE , "Data is stale"}, /* not sure */ + {WSAEREMOTE , "Remote error"}, /* not sure */ + + {WSASYSNOTREADY , "Network subsystem is unavailable"}, + {WSAVERNOTSUPPORTED , "WINSOCK.DLL version out of range"}, + {WSANOTINITIALISED , "Winsock not initialized successfully"}, + {WSAEDISCON , "Graceful shutdown in progress"}, #ifdef WSAENOMORE - WSAENOMORE , "No more operations allowed", /* not sure */ - WSAECANCELLED , "Operation cancelled", /* not sure */ - WSAEINVALIDPROCTABLE , "Invalid procedure table from service provider", - WSAEINVALIDPROVIDER , "Invalid service provider version number", - WSAEPROVIDERFAILEDINIT , "Unable to initialize a service provider", - WSASYSCALLFAILURE , "System call failure", - WSASERVICE_NOT_FOUND , "Service not found", /* not sure */ - WSATYPE_NOT_FOUND , "Class type not found", - WSA_E_NO_MORE , "No more resources available", /* really not sure */ - WSA_E_CANCELLED , "Operation already cancelled", /* really not sure */ - WSAEREFUSED , "Operation refused", /* not sure */ + {WSAENOMORE , "No more operations allowed"}, /* not sure */ + {WSAECANCELLED , "Operation cancelled"}, /* not sure */ + {WSAEINVALIDPROCTABLE , "Invalid procedure table from service provider"}, + {WSAEINVALIDPROVIDER , "Invalid service provider version number"}, + {WSAEPROVIDERFAILEDINIT , "Unable to initialize a service provider"}, + {WSASYSCALLFAILURE , "System call failure"}, + {WSASERVICE_NOT_FOUND , "Service not found"}, /* not sure */ + {WSATYPE_NOT_FOUND , "Class type not found"}, + {WSA_E_NO_MORE , "No more resources available"}, /* really not sure */ + {WSA_E_CANCELLED , "Operation already cancelled"}, /* really not sure */ + {WSAEREFUSED , "Operation refused"}, /* not sure */ #endif - WSAHOST_NOT_FOUND , "Host not found", - WSATRY_AGAIN , "Authoritative host not found during name lookup", - WSANO_RECOVERY , "Non-recoverable error during name lookup", - WSANO_DATA , "Valid name, no data record of requested type", + {WSAHOST_NOT_FOUND , "Host not found"}, + {WSATRY_AGAIN , "Authoritative host not found during name lookup"}, + {WSANO_RECOVERY , "Non-recoverable error during name lookup"}, + {WSANO_DATA , "Valid name, no data record of requested type"}, - -1, NULL + {-1, NULL} }; char * diff --git a/src/xdisp.c b/src/xdisp.c index 6f9f56df979..148c7bc5ec6 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -754,7 +754,7 @@ static void setup_for_ellipsis (struct it *, int); static void mark_window_display_accurate_1 (struct window *, int); static int single_display_spec_string_p (Lisp_Object, Lisp_Object); static int display_prop_string_p (Lisp_Object, Lisp_Object); -static int cursor_row_p (struct window *, struct glyph_row *); +static int cursor_row_p (struct glyph_row *); static int redisplay_mode_lines (Lisp_Object, int); static char *decode_mode_spec_coding (Lisp_Object, char *, int); @@ -823,8 +823,7 @@ static int display_mode_lines (struct window *); static int display_mode_line (struct window *, enum face_id, Lisp_Object); static int display_mode_element (struct it *, int, int, int, Lisp_Object, Lisp_Object, int); static int store_mode_line_string (const char *, Lisp_Object, int, int, int, Lisp_Object); -static const char *decode_mode_spec (struct window *, int, int, int, - Lisp_Object *); +static const char *decode_mode_spec (struct window *, int, int, Lisp_Object *); static void display_menu_bar (struct window *); static int display_count_lines (EMACS_INT, EMACS_INT, EMACS_INT, int, EMACS_INT *); @@ -4420,20 +4419,18 @@ display_prop_string_p (Lisp_Object prop, Lisp_Object string) return 0; } -/* Look for STRING in overlays and text properties in W's buffer, - between character positions FROM and TO (excluding TO). +/* Look for STRING in overlays and text properties in the current + buffer, between character positions FROM and TO (excluding TO). BACK_P non-zero means look back (in this case, TO is supposed to be less than FROM). Value is the first character position where STRING was found, or zero if it wasn't found before hitting TO. - W's buffer must be current. - This function may only use code that doesn't eval because it is called asynchronously from note_mouse_highlight. */ static EMACS_INT -string_buffer_position_lim (struct window *w, Lisp_Object string, +string_buffer_position_lim (Lisp_Object string, EMACS_INT from, EMACS_INT to, int back_p) { Lisp_Object limit, prop, pos; @@ -4471,27 +4468,25 @@ string_buffer_position_lim (struct window *w, Lisp_Object string, return found ? XINT (pos) : 0; } -/* Determine which buffer position in W's buffer STRING comes from. +/* Determine which buffer position in current buffer STRING comes from. AROUND_CHARPOS is an approximate position where it could come from. Value is the buffer position or 0 if it couldn't be determined. - W's buffer must be current. - This function is necessary because we don't record buffer positions in glyphs generated from strings (to keep struct glyph small). This function may only use code that doesn't eval because it is called asynchronously from note_mouse_highlight. */ -EMACS_INT -string_buffer_position (struct window *w, Lisp_Object string, EMACS_INT around_charpos) +static EMACS_INT +string_buffer_position (Lisp_Object string, EMACS_INT around_charpos) { const int MAX_DISTANCE = 1000; - EMACS_INT found = string_buffer_position_lim (w, string, around_charpos, + EMACS_INT found = string_buffer_position_lim (string, around_charpos, around_charpos + MAX_DISTANCE, 0); if (!found) - found = string_buffer_position_lim (w, string, around_charpos, + found = string_buffer_position_lim (string, around_charpos, around_charpos - MAX_DISTANCE, 1); return found; } @@ -12731,7 +12726,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, EMACS_INT tem; str = glyph->object; - tem = string_buffer_position_lim (w, str, pos, pos_after, 0); + tem = string_buffer_position_lim (str, pos, pos_after, 0); if (tem == 0 /* from overlay */ || pos <= tem) { @@ -13457,7 +13452,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste && row < w->current_matrix->rows + w->current_matrix->nrows - 1 && MATRIX_ROW_START_CHARPOS (row+1) == PT - && !cursor_row_p (w, row)) + && !cursor_row_p (row)) ++row; /* If within the scroll margin, scroll. Note that @@ -13509,7 +13504,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste skip forward over overlay strings. */ while (MATRIX_ROW_BOTTOM_Y (row) < last_y && MATRIX_ROW_END_CHARPOS (row) == PT - && !cursor_row_p (w, row)) + && !cursor_row_p (row)) ++row; /* If within the scroll margin, scroll. */ @@ -13605,7 +13600,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste { if (MATRIX_ROW_START_CHARPOS (row) <= PT && PT <= MATRIX_ROW_END_CHARPOS (row) - && cursor_row_p (w, row)) + && cursor_row_p (row)) rv |= set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0); /* As soon as we've found the first suitable row @@ -13644,7 +13639,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste } while (MATRIX_ROW_BOTTOM_Y (row) < last_y && MATRIX_ROW_START_CHARPOS (row) == PT - && cursor_row_p (w, row)); + && cursor_row_p (row)); } } } @@ -16971,11 +16966,11 @@ highlight_trailing_whitespace (struct frame *f, struct glyph_row *row) } -/* Value is non-zero if glyph row ROW in window W should be +/* Value is non-zero if glyph row ROW should be used to hold the cursor. */ static int -cursor_row_p (struct window *w, struct glyph_row *row) +cursor_row_p (struct glyph_row *row) { int result = 1; @@ -17888,7 +17883,7 @@ display_line (struct it *it) && !MATRIX_ROW (it->w->desired_matrix, cvpos)->ends_at_zv_p)) && PT >= MATRIX_ROW_START_CHARPOS (row) && PT <= MATRIX_ROW_END_CHARPOS (row) - && cursor_row_p (it->w, row)) + && cursor_row_p (row)) set_cursor_from_row (it->w, row, it->w->desired_matrix, 0, 0, 0, 0); /* Highlight trailing whitespace. */ @@ -18540,7 +18535,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision, charpos = (STRING_MULTIBYTE (elt) ? string_byte_to_char (elt, bytepos) : bytepos); - spec = decode_mode_spec (it->w, c, field, prec, &string); + spec = decode_mode_spec (it->w, c, field, &string); multibyte = STRINGP (string) && STRING_MULTIBYTE (string); switch (mode_line_target) @@ -19211,9 +19206,8 @@ decode_mode_spec_coding (Lisp_Object coding_system, register char *buf, int eol_ } /* Return a string for the output of a mode line %-spec for window W, - generated by character C. PRECISION >= 0 means don't return a - string longer than that value. FIELD_WIDTH > 0 means pad the - string returned with spaces to that value. Return a Lisp string in + generated by character C. FIELD_WIDTH > 0 means pad the string + returned with spaces to that value. Return a Lisp string in *STRING if the resulting string is taken from that Lisp string. Note we operate on the current buffer for most purposes, @@ -19223,7 +19217,7 @@ static char lots_of_dashes[] = "------------------------------------------------ static const char * decode_mode_spec (struct window *w, register int c, int field_width, - int precision, Lisp_Object *string) + Lisp_Object *string) { Lisp_Object obj; struct frame *f = XFRAME (WINDOW_FRAME (w)); @@ -24324,7 +24318,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, END_CHARPOS, or if they come from an overlay. */ if (EQ (glyph->object, before_string)) { - pos = string_buffer_position (w, before_string, + pos = string_buffer_position (before_string, start_charpos); /* If pos == 0, it means before_string came from an overlay, not from a buffer position. */ @@ -24333,7 +24327,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, } else if (EQ (glyph->object, after_string)) { - pos = string_buffer_position (w, after_string, end_charpos); + pos = string_buffer_position (after_string, end_charpos); if (!pos || (pos >= start_charpos && pos < end_charpos)) break; } @@ -24375,7 +24369,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, END_CHARPOS, or if they come from an overlay. */ if (EQ (glyph->object, before_string)) { - pos = string_buffer_position (w, before_string, start_charpos); + pos = string_buffer_position (before_string, start_charpos); /* If pos == 0, it means before_string came from an overlay, not from a buffer position. */ if (!pos || (pos >= start_charpos && pos < end_charpos)) @@ -24383,7 +24377,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, } else if (EQ (glyph->object, after_string)) { - pos = string_buffer_position (w, after_string, end_charpos); + pos = string_buffer_position (after_string, end_charpos); if (!pos || (pos >= start_charpos && pos < end_charpos)) break; } @@ -24441,13 +24435,13 @@ mouse_face_from_buffer_pos (Lisp_Object window, END_CHARPOS, or if they come from an overlay. */ if (EQ (end->object, before_string)) { - pos = string_buffer_position (w, before_string, start_charpos); + pos = string_buffer_position (before_string, start_charpos); if (!pos || (pos >= start_charpos && pos < end_charpos)) break; } else if (EQ (end->object, after_string)) { - pos = string_buffer_position (w, after_string, end_charpos); + pos = string_buffer_position (after_string, end_charpos); if (!pos || (pos >= start_charpos && pos < end_charpos)) break; } @@ -24491,13 +24485,13 @@ mouse_face_from_buffer_pos (Lisp_Object window, END_CHARPOS, or if they come from an overlay. */ if (EQ (end->object, before_string)) { - pos = string_buffer_position (w, before_string, start_charpos); + pos = string_buffer_position (before_string, start_charpos); if (!pos || (pos >= start_charpos && pos < end_charpos)) break; } else if (EQ (end->object, after_string)) { - pos = string_buffer_position (w, after_string, end_charpos); + pos = string_buffer_position (after_string, end_charpos); if (!pos || (pos >= start_charpos && pos < end_charpos)) break; } @@ -25481,7 +25475,7 @@ note_mouse_highlight (struct frame *f, int x, int y) check if the text under it has one. */ struct glyph_row *r = MATRIX_ROW (w->current_matrix, vpos); EMACS_INT start = MATRIX_ROW_START_CHARPOS (r); - pos = string_buffer_position (w, object, start); + pos = string_buffer_position (object, start); if (pos > 0) { mouse_face = get_char_property_and_overlay @@ -25591,7 +25585,7 @@ note_mouse_highlight (struct frame *f, int x, int y) struct glyph_row *r = MATRIX_ROW (w->current_matrix, vpos); EMACS_INT start = MATRIX_ROW_START_CHARPOS (r); - EMACS_INT p = string_buffer_position (w, obj, start); + EMACS_INT p = string_buffer_position (obj, start); if (p > 0) { help = Fget_char_property (make_number (p), @@ -25647,7 +25641,7 @@ note_mouse_highlight (struct frame *f, int x, int y) struct glyph_row *r = MATRIX_ROW (w->current_matrix, vpos); EMACS_INT start = MATRIX_ROW_START_CHARPOS (r); - EMACS_INT p = string_buffer_position (w, obj, start); + EMACS_INT p = string_buffer_position (obj, start); if (p > 0) pointer = Fget_char_property (make_number (p), Qpointer, w->buffer); -- cgit v1.2.1 From f6d6298639ae43539581c2079666d76a54f1557e Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 28 Mar 2011 16:26:35 -0400 Subject: Don't reset post-command-hook to nil upon error. * src/eval.c (enum run_hooks_condition): Remove. (funcall_nil, funcall_not): New functions. (run_hook_with_args): Call each function through a `funcall' argument. Remove `cond' argument, now redundant. (Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success) (Frun_hook_with_args_until_failure): Adjust accordingly. (run_hook_wrapped_funcall, Frun_hook_wrapped): New functions. * src/keyboard.c (safe_run_hook_funcall): New function. (safe_run_hooks_1, safe_run_hooks_error, safe_run_hooks): On error, don't set the hook to nil, but remove the offending function instead. (Qcommand_hook_internal): Remove, unused. (syms_of_keyboard): Don't initialize Qcommand_hook_internal nor define Vcommand_hook_internal. * doc/lispref/commands.texi (Command Overview): post-command-hook is not reset to nil any more. --- src/ChangeLog | 17 +++++++ src/eval.c | 155 ++++++++++++++++++++++++++++++++++----------------------- src/keyboard.c | 82 ++++++++++++++++++++++-------- src/lisp.h | 7 ++- 4 files changed, 174 insertions(+), 87 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 75b75ab522c..be55ef369b3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,20 @@ +2011-03-28 Stefan Monnier + + * keyboard.c (safe_run_hook_funcall): New function. + (safe_run_hooks_1, safe_run_hooks_error, safe_run_hooks): On error, + don't set the hook to nil, but remove the offending function instead. + (Qcommand_hook_internal): Remove, unused. + (syms_of_keyboard): Don't initialize Qcommand_hook_internal nor define + Vcommand_hook_internal. + + * eval.c (enum run_hooks_condition): Remove. + (funcall_nil, funcall_not): New functions. + (run_hook_with_args): Call each function through a `funcall' argument. + Remove `cond' argument, now redundant. + (Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success) + (Frun_hook_with_args_until_failure): Adjust accordingly. + (run_hook_wrapped_funcall, Frun_hook_wrapped): New functions. + 2011-03-28 Juanma Barranquero * dispextern.h (string_buffer_position): Remove declaration. diff --git a/src/eval.c b/src/eval.c index f68274e6e8c..75874367f2c 100644 --- a/src/eval.c +++ b/src/eval.c @@ -30,19 +30,19 @@ along with GNU Emacs. If not, see . */ #include "xterm.h" #endif -/* This definition is duplicated in alloc.c and keyboard.c */ -/* Putting it in lisp.h makes cc bomb out! */ +/* This definition is duplicated in alloc.c and keyboard.c. */ +/* Putting it in lisp.h makes cc bomb out! */ struct backtrace { struct backtrace *next; Lisp_Object *function; - Lisp_Object *args; /* Points to vector of args. */ + Lisp_Object *args; /* Points to vector of args. */ int nargs; /* Length of vector. If nargs is UNEVALLED, args points to slot holding - list of unevalled args */ + list of unevalled args. */ char evalargs; - /* Nonzero means call value of debugger when done with this operation. */ + /* Nonzero means call value of debugger when done with this operation. */ char debug_on_exit; }; @@ -146,7 +146,7 @@ init_eval (void) when_entered_debugger = -1; } -/* unwind-protect function used by call_debugger. */ +/* Unwind-protect function used by call_debugger. */ static Lisp_Object restore_stack_limits (Lisp_Object data) @@ -556,7 +556,7 @@ interactive_p (int exclude_subrs_p) || btp->nargs == UNEVALLED)) btp = btp->next; - /* btp now points at the frame of the innermost function that isn't + /* `btp' now points at the frame of the innermost function that isn't a special form, ignoring frames for Finteractive_p and/or Fbytecode at the top. If this frame is for a built-in function (such as load or eval-region) return nil. */ @@ -564,7 +564,7 @@ interactive_p (int exclude_subrs_p) if (exclude_subrs_p && SUBRP (fun)) return 0; - /* btp points to the frame of a Lisp function that called interactive-p. + /* `btp' points to the frame of a Lisp function that called interactive-p. Return t if that function was called interactively. */ if (btp && btp->next && EQ (*btp->next->function, Qcall_interactively)) return 1; @@ -965,11 +965,11 @@ usage: (let VARLIST BODY...) */) varlist = Fcar (args); - /* Make space to hold the values to give the bound variables */ + /* Make space to hold the values to give the bound variables. */ elt = Flength (varlist); SAFE_ALLOCA_LISP (temps, XFASTINT (elt)); - /* Compute the values and store them in `temps' */ + /* Compute the values and store them in `temps'. */ GCPRO2 (args, *temps); gcpro2.nvars = 0; @@ -1072,7 +1072,7 @@ definitions to shadow the loaded ones for use in file byte-compilation. */) /* SYM is not mentioned in ENVIRONMENT. Look at its function definition. */ if (EQ (def, Qunbound) || !CONSP (def)) - /* Not defined or definition not suitable */ + /* Not defined or definition not suitable. */ break; if (EQ (XCAR (def), Qautoload)) { @@ -1213,10 +1213,7 @@ unwind_to_catch (struct catchtag *catch, Lisp_Object value) byte_stack_list = catch->byte_stack; gcprolist = catch->gcpro; #ifdef DEBUG_GCPRO - if (gcprolist != 0) - gcpro_level = gcprolist->level + 1; - else - gcpro_level = 0; + gcpro_level = gcprolist ? gcprolist->level + 1 : gcpro_level = 0; #endif backtrace_list = catch->backlist; lisp_eval_depth = catch->lisp_eval_depth; @@ -1824,7 +1821,7 @@ maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, Lisp_Object data) ? debug_on_quit : wants_debugger (Vdebug_on_error, conditions)) && ! skip_debugger (conditions, combined_data) - /* rms: what's this for? */ + /* RMS: What's this for? */ && when_entered_debugger < num_nonmacro_input_events) { call_debugger (Fcons (Qerror, Fcons (combined_data, Qnil))); @@ -1891,7 +1888,7 @@ find_handler_clause (Lisp_Object handlers, Lisp_Object conditions, } -/* dump an error message; called like vprintf */ +/* Dump an error message; called like vprintf. */ void verror (const char *m, va_list ap) { @@ -1928,7 +1925,7 @@ verror (const char *m, va_list ap) } -/* dump an error message; called like printf */ +/* Dump an error message; called like printf. */ /* VARARGS 1 */ void @@ -2024,7 +2021,7 @@ this does nothing and returns nil. */) CHECK_SYMBOL (function); CHECK_STRING (file); - /* If function is defined and not as an autoload, don't override */ + /* If function is defined and not as an autoload, don't override. */ if (!EQ (XSYMBOL (function)->function, Qunbound) && !(CONSP (XSYMBOL (function)->function) && EQ (XCAR (XSYMBOL (function)->function), Qautoload))) @@ -2159,7 +2156,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, backtrace.next = backtrace_list; backtrace_list = &backtrace; - backtrace.function = &original_fun; /* This also protects them from gc */ + backtrace.function = &original_fun; /* This also protects them from gc. */ backtrace.args = &original_args; backtrace.nargs = UNEVALLED; backtrace.evalargs = 1; @@ -2169,7 +2166,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, do_debug_on_call (Qt); /* At this point, only original_fun and original_args - have values that will be used below */ + have values that will be used below. */ retry: /* Optimize for no indirection. */ @@ -2190,8 +2187,9 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, CHECK_CONS_LIST (); - if (XINT (numargs) < XSUBR (fun)->min_args || - (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < XINT (numargs))) + if (XINT (numargs) < XSUBR (fun)->min_args + || (XSUBR (fun)->max_args >= 0 + && XSUBR (fun)->max_args < XINT (numargs))) xsignal2 (Qwrong_number_of_arguments, original_fun, numargs); else if (XSUBR (fun)->max_args == UNEVALLED) @@ -2201,7 +2199,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, } else if (XSUBR (fun)->max_args == MANY) { - /* Pass a vector of evaluated arguments */ + /* Pass a vector of evaluated arguments. */ Lisp_Object *vals; register int argnum = 0; USE_SAFE_ALLOCA; @@ -2364,7 +2362,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) fun = indirect_function (fun); if (EQ (fun, Qunbound)) { - /* Let funcall get the error */ + /* Let funcall get the error. */ fun = args[0]; goto funcall; } @@ -2373,11 +2371,11 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) { if (numargs < XSUBR (fun)->min_args || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs)) - goto funcall; /* Let funcall get the error */ + goto funcall; /* Let funcall get the error. */ else if (XSUBR (fun)->max_args > numargs) { /* Avoid making funcall cons up a yet another new vector of arguments - by explicitly supplying nil's for optional values */ + by explicitly supplying nil's for optional values. */ SAFE_ALLOCA_LISP (funcall_args, 1 + XSUBR (fun)->max_args); for (i = numargs; i < XSUBR (fun)->max_args;) funcall_args[++i] = Qnil; @@ -2415,9 +2413,16 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) /* Run hook variables in various ways. */ -enum run_hooks_condition {to_completion, until_success, until_failure}; -static Lisp_Object run_hook_with_args (int, Lisp_Object *, - enum run_hooks_condition); +Lisp_Object run_hook_with_args (int, Lisp_Object *, + Lisp_Object (*funcall) + (int nargs, Lisp_Object *args)); + +static Lisp_Object +funcall_nil (int nargs, Lisp_Object *args) +{ + Ffuncall (nargs, args); + return Qnil; +} DEFUN ("run-hooks", Frun_hooks, Srun_hooks, 0, MANY, 0, doc: /* Run each hook in HOOKS. @@ -2442,7 +2447,7 @@ usage: (run-hooks &rest HOOKS) */) for (i = 0; i < nargs; i++) { hook[0] = args[i]; - run_hook_with_args (1, hook, to_completion); + run_hook_with_args (1, hook, funcall_nil); } return Qnil; @@ -2465,7 +2470,7 @@ Instead, use `add-hook' and specify t for the LOCAL argument. usage: (run-hook-with-args HOOK &rest ARGS) */) (int nargs, Lisp_Object *args) { - return run_hook_with_args (nargs, args, to_completion); + return run_hook_with_args (nargs, args, funcall_nil); } DEFUN ("run-hook-with-args-until-success", Frun_hook_with_args_until_success, @@ -2485,7 +2490,13 @@ Instead, use `add-hook' and specify t for the LOCAL argument. usage: (run-hook-with-args-until-success HOOK &rest ARGS) */) (int nargs, Lisp_Object *args) { - return run_hook_with_args (nargs, args, until_success); + return run_hook_with_args (nargs, args, Ffuncall); +} + +static Lisp_Object +funcall_not (int nargs, Lisp_Object *args) +{ + return NILP (Ffuncall (nargs, args)) ? Qt : Qnil; } DEFUN ("run-hook-with-args-until-failure", Frun_hook_with_args_until_failure, @@ -2504,21 +2515,45 @@ Instead, use `add-hook' and specify t for the LOCAL argument. usage: (run-hook-with-args-until-failure HOOK &rest ARGS) */) (int nargs, Lisp_Object *args) { - return run_hook_with_args (nargs, args, until_failure); + return NILP (run_hook_with_args (nargs, args, funcall_not)) ? Qt : Qnil; } +static Lisp_Object +run_hook_wrapped_funcall (int nargs, Lisp_Object *args) +{ + Lisp_Object tmp = args[0], ret; + args[0] = args[1]; + args[1] = tmp; + ret = Ffuncall (nargs, args); + args[1] = args[0]; + args[0] = tmp; + return ret; +} + +DEFUN ("run-hook-wrapped", Frun_hook_wrapped, Srun_hook_wrapped, 2, MANY, 0, + doc: /* Run HOOK, passing each function through WRAP-FUNCTION. +I.e. instead of calling each function FUN directly with arguments ARGS, +it calls WRAP-FUNCTION with arguments FUN and ARGS. +As soon as a call to WRAP-FUNCTION returns non-nil, `run-hook-wrapped' +aborts and returns that value. +usage: (run-hook-wrapped HOOK WRAP-FUNCTION &rest ARGS) */) + (int nargs, Lisp_Object *args) +{ + return run_hook_with_args (nargs, args, run_hook_wrapped_funcall); +} + /* ARGS[0] should be a hook symbol. Call each of the functions in the hook value, passing each of them as arguments all the rest of ARGS (all NARGS - 1 elements). - COND specifies a condition to test after each call - to decide whether to stop. + FUNCALL specifies how to call each function on the hook. The caller (or its caller, etc) must gcpro all of ARGS, except that it isn't necessary to gcpro ARGS[0]. */ -static Lisp_Object -run_hook_with_args (int nargs, Lisp_Object *args, enum run_hooks_condition cond) +Lisp_Object +run_hook_with_args (int nargs, Lisp_Object *args, + Lisp_Object (*funcall) (int nargs, Lisp_Object *args)) { - Lisp_Object sym, val, ret; + Lisp_Object sym, val, ret = Qnil; struct gcpro gcpro1, gcpro2, gcpro3; /* If we are dying or still initializing, @@ -2528,14 +2563,13 @@ run_hook_with_args (int nargs, Lisp_Object *args, enum run_hooks_condition cond) sym = args[0]; val = find_symbol_value (sym); - ret = (cond == until_failure ? Qt : Qnil); if (EQ (val, Qunbound) || NILP (val)) return ret; else if (!CONSP (val) || EQ (XCAR (val), Qlambda)) { args[0] = val; - return Ffuncall (nargs, args); + return funcall (nargs, args); } else { @@ -2543,9 +2577,7 @@ run_hook_with_args (int nargs, Lisp_Object *args, enum run_hooks_condition cond) GCPRO3 (sym, val, global_vals); for (; - CONSP (val) && ((cond == to_completion) - || (cond == until_success ? NILP (ret) - : !NILP (ret))); + CONSP (val) && NILP (ret); val = XCDR (val)) { if (EQ (XCAR (val), Qt)) @@ -2558,30 +2590,26 @@ run_hook_with_args (int nargs, Lisp_Object *args, enum run_hooks_condition cond) if (!CONSP (global_vals) || EQ (XCAR (global_vals), Qlambda)) { args[0] = global_vals; - ret = Ffuncall (nargs, args); + ret = funcall (nargs, args); } else { for (; - (CONSP (global_vals) - && (cond == to_completion - || (cond == until_success - ? NILP (ret) - : !NILP (ret)))); + CONSP (global_vals) && NILP (ret); global_vals = XCDR (global_vals)) { args[0] = XCAR (global_vals); /* In a global value, t should not occur. If it does, we must ignore it to avoid an endless loop. */ if (!EQ (args[0], Qt)) - ret = Ffuncall (nargs, args); + ret = funcall (nargs, args); } } } else { args[0] = XCAR (val); - ret = Ffuncall (nargs, args); + ret = funcall (nargs, args); } } @@ -2603,7 +2631,7 @@ run_hook_with_args_2 (Lisp_Object hook, Lisp_Object arg1, Lisp_Object arg2) Frun_hook_with_args (3, temp); } -/* Apply fn to arg */ +/* Apply fn to arg. */ Lisp_Object apply1 (Lisp_Object fn, Lisp_Object arg) { @@ -2622,7 +2650,7 @@ apply1 (Lisp_Object fn, Lisp_Object arg) } } -/* Call function fn on no arguments */ +/* Call function fn on no arguments. */ Lisp_Object call0 (Lisp_Object fn) { @@ -2632,7 +2660,7 @@ call0 (Lisp_Object fn) RETURN_UNGCPRO (Ffuncall (1, &fn)); } -/* Call function fn with 1 argument arg1 */ +/* Call function fn with 1 argument arg1. */ /* ARGSUSED */ Lisp_Object call1 (Lisp_Object fn, Lisp_Object arg1) @@ -2647,7 +2675,7 @@ call1 (Lisp_Object fn, Lisp_Object arg1) RETURN_UNGCPRO (Ffuncall (2, args)); } -/* Call function fn with 2 arguments arg1, arg2 */ +/* Call function fn with 2 arguments arg1, arg2. */ /* ARGSUSED */ Lisp_Object call2 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2) @@ -2662,7 +2690,7 @@ call2 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2) RETURN_UNGCPRO (Ffuncall (3, args)); } -/* Call function fn with 3 arguments arg1, arg2, arg3 */ +/* Call function fn with 3 arguments arg1, arg2, arg3. */ /* ARGSUSED */ Lisp_Object call3 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3) @@ -2678,7 +2706,7 @@ call3 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3) RETURN_UNGCPRO (Ffuncall (4, args)); } -/* Call function fn with 4 arguments arg1, arg2, arg3, arg4 */ +/* Call function fn with 4 arguments arg1, arg2, arg3, arg4. */ /* ARGSUSED */ Lisp_Object call4 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, @@ -2696,7 +2724,7 @@ call4 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, RETURN_UNGCPRO (Ffuncall (5, args)); } -/* Call function fn with 5 arguments arg1, arg2, arg3, arg4, arg5 */ +/* Call function fn with 5 arguments arg1, arg2, arg3, arg4, arg5. */ /* ARGSUSED */ Lisp_Object call5 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, @@ -2715,7 +2743,7 @@ call5 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, RETURN_UNGCPRO (Ffuncall (6, args)); } -/* Call function fn with 6 arguments arg1, arg2, arg3, arg4, arg5, arg6 */ +/* Call function fn with 6 arguments arg1, arg2, arg3, arg4, arg5, arg6. */ /* ARGSUSED */ Lisp_Object call6 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, @@ -2735,7 +2763,7 @@ call6 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, RETURN_UNGCPRO (Ffuncall (7, args)); } -/* Call function fn with 7 arguments arg1, arg2, arg3, arg4, arg5, arg6, arg7 */ +/* Call function fn with 7 arguments arg1, arg2, arg3, arg4, arg5, arg6, arg7. */ /* ARGSUSED */ Lisp_Object call7 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, @@ -3079,7 +3107,7 @@ grow_specpdl (void) specpdl_ptr = specpdl + count; } -/* specpdl_ptr->symbol is a field which describes which variable is +/* `specpdl_ptr->symbol' is a field which describes which variable is let-bound, so it can be properly undone when we unbind_to. It can have the following two shapes: - SYMBOL : if it's a plain symbol, it means that we have let-bound @@ -3318,7 +3346,7 @@ Output stream used is value of `standard-output'. */) else { tem = *backlist->function; - Fprin1 (tem, Qnil); /* This can QUIT */ + Fprin1 (tem, Qnil); /* This can QUIT. */ write_string ("(", -1); if (backlist->nargs == MANY) { @@ -3588,6 +3616,7 @@ The value the function returns is not used. */); defsubr (&Srun_hook_with_args); defsubr (&Srun_hook_with_args_until_success); defsubr (&Srun_hook_with_args_until_failure); + defsubr (&Srun_hook_wrapped); defsubr (&Sfetch_bytecode); defsubr (&Sbacktrace_debug); defsubr (&Sbacktrace); diff --git a/src/keyboard.c b/src/keyboard.c index 06f375e0d9c..3fea3df07d5 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -254,7 +254,6 @@ Lisp_Object Qecho_area_clear_hook; /* Hooks to run before and after each command. */ Lisp_Object Qpre_command_hook; Lisp_Object Qpost_command_hook; -Lisp_Object Qcommand_hook_internal; Lisp_Object Qdeferred_action_function; @@ -1815,20 +1814,63 @@ adjust_point_for_property (EMACS_INT last_pt, int modified) static Lisp_Object safe_run_hooks_1 (void) { - return Frun_hooks (1, &Vinhibit_quit); + eassert (CONSP (Vinhibit_quit)); + return call0 (XCDR (Vinhibit_quit)); } -/* Subroutine for safe_run_hooks: handle an error by clearing out the hook. */ +/* Subroutine for safe_run_hooks: handle an error by clearing out the function + from the hook. */ static Lisp_Object -safe_run_hooks_error (Lisp_Object data) +safe_run_hooks_error (Lisp_Object error_data) +{ + Lisp_Object hook + = CONSP (Vinhibit_quit) ? XCAR (Vinhibit_quit) : Vinhibit_quit; + Lisp_Object fun = CONSP (Vinhibit_quit) ? XCDR (Vinhibit_quit) : Qnil; + Lisp_Object args[4]; + args[0] = build_string ("Error in %s (%s): %s"); + args[1] = hook; + args[2] = fun; + args[3] = error_data; + Fmessage (4, args); + if (SYMBOLP (hook)) + { + Lisp_Object val; + int found = 0; + Lisp_Object newval = Qnil; + for (val = find_symbol_value (hook); CONSP (val); val = XCDR (val)) + if (EQ (fun, XCAR (val))) + found = 1; + else + newval = Fcons (XCAR (val), newval); + if (found) + return Fset (hook, Fnreverse (newval)); + /* Not found in the local part of the hook. Let's look at the global + part. */ + newval = Qnil; + for (val = (NILP (Fdefault_boundp (hook)) ? Qnil + : Fdefault_value (hook)); + CONSP (val); val = XCDR (val)) + if (EQ (fun, XCAR (val))) + found = 1; + else + newval = Fcons (XCAR (val), newval); + if (found) + return Fset_default (hook, Fnreverse (newval)); + } + return Qnil; +} + +static Lisp_Object +safe_run_hook_funcall (int nargs, Lisp_Object *args) { - Lisp_Object args[3]; - args[0] = build_string ("Error in %s: %s"); - args[1] = Vinhibit_quit; - args[2] = data; - Fmessage (3, args); - return Fset (Vinhibit_quit, Qnil); + eassert (nargs == 1); + if (CONSP (Vinhibit_quit)) + XSETCDR (Vinhibit_quit, args[0]); + else + Vinhibit_quit = Fcons (Vinhibit_quit, args[0]); + + return internal_condition_case (safe_run_hooks_1, Qt, safe_run_hooks_error); } /* If we get an error while running the hook, cause the hook variable @@ -1838,10 +1880,13 @@ safe_run_hooks_error (Lisp_Object data) void safe_run_hooks (Lisp_Object hook) { + /* FIXME: our `internal_condition_case' does not provide any way to pass data + to its body or to its handlers other than via globals such as + dynamically-bound variables ;-) */ int count = SPECPDL_INDEX (); specbind (Qinhibit_quit, hook); - internal_condition_case (safe_run_hooks_1, Qt, safe_run_hooks_error); + run_hook_with_args (1, &hook, safe_run_hook_funcall); unbind_to (count, Qnil); } @@ -11438,9 +11483,6 @@ syms_of_keyboard (void) Qdeferred_action_function = intern_c_string ("deferred-action-function"); staticpro (&Qdeferred_action_function); - Qcommand_hook_internal = intern_c_string ("command-hook-internal"); - staticpro (&Qcommand_hook_internal); - Qfunction_key = intern_c_string ("function-key"); staticpro (&Qfunction_key); Qmouse_click = intern_c_string ("mouse-click"); @@ -11908,22 +11950,18 @@ Buffer modification stores t in this variable. */); Qdeactivate_mark = intern_c_string ("deactivate-mark"); staticpro (&Qdeactivate_mark); - DEFVAR_LISP ("command-hook-internal", Vcommand_hook_internal, - doc: /* Temporary storage of `pre-command-hook' or `post-command-hook'. */); - Vcommand_hook_internal = Qnil; - DEFVAR_LISP ("pre-command-hook", Vpre_command_hook, doc: /* Normal hook run before each command is executed. If an unhandled error happens in running this hook, -the hook value is set to nil, since otherwise the error -might happen repeatedly and make Emacs nonfunctional. */); +the function in which the error occurred is unconditionally removed, since +otherwise the error might happen repeatedly and make Emacs nonfunctional. */); Vpre_command_hook = Qnil; DEFVAR_LISP ("post-command-hook", Vpost_command_hook, doc: /* Normal hook run after each command is executed. If an unhandled error happens in running this hook, -the hook value is set to nil, since otherwise the error -might happen repeatedly and make Emacs nonfunctional. */); +the function in which the error occurred is unconditionally removed, since +otherwise the error might happen repeatedly and make Emacs nonfunctional. */); Vpost_command_hook = Qnil; #if 0 diff --git a/src/lisp.h b/src/lisp.h index 8c7d4da8aa9..1e255df1ecc 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2278,7 +2278,7 @@ void staticpro (Lisp_Object *); struct window; struct frame; -/* Defined in data.c */ +/* Defined in data.c. */ extern Lisp_Object Qnil, Qt, Qquote, Qlambda, Qsubr, Qunbound; extern Lisp_Object Qerror_conditions, Qerror_message, Qtop_level; extern Lisp_Object Qerror, Qquit, Qwrong_type_argument, Qargs_out_of_range; @@ -2812,7 +2812,7 @@ extern void init_obarray (void); extern void init_lread (void); extern void syms_of_lread (void); -/* Defined in eval.c */ +/* Defined in eval.c. */ extern Lisp_Object Qautoload, Qexit, Qinteractive, Qcommandp, Qdefun, Qmacro; extern Lisp_Object Qinhibit_quit; extern Lisp_Object Vautoload_queue; @@ -2830,6 +2830,9 @@ EXFUN (Frun_hooks, MANY); EXFUN (Frun_hook_with_args, MANY); EXFUN (Frun_hook_with_args_until_failure, MANY); extern void run_hook_with_args_2 (Lisp_Object, Lisp_Object, Lisp_Object); +extern Lisp_Object run_hook_with_args (int nargs, Lisp_Object *args, + Lisp_Object (*funcall) + (int nargs, Lisp_Object *args)); EXFUN (Fprogn, UNEVALLED); EXFUN (Finteractive_p, 0); EXFUN (Fthrow, 2) NO_RETURN; -- cgit v1.2.1 From 461c2ab9a5a244ec9a1b253d07c1a8bdfbd8c573 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Tue, 29 Mar 2011 00:41:01 +0200 Subject: src/*.c: Remove some additional unused parameters. * lisp.h (multibyte_char_to_unibyte): * character.c (multibyte_char_to_unibyte): Remove parameter `rev_tbl', unused since 2002-03-01T01:16:34Z!handa@m17n.org and 2008-02-01T16:01:31Z!miles@gnu.org. * character.h (CHAR_TO_BYTE8): * cmds.c (internal_self_insert): * editfns.c (general_insert_function): * keymap.c (push_key_description): * search.c (Freplace_match): * xdisp.c (message_dolog, set_message_1): All callers changed. * coding.c (encode_designation_at_bol): Remove parameter `charbuf_end', unused since 2002-03-01T01:17:24Z!handa@m17n.org and 2008-02-01T16:01:31Z!miles@gnu.org. All callers changed. --- src/ChangeLog | 18 +++++++++++++++++- src/character.c | 7 ++----- src/character.h | 2 +- src/cmds.c | 2 +- src/coding.c | 7 +++---- src/editfns.c | 2 +- src/keymap.c | 2 +- src/lisp.h | 2 +- src/search.c | 7 ++----- src/xdisp.c | 4 ++-- 10 files changed, 31 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index be55ef369b3..1e77a6439e1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,19 @@ +2011-03-28 Juanma Barranquero + + * coding.c (encode_designation_at_bol): Remove parameter `charbuf_end', + unused since 2002-03-01T01:17:24Z!handa@m17n.org and 2008-02-01T16:01:31Z!miles@gnu.org. + All callers changed. + + * lisp.h (multibyte_char_to_unibyte): + * character.c (multibyte_char_to_unibyte): Remove parameter `rev_tbl', + unused since 2002-03-01T01:16:34Z!handa@m17n.org and 2008-02-01T16:01:31Z!miles@gnu.org. + * character.h (CHAR_TO_BYTE8): + * cmds.c (internal_self_insert): + * editfns.c (general_insert_function): + * keymap.c (push_key_description): + * search.c (Freplace_match): + * xdisp.c (message_dolog, set_message_1): All callers changed. + 2011-03-28 Stefan Monnier * keyboard.c (safe_run_hook_funcall): New function. @@ -43,7 +59,7 @@ * nsterm.m (syms_of_nsterm): Use doc: for ns-auto-hide-menu-bar. -2011-03-27 Anders Lindgren +2011-03-27 Anders Lindgren * nsterm.m (ns_menu_bar_is_hidden): New variable. (ns_constrain_all_frames, ns_menu_bar_should_be_hidden) diff --git a/src/character.c b/src/character.c index fdaf22f04f8..41c692e7483 100644 --- a/src/character.c +++ b/src/character.c @@ -232,13 +232,10 @@ translate_char (Lisp_Object table, int c) } /* Convert ASCII or 8-bit character C to unibyte. If C is none of - them, return (C & 0xFF). - - The argument REV_TBL is now ignored. It will be removed in the - future. */ + them, return (C & 0xFF). */ int -multibyte_char_to_unibyte (int c, Lisp_Object rev_tbl) +multibyte_char_to_unibyte (int c) { if (c < 0x80) return c; diff --git a/src/character.h b/src/character.h index 91020cadedc..7a75ac186fa 100644 --- a/src/character.h +++ b/src/character.h @@ -69,7 +69,7 @@ along with GNU Emacs. If not, see . */ #define CHAR_TO_BYTE8(c) \ (CHAR_BYTE8_P (c) \ ? (c) - 0x3FFF00 \ - : multibyte_char_to_unibyte (c, Qnil)) + : multibyte_char_to_unibyte (c)) /* Return the raw 8-bit byte for character C, or -1 if C doesn't correspond to a byte. */ diff --git a/src/cmds.c b/src/cmds.c index ebbb223c2db..1cf7ff24fec 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -352,7 +352,7 @@ internal_self_insert (int c, EMACS_INT n) { str[0] = (SINGLE_BYTE_CHAR_P (c) ? c - : multibyte_char_to_unibyte (c, Qnil)); + : multibyte_char_to_unibyte (c)); len = 1; } if (!NILP (overwrite) diff --git a/src/coding.c b/src/coding.c index 0596d16bf46..fd812148a26 100644 --- a/src/coding.c +++ b/src/coding.c @@ -853,8 +853,7 @@ static unsigned char *alloc_destination (struct coding_system *, EMACS_INT, unsigned char *); static void setup_iso_safe_charsets (Lisp_Object); static unsigned char *encode_designation_at_bol (struct coding_system *, - int *, int *, - unsigned char *); + int *, unsigned char *); static int detect_eol (const unsigned char *, EMACS_INT, enum coding_category); static Lisp_Object adjust_coding_eol_type (struct coding_system *, int); @@ -4299,7 +4298,7 @@ encode_invocation_designation (struct charset *charset, static unsigned char * encode_designation_at_bol (struct coding_system *coding, int *charbuf, - int *charbuf_end, unsigned char *dst) + unsigned char *dst) { struct charset *charset; /* Table of charsets to be designated to each graphic register. */ @@ -4390,7 +4389,7 @@ encode_coding_iso_2022 (struct coding_system *coding) unsigned char *dst_prev = dst; /* We have to produce designation sequences if any now. */ - dst = encode_designation_at_bol (coding, charbuf, charbuf_end, dst); + dst = encode_designation_at_bol (coding, charbuf, dst); bol_designation = 0; /* We are sure that designation sequences are all ASCII bytes. */ produced_chars += dst - dst_prev; diff --git a/src/editfns.c b/src/editfns.c index 009e1d34bde..b04414e1ae6 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -2226,7 +2226,7 @@ general_insert_function (void (*insert_func) { str[0] = (ASCII_CHAR_P (XINT (val)) ? XINT (val) - : multibyte_char_to_unibyte (XINT (val), Qnil)); + : multibyte_char_to_unibyte (XINT (val))); len = 1; } (*insert_func) ((char *) str, len); diff --git a/src/keymap.c b/src/keymap.c index 440df06ba4e..10000b935aa 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -2387,7 +2387,7 @@ push_key_description (register unsigned int c, register char *p, int force_multi /* Now we are sure that C is a valid character code. */ if (NILP (BVAR (current_buffer, enable_multibyte_characters)) && ! force_multibyte) - *p++ = multibyte_char_to_unibyte (c, Qnil); + *p++ = multibyte_char_to_unibyte (c); else p += CHAR_STRING (c, (unsigned char *) p); } diff --git a/src/lisp.h b/src/lisp.h index 1e255df1ecc..a3c4d48b49c 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2403,7 +2403,7 @@ EXFUN (Fchar_width, 1); EXFUN (Fstring, MANY); extern EMACS_INT chars_in_text (const unsigned char *, EMACS_INT); extern EMACS_INT multibyte_chars_in_text (const unsigned char *, EMACS_INT); -extern int multibyte_char_to_unibyte (int, Lisp_Object); +extern int multibyte_char_to_unibyte (int); extern int multibyte_char_to_unibyte_safe (int); extern void init_character_once (void); extern void syms_of_character (void); diff --git a/src/search.c b/src/search.c index 59a530eff61..682fa185bbb 100644 --- a/src/search.c +++ b/src/search.c @@ -2634,11 +2634,8 @@ since only regular expressions have distinguished subexpressions. */) EMACS_INT substed_alloc_size, substed_len; int buf_multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); int str_multibyte = STRING_MULTIBYTE (newtext); - Lisp_Object rev_tbl; int really_changed = 0; - rev_tbl = Qnil; - substed_alloc_size = length * 2 + 100; substed = (unsigned char *) xmalloc (substed_alloc_size + 1); substed_len = 0; @@ -2658,7 +2655,7 @@ since only regular expressions have distinguished subexpressions. */) { FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, newtext, pos, pos_byte); if (!buf_multibyte) - c = multibyte_char_to_unibyte (c, rev_tbl); + c = multibyte_char_to_unibyte (c); } else { @@ -2681,7 +2678,7 @@ since only regular expressions have distinguished subexpressions. */) FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, newtext, pos, pos_byte); if (!buf_multibyte && !ASCII_CHAR_P (c)) - c = multibyte_char_to_unibyte (c, rev_tbl); + c = multibyte_char_to_unibyte (c); } else { diff --git a/src/xdisp.c b/src/xdisp.c index 148c7bc5ec6..308588101e2 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -7962,7 +7962,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte) c = string_char_and_length (msg + i, &char_bytes); work[0] = (ASCII_CHAR_P (c) ? c - : multibyte_char_to_unibyte (c, Qnil)); + : multibyte_char_to_unibyte (c)); insert_1_both (work, 1, 1, 1, 0, 0); } } @@ -9223,7 +9223,7 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby c = string_char_and_length (msg + i, &n); work[0] = (ASCII_CHAR_P (c) ? c - : multibyte_char_to_unibyte (c, Qnil)); + : multibyte_char_to_unibyte (c)); insert_1_both (work, 1, 1, 1, 0, 0); } } -- cgit v1.2.1 From 0bc329278f23e457aac9a6b078f5cdbd80aa28d9 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 28 Mar 2011 23:57:40 -0700 Subject: * dispnew.c (update_window) [PERIODIC_PREEMPTION_CHECKING]: Omit unused local var. --- src/ChangeLog | 5 +++++ src/dispnew.c | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index eb1555db6fb..79b86d561af 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2011-03-29 Paul Eggert + + * dispnew.c (update_window) [PERIODIC_PREEMPTION_CHECKING]: + Omit unused local var. + 2011-03-27 Paul Eggert * keyboard.c (parse_modifiers_uncached, parse_modifiers): diff --git a/src/dispnew.c b/src/dispnew.c index a15b5f45e60..3a78845fa56 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -3590,7 +3590,10 @@ update_window (struct window *w, int force_p) struct glyph_row *row, *end; struct glyph_row *mode_line_row; struct glyph_row *header_line_row; - int yb, changed_p = 0, mouse_face_overwritten_p = 0, n_updated; + int yb, changed_p = 0, mouse_face_overwritten_p = 0; +#if ! PERIODIC_PREEMPTION_CHECKING + int n_updated = 0; +#endif rif->update_window_begin_hook (w); yb = window_text_bottom_y (w); @@ -3643,7 +3646,7 @@ update_window (struct window *w, int force_p) } /* Update the rest of the lines. */ - for (n_updated = 0; row < end && (force_p || !input_pending); ++row) + for (; row < end && (force_p || !input_pending); ++row) if (row->enabled_p) { int vpos = MATRIX_ROW_VPOS (row, desired_matrix); -- cgit v1.2.1 From b01a1c29127705cf435f02d50b48d6f85f5b2716 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 28 Mar 2011 23:58:36 -0700 Subject: * menu.c (digest_single_submenu): Omit unused local var. --- src/ChangeLog | 1 + src/menu.c | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 79b86d561af..1f636e0dde6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,6 @@ 2011-03-29 Paul Eggert + * menu.c (digest_single_submenu): Omit unused local var. * dispnew.c (update_window) [PERIODIC_PREEMPTION_CHECKING]: Omit unused local var. diff --git a/src/menu.c b/src/menu.c index 851f1ac804b..a9098deed7e 100644 --- a/src/menu.c +++ b/src/menu.c @@ -662,13 +662,12 @@ digest_single_submenu (int start, int end, int top_level_items) else if (EQ (XVECTOR (menu_items)->contents[i], Qt)) { /* Create a new pane. */ - Lisp_Object pane_name, prefix; + Lisp_Object pane_name; const char *pane_string; panes_seen++; pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME]; - prefix = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX]; #ifdef HAVE_NTGUI if (STRINGP (pane_name)) -- cgit v1.2.1 From c499e55717190f3fcf46fd04cfead5bf31962ab2 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 28 Mar 2011 23:59:27 -0700 Subject: * window.c (shrink_windows): Omit unused local var. --- src/ChangeLog | 1 + src/window.c | 6 +----- 2 files changed, 2 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 1f636e0dde6..938619aa08f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,6 @@ 2011-03-29 Paul Eggert + * window.c (shrink_windows): Omit unused local var. * menu.c (digest_single_submenu): Omit unused local var. * dispnew.c (update_window) [PERIODIC_PREEMPTION_CHECKING]: Omit unused local var. diff --git a/src/window.c b/src/window.c index 9ab9fab2c13..b7747b5ad79 100644 --- a/src/window.c +++ b/src/window.c @@ -2978,14 +2978,10 @@ shrink_windows (int total, int size, int nchildren, int shrinkable, while (total_shrink > total_removed) { int nonzero_sizes = 0; - int nonzero_idx = -1; for (i = 0; i < nchildren; ++i) if (new_sizes[i] > 0) - { - ++nonzero_sizes; - nonzero_idx = i; - } + ++nonzero_sizes; for (i = 0; i < nchildren; ++i) if (new_sizes[i] > min_sizes[i]) -- cgit v1.2.1 From 792c7b2ba5319f436b459ff2c0d21e20207db550 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 29 Mar 2011 00:01:11 -0700 Subject: * xdisp.c (try_window_reusing_current_matrix, x_produce_glyphs): (note_mode_line_or_margin_highlight, note_mouse_highlight): Omit unused local vars. --- src/ChangeLog | 3 +++ src/xdisp.c | 18 +++++------------- 2 files changed, 8 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 938619aa08f..6ba04202854 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-29 Paul Eggert + * xdisp.c (try_window_reusing_current_matrix, x_produce_glyphs): + (note_mode_line_or_margin_highlight, note_mouse_highlight): + Omit unused local vars. * window.c (shrink_windows): Omit unused local var. * menu.c (digest_single_submenu): Omit unused local var. * dispnew.c (update_window) [PERIODIC_PREEMPTION_CHECKING]: diff --git a/src/xdisp.c b/src/xdisp.c index 140c2155d15..f286000c966 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -14643,8 +14643,6 @@ try_window_reusing_current_matrix (struct window *w) if (CHARPOS (new_start) <= CHARPOS (start)) { - int first_row_y; - /* Don't use this method if the display starts with an ellipsis displayed for invisible text. It's not easy to handle that case below, and it's certainly not worth the effort since this is @@ -14659,7 +14657,6 @@ try_window_reusing_current_matrix (struct window *w) text. Note that it.vpos == 0 if or if not there is a header-line; it's not the same as the MATRIX_ROW_VPOS! */ start_display (&it, w, new_start); - first_row_y = it.current_y; w->cursor.vpos = -1; last_text_row = last_reused_text_row = NULL; @@ -22757,7 +22754,6 @@ x_produce_glyphs (struct it *it) int ch = COMPOSITION_GLYPH (cmp, i); int face_id; struct face *this_face; - int this_boff; if (ch == '\t') ch = ' '; @@ -22769,9 +22765,6 @@ x_produce_glyphs (struct it *it) pcm = NULL; else { - this_boff = font->baseline_offset; - if (font->vertical_centering) - this_boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff; get_char_face_and_encoding (it->f, ch, face_id, &char2b, it->multibyte_p, 0); pcm = get_per_char_metric (it->f, font, &char2b); @@ -24974,10 +24967,9 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, CONSP (hotspot)) && (hotspot = XCDR (hotspot), CONSP (hotspot))) { - Lisp_Object area_id, plist; + Lisp_Object plist; - area_id = XCAR (hotspot); - /* Could check AREA_ID to see if we enter/leave this hot-spot. + /* Could check XCAR (hotspot) to see if we enter/leave this hot-spot. If so, we could look for mouse-enter, mouse-leave properties in PLIST (and do something...). */ hotspot = XCDR (hotspot); @@ -25312,10 +25304,10 @@ note_mouse_highlight (struct frame *f, int x, int y) CONSP (hotspot)) && (hotspot = XCDR (hotspot), CONSP (hotspot))) { - Lisp_Object area_id, plist; + Lisp_Object plist; - area_id = XCAR (hotspot); - /* Could check AREA_ID to see if we enter/leave this hot-spot. + /* Could check XCAR (hotspot) to see if we enter/leave + this hot-spot. If so, we could look for mouse-enter, mouse-leave properties in PLIST (and do something...). */ hotspot = XCDR (hotspot); -- cgit v1.2.1 From 94eab1c84d9862cb56db2f610362e33107d75774 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Tue, 29 Mar 2011 16:00:16 +0200 Subject: src/scroll.c, src/w32.c: Trivial whitespace changes. --- src/scroll.c | 11 +++++-- src/w32.c | 105 ++++++++++++++++++++++++++++++----------------------------- 2 files changed, 61 insertions(+), 55 deletions(-) (limited to 'src') diff --git a/src/scroll.c b/src/scroll.c index f013ebbee0e..fcec596daa3 100644 --- a/src/scroll.c +++ b/src/scroll.c @@ -239,7 +239,9 @@ calculate_scrolling (FRAME_PTR frame, of lines. */ static void -do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix, struct matrix_elt *matrix, int window_size, int unchanged_at_top) +do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix, + struct matrix_elt *matrix, int window_size, + int unchanged_at_top) { struct matrix_elt *p; int i, j, k; @@ -831,7 +833,9 @@ scrolling_1 (FRAME_PTR frame, int window_size, int unchanged_at_top, such a line will have little weight. */ int -scrolling_max_lines_saved (int start, int end, int *oldhash, int *newhash, int *cost) +scrolling_max_lines_saved (int start, int end, + int *oldhash, int *newhash, + int *cost) { struct { int hash; int count; } lines[01000]; register int i, h; @@ -920,7 +924,8 @@ scroll_cost (FRAME_PTR frame, int from, int to, int amount) overhead and multiply factor values */ static void -line_ins_del (FRAME_PTR frame, int ov1, int pf1, int ovn, int pfn, register int *ov, register int *mf) +line_ins_del (FRAME_PTR frame, int ov1, int pf1, int ovn, int pfn, + register int *ov, register int *mf) { register EMACS_INT i; register EMACS_INT frame_lines = FRAME_LINES (frame); diff --git a/src/w32.c b/src/w32.c index 495f878d3a8..da403671115 100644 --- a/src/w32.c +++ b/src/w32.c @@ -1505,6 +1505,7 @@ w32_get_resource (char *key, LPDWORD lpdwtype) } char *get_emacs_configuration (void); + void init_environment (char ** argv) { @@ -1591,25 +1592,25 @@ init_environment (char ** argv) If not, then we can try to default to the appdata directory under the user's profile, which is more likely to be writable. */ if (stat ("C:/.emacs", &ignored) < 0) - { - HRESULT profile_result; - /* Dynamically load ShGetFolderPath, as it won't exist on versions - of Windows 95 and NT4 that have not been updated to include - MSIE 5. */ - ShGetFolderPath_fn get_folder_path; - get_folder_path = (ShGetFolderPath_fn) - GetProcAddress (GetModuleHandle ("shell32.dll"), "SHGetFolderPathA"); - - if (get_folder_path != NULL) - { - profile_result = get_folder_path (NULL, CSIDL_APPDATA, NULL, - 0, default_home); + { + HRESULT profile_result; + /* Dynamically load ShGetFolderPath, as it won't exist on versions + of Windows 95 and NT4 that have not been updated to include + MSIE 5. */ + ShGetFolderPath_fn get_folder_path; + get_folder_path = (ShGetFolderPath_fn) + GetProcAddress (GetModuleHandle ("shell32.dll"), "SHGetFolderPathA"); + + if (get_folder_path != NULL) + { + profile_result = get_folder_path (NULL, CSIDL_APPDATA, NULL, + 0, default_home); - /* If we can't get the appdata dir, revert to old behavior. */ - if (profile_result == S_OK) - env_vars[0].def_value = default_home; - } - } + /* If we can't get the appdata dir, revert to old behavior. */ + if (profile_result == S_OK) + env_vars[0].def_value = default_home; + } + } /* Get default locale info and use it for LANG. */ if (GetLocaleInfo (LOCALE_USER_DEFAULT, @@ -2082,42 +2083,42 @@ GetCachedVolumeInformation (char * root_dir) info = lookup_volume_info (root_dir); if (info == NULL || ! VOLINFO_STILL_VALID (root_dir, info)) - { - char name[ 256 ]; - DWORD serialnum; - DWORD maxcomp; - DWORD flags; - char type[ 256 ]; - - /* Info is not cached, or is stale. */ - if (!GetVolumeInformation (root_dir, - name, sizeof (name), - &serialnum, - &maxcomp, - &flags, - type, sizeof (type))) - return NULL; + { + char name[ 256 ]; + DWORD serialnum; + DWORD maxcomp; + DWORD flags; + char type[ 256 ]; + + /* Info is not cached, or is stale. */ + if (!GetVolumeInformation (root_dir, + name, sizeof (name), + &serialnum, + &maxcomp, + &flags, + type, sizeof (type))) + return NULL; - /* Cache the volume information for future use, overwriting existing - entry if present. */ - if (info == NULL) - { - info = (volume_info_data *) xmalloc (sizeof (volume_info_data)); - add_volume_info (root_dir, info); - } - else - { - xfree (info->name); - xfree (info->type); - } + /* Cache the volume information for future use, overwriting existing + entry if present. */ + if (info == NULL) + { + info = (volume_info_data *) xmalloc (sizeof (volume_info_data)); + add_volume_info (root_dir, info); + } + else + { + xfree (info->name); + xfree (info->type); + } - info->name = xstrdup (name); - info->serialnum = serialnum; - info->maxcomp = maxcomp; - info->flags = flags; - info->type = xstrdup (type); - info->timestamp = GetTickCount (); - } + info->name = xstrdup (name); + info->serialnum = serialnum; + info->maxcomp = maxcomp; + info->flags = flags; + info->type = xstrdup (type); + info->timestamp = GetTickCount (); + } return info; } -- cgit v1.2.1 From f838ed7b0ac1f7715f49b1e5d7de9b75b4159b64 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 29 Mar 2011 17:17:26 -0700 Subject: * editfns.c (Fmessage_box): Remove unused local var. --- src/ChangeLog | 4 ++++ src/editfns.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 4e84f9510dd..2f88aa5ad07 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2011-03-30 Paul Eggert + + * editfns.c (Fmessage_box): Remove unused local var. + 2011-03-29 Paul Eggert * xdisp.c (try_window_reusing_current_matrix, x_produce_glyphs): diff --git a/src/editfns.c b/src/editfns.c index 58f634fa479..d0f1df694d5 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -3444,12 +3444,12 @@ usage: (message-box FORMAT-STRING &rest ARGS) */) if (FRAME_WINDOW_P (XFRAME (selected_frame)) || FRAME_MSDOS_P (XFRAME (selected_frame))) { - Lisp_Object pane, menu, obj; + Lisp_Object pane, menu; struct gcpro gcpro1; pane = Fcons (Fcons (build_string ("OK"), Qt), Qnil); GCPRO1 (pane); menu = Fcons (val, pane); - obj = Fx_popup_dialog (Qt, menu, Qt); + Fx_popup_dialog (Qt, menu, Qt); UNGCPRO; return val; } -- cgit v1.2.1 From de6dbc14a72347f3f2a3b4f0bf3c39d6f69a425e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 29 Mar 2011 17:19:27 -0700 Subject: * unexelf.c (unexec) [! (defined _SYSTYPE_SYSV || defined __sgi)]: Remove unused local var. --- src/ChangeLog | 3 +++ src/unexelf.c | 4 ++++ 2 files changed, 7 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 2f88aa5ad07..c44444a9244 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-30 Paul Eggert + * unexelf.c (unexec) [! (defined _SYSTYPE_SYSV || defined __sgi)]: + Remove unused local var. + * editfns.c (Fmessage_box): Remove unused local var. 2011-03-29 Paul Eggert diff --git a/src/unexelf.c b/src/unexelf.c index b58c78501b8..8b45894f853 100644 --- a/src/unexelf.c +++ b/src/unexelf.c @@ -651,7 +651,9 @@ unexec (const char *new_name, const char *old_name) int n, nn; int old_bss_index, old_sbss_index, old_plt_index; int old_data_index, new_data2_index; +#if defined _SYSTYPE_SYSV || defined __sgi int old_mdebug_index; +#endif struct stat stat_buf; int old_file_size; @@ -695,8 +697,10 @@ unexec (const char *new_name, const char *old_name) /* Find the mdebug section, if any. */ +#if defined _SYSTYPE_SYSV || defined __sgi old_mdebug_index = find_section (".mdebug", old_section_names, old_name, old_file_h, old_section_h, 1); +#endif /* Find the old .bss section. Figure out parameters of the new data2 and bss sections. */ -- cgit v1.2.1 From 888adce96c1a551c975718bd8ad540525b1f408c Mon Sep 17 00:00:00 2001 From: Zachary Kanfer Date: Wed, 30 Mar 2011 09:35:37 -0400 Subject: * src/keyboard.c (Fexecute_extended_command): Do log the "suggest key binding" message. Fixes: debbugs:7967 --- src/ChangeLog | 5 +++++ src/keyboard.c | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 973b7712e53..2df49ff31bc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2011-03-30 Zachary Kanfer (tiny change) + + * keyboard.c (Fexecute_extended_command): Do log the "suggest key + binding" message (bug#7967). + 2011-03-30 Paul Eggert Fix more problems found by GCC 4.6.0's static checks. diff --git a/src/keyboard.c b/src/keyboard.c index 86a2b3e8abd..70098d46ebb 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -10340,9 +10340,9 @@ give to the command you invoke, if it asks for an argument. */) sprintf (newmessage, "You can run the command `%s' with %s", SDATA (SYMBOL_NAME (function)), SDATA (binding)); - message2_nolog (newmessage, - strlen (newmessage), - STRING_MULTIBYTE (binding)); + message2 (newmessage, + strlen (newmessage), + STRING_MULTIBYTE (binding)); if (NUMBERP (Vsuggest_key_bindings)) waited = sit_for (Vsuggest_key_bindings, 0, 2); else -- cgit v1.2.1 From 1c470562971bd86b1767ceb9ae95ece71228549f Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 30 Mar 2011 14:04:11 -0400 Subject: * src/bytecode.c (Fbyte_code): CAR and CDR can GC. --- src/ChangeLog | 4 ++++ src/bytecode.c | 25 ++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 2df49ff31bc..0b0ed2ed775 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2011-03-30 Stefan Monnier + + * bytecode.c (Fbyte_code): CAR and CDR can GC. + 2011-03-30 Zachary Kanfer (tiny change) * keyboard.c (Fexecute_extended_command): Do log the "suggest key diff --git a/src/bytecode.c b/src/bytecode.c index ce2f06dfccb..a7be8e26f27 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -554,7 +554,16 @@ If the third argument is incorrect, Emacs may crash. */) { Lisp_Object v1; v1 = TOP; - TOP = CAR (v1); + if (CONSP (v1)) + TOP = XCAR (v1); + else if (NILP (v1)) + TOP = Qnil; + else + { + BEFORE_POTENTIAL_GC (); + wrong_type_argument (Qlistp, v1); + AFTER_POTENTIAL_GC (); + } break; } @@ -580,7 +589,17 @@ If the third argument is incorrect, Emacs may crash. */) { Lisp_Object v1; v1 = TOP; - TOP = CDR (v1); + if (CONSP (v1)) + TOP = XCDR (v1); + else if (NILP (v1)) + TOP = Qnil; + else + { + BEFORE_POTENTIAL_GC (); + wrong_type_argument (Qlistp, v1); + AFTER_POTENTIAL_GC (); + } + break; break; } @@ -911,13 +930,13 @@ If the third argument is incorrect, Emacs may crash. */) v1 = POP; v2 = TOP; CHECK_NUMBER (v2); - AFTER_POTENTIAL_GC (); op = XINT (v2); immediate_quit = 1; while (--op >= 0 && CONSP (v1)) v1 = XCDR (v1); immediate_quit = 0; TOP = CAR (v1); + AFTER_POTENTIAL_GC (); break; } -- cgit v1.2.1 From 44f230aa043ebb222aa0876b44d70484d5dd38db Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 30 Mar 2011 15:18:12 -0400 Subject: * src/eval.c (struct backtrace): Don't cheat with negative numbers, but do steal a few bits to be more compact. (interactive_p, Fbacktrace, Fbacktrace_frame, mark_backtrace): Remove unneeded casts. --- src/ChangeLog | 77 +++++++++++++++++++++++++++++++---------------------------- src/eval.c | 32 ++++++++++++++----------- 2 files changed, 59 insertions(+), 50 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 0b0ed2ed775..a6623803a6e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2011-03-30 Stefan Monnier + * eval.c (struct backtrace): Don't cheat with negative numbers, but do + steal a few bits to be more compact. + (interactive_p, Fbacktrace, Fbacktrace_frame, mark_backtrace): + Remove unneeded casts. + * bytecode.c (Fbyte_code): CAR and CDR can GC. 2011-03-30 Zachary Kanfer (tiny change) @@ -344,8 +349,8 @@ (create_process): Use 'volatile' to avoid vfork clobbering (Bug#8298). Make tparam.h and terminfo.c consistent. - * cm.c (tputs, tgoto, BC, UP): Remove extern decls. Include - tparam.h instead, since it declares them. + * cm.c (tputs, tgoto, BC, UP): Remove extern decls. + Include tparam.h instead, since it declares them. * cm.h (PC): Remove extern decl; tparam.h now does this. * deps.mk (cm.o, terminfo.o): Depend on tparam.h. * terminfo.c: Include tparam.h, to check interfaces. @@ -391,8 +396,8 @@ * intervals.h (CHECK_TOTAL_LENGTH): Avoid empty "else". - * atimer.c (start_atimer, append_atimer_lists, set_alarm): Rename - locals to avoid shadowing. + * atimer.c (start_atimer, append_atimer_lists, set_alarm): + Rename locals to avoid shadowing. * sound.c (wav_play, au_play, Fplay_sound_internal): Fix pointer signedness. @@ -561,8 +566,8 @@ gcc -Wbad-function-cast warning. (default_value, arithcompare, arith_driver, arith_error): Now static. (store_symval_forwarding): Rename local to avoid shadowing. - (Fmake_variable_buffer_local, Fmake_local_variable): Mark - variables as initialized. + (Fmake_variable_buffer_local, Fmake_local_variable): + Mark variables as initialized. (do_blv_forwarding, do_symval_forwarding): Remove; unused. * alloc.c (check_cons_list): Do not define unless GC_CHECK_CONS_LIST. @@ -816,8 +821,8 @@ (BUF_PT_BYTE): Rewrite to handle indirect buffers (Bug#8219). These macros can no longer be used for assignment. - * buffer.c (Fget_buffer_create, Fmake_indirect_buffer): Assign - struct members directly, instead of using BUF_BEGV etc. + * buffer.c (Fget_buffer_create, Fmake_indirect_buffer): + Assign struct members directly, instead of using BUF_BEGV etc. (record_buffer_markers, fetch_buffer_markers): New functions for recording and fetching special buffer markers. (set_buffer_internal_1, set_buffer_temp): Use them. @@ -938,8 +943,8 @@ * term.c (encode_terminal_code): Now external again, used by w32console.c and msdos.c. - * makefile.w32-in ($(BLD)/term.$(O), ($(BLD)/tparam.$(O)): Depend - on $(SRC)/tparam.h, see 2011-03-11T07:24:21Z!eggert@cs.ucla.edu. + * makefile.w32-in ($(BLD)/term.$(O), ($(BLD)/tparam.$(O)): + Depend on $(SRC)/tparam.h, see 2011-03-11T07:24:21Z!eggert@cs.ucla.edu. 2011-03-11 Paul Eggert @@ -1003,8 +1008,8 @@ (x_delete_glyphs, x_ins_del_lines): Mark with NO_RETURN. (x_connection_closed): Tell GCC not to suggest NO_RETURN. - * xfaces.c (clear_face_cache, Fx_list_fonts, Fface_font): Rename - or move locals to avoid shadowing. + * xfaces.c (clear_face_cache, Fx_list_fonts, Fface_font): + Rename or move locals to avoid shadowing. (tty_defined_color, merge_face_heights): Now static. (free_realized_faces_for_fontset): Remove; not used. (Fx_list_fonts): Mark variable that gcc -Wuninitialized @@ -1162,12 +1167,12 @@ (xg_prepare_tooltip, xg_hide_tooltip): Call gdk_window_get_screen. (xg_prepare_tooltip, create_dialog, menubar_map_cb) (xg_update_frame_menubar, xg_tool_bar_detach_callback) - (xg_tool_bar_attach_callback, xg_update_tool_bar_sizes): Call - gtk_widget_get_preferred_size. + (xg_tool_bar_attach_callback, xg_update_tool_bar_sizes): + Call gtk_widget_get_preferred_size. (xg_frame_resized): gdk_window_get_geometry only takes 5 parameters. - (xg_win_to_widget, xg_event_is_for_menubar): Call - gdk_x11_window_lookup_for_display. + (xg_win_to_widget, xg_event_is_for_menubar): + Call gdk_x11_window_lookup_for_display. (xg_set_widget_bg): New function. (delete_cb): New function. (xg_create_frame_widgets): connect delete-event to delete_cb. @@ -1263,7 +1268,7 @@ (produce_glyphless_glyph): Make a pointer "const" since it might point to immutable storage. (update_window_cursor): Now static, since it's not used elsewhere. - (SKIP_GLYPHS): Removed unused macro. + (SKIP_GLYPHS): Remove unused macro. 2011-03-06 Michael Shields (tiny change) @@ -7760,7 +7765,7 @@ * xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT) (handle_one_xevent, x_check_errors, xim_initialize, x_term_init): Likewise. - * character.h (BCOPY_SHORT): Removed. + * character.h (BCOPY_SHORT): Remove. * config.in: Regenerate. * dispnew.c (safe_bcopy): Only define as dummy if PROFILING. * emacs.c (main) [PROFILING]: Don't declare @@ -19549,7 +19554,7 @@ Set xftfont_info->ft_size. Don't unlock the face. Check BDF properties if appropriate. (xftfont_close): Unlock the face. - (xftfont_anchor_point, xftfont_shape): Deleted. + (xftfont_anchor_point, xftfont_shape): Delete. (syms_of_xftfont): Don't set members anchor_point and shape of xftfont_driver. @@ -21454,7 +21459,7 @@ Delete externs. (fontset_from_font_name): Extern it. (FS_LOAD_FONT, FONT_INFO_ID, FONT_INFO_FROM_ID) - (FONT_INFO_FROM_FACE): Deleted. + (FONT_INFO_FROM_FACE): Delete. (face_for_font): Adjust prototype. * fontset.c: Throughout the file, delete all USE_FONT_BACKEND @@ -21471,7 +21476,7 @@ (fontset_compare_rfontdef): New function. (reorder_font_vector): Remove the argument CHARSET-ID. Sort rfont-defs by qsort. Adjusted for the change of font-group vector. - (load_font_get_repertory): Deleted. + (load_font_get_repertory): Delete. (fontset_find_font): Use new macros to ref/set elements of font-def and rfont-def. (fontset_font): Fix the timing of remembering that no font for C. @@ -21487,11 +21492,11 @@ font-def. (Fnew_fontset): Use font_unparse_xlfd to generate FONTSET_ASCII (fontset). - (new_fontset_from_font_name): Deleted. + (new_fontset_from_font_name): Delete. (fontset_from_font): Rename from new_fontset_from_font. Check if a fontset is already created for the font. FIx updating of Vfontset_alias_alist. - (fontset_ascii_font): Deleted. + (fontset_ascii_font): Delete. (Ffont_info): Adjust for the format change of font-spec. (Finternal_char_font): Likewise. (Ffontset_info): Likewise. @@ -21519,7 +21524,7 @@ (ftfont_list): Return a list, not vector. (ftfont_match): Use ftfont_spec_pattern to get a pattern. (ftfont_list_family): Don't downcase names. - (ftfont_free_entity): Deleted. + (ftfont_free_entity): Delete. (ftfont_open): Return a font-object. Adjusted for the change of struct font. Get underline_thickness and underline_position from font property. Don't update dpyinfo->smallest_font_height and @@ -21571,13 +21576,13 @@ (QCfoundry, QCadstyle, QCregistry, QCspacing, QCsize, QCavgwidth) (Qp): Extern them. (clear_font_table, load_face_font, xlfd_lookup_field_contents): - Deleted. - (struct font_name): Deleted. - (xlfd_numeric_value, xlfd_symbolic_value): Deleted. + Delete. + (struct font_name): Delete. + (xlfd_numeric_value, xlfd_symbolic_value): Delete. (compare_fonts_by_sort_order): New function. (xlfd_numeric_slant, xlfd_symbolic_slant, xlfd_numeric_weight) (xlfd_symbolic_weight, xlfd_numeric_swidth, xlfd_symbolic_swidth): - Deleted. + Delete. (Fx_family_fonts): Use font_list_entities, and sort fonts by compare_fonts_by_sort_order. (Fx_font_family_list): Call Ffont_family_list. @@ -21590,9 +21595,9 @@ (free_font_names, sort_fonts, x_face_list_fonts) (face_font_available_p, sorted_font_list, cmp_font_names) (font_list_1, concat_font_list, font_list, remove_duplicates): - Deleted. + Delete. (Fx_list_fonts): Use Ffont_list. - (LFACE_AVGWIDTH): Deleted. + (LFACE_AVGWIDTH): Delete. (check_lface_attrs): Don't check LFACE_AVGWIDTH. Check LFACE_FONT by FONTP. (lface_fully_specified_p): Don't check LFACE_AVGWIDTH. @@ -21614,7 +21619,7 @@ (Fface_font): Get a font name from font->props[FONT_NAME_INDEX]. (lface_same_font_attributes_p): Don't check LFACE_AVGWIDTH. Compare fonts by EQ. - (lookup_non_ascii_face): Deleted. + (lookup_non_ascii_face): Delete. (face_for_font): The 2nd argument changed. (x_supports_face_attributes_p): Don't check LFACE_AVGWIDTH. Check atomic font properties by case insensitive. @@ -21637,7 +21642,7 @@ * xfont.c: Include and "ccl.h". (struct xfont_info): New structure. - (xfont_query_font): Deleted. + (xfont_query_font): Delete. (xfont_find_ccl_program): Rename from x_find_ccl_program and moved from xterm.c. (xfont_driver): Adjust for the change of struct font_driver. @@ -21653,7 +21658,7 @@ dpyinfo->smallest_char_width. (xfont_close): Don't free struct font. (xfont_prepare_face): Adjust for the change of struct font. - (xfont_done_face): Deleted. + (xfont_done_face): Delete. (xfont_has_char): Adjust for the change of struct font. (xfont_encode_char, xfont_draw): Likewise. (xfont_check): New function. @@ -21683,7 +21688,7 @@ * xterm.c: Throughout the file, delete all USE_FONT_BACKEND conditionals. Don't check enable_font_backend. Delete all codes used only when USE_FONT_BACKEND is not defined. Don't include ccl.h. - (x_per_char_metric, x_encode_char): Deleted. + (x_per_char_metric, x_encode_char): Delete. (x_set_cursor_gc, x_set_mouse_face_gc): Don't set GCFont. (x_compute_glyph_string_overhangs): Adjust for the change of `struct face'. @@ -21692,10 +21697,10 @@ (x_draw_glyph_string): Likewise. Use font->underline_position and font->underline_thickness. (x_new_font): Rename from x_new_fontset2. - (x_new_fontset, x_get_font_info, x_list_fonts): Deleted. + (x_new_fontset, x_get_font_info, x_list_fonts): Delete. (x_check_font): Call `check' method of a font driver. (x_font_min_bounds, x_compute_min_glyph_bounds, x_load_font) - (x_query_font, x_get_font_repertory): Deleted. + (x_query_font, x_get_font_repertory): Delete. (x_find_ccl_program): Rename and moved to xfont.c. (x_redisplay_interface): Adjust for the change of `struct redisplay_interface'. diff --git a/src/eval.c b/src/eval.c index 26aea3df5df..718e58c693f 100644 --- a/src/eval.c +++ b/src/eval.c @@ -38,16 +38,20 @@ struct backtrace struct backtrace *next; Lisp_Object *function; Lisp_Object *args; /* Points to vector of args. */ - size_t nargs; /* Length of vector. - If nargs is (size_t) UNEVALLED, args points - to slot holding list of unevalled args. */ - char evalargs; +#define NARGS_BITS (BITS_PER_INT - 2) + /* Let's not use size_t because we want to allow negative values (for + UNEVALLED). Also let's steal 2 bits so we save a word (or more for + alignment). In any case I doubt Emacs would survive a function call with + more than 500M arguments. */ + int nargs : NARGS_BITS; /* Length of vector. + If nargs is UNEVALLED, args points + to slot holding list of unevalled args. */ + char evalargs : 1; /* Nonzero means call value of debugger when done with this operation. */ - char debug_on_exit; + char debug_on_exit : 1; }; struct backtrace *backtrace_list; - struct catchtag *catchlist; #ifdef DEBUG_GCPRO @@ -553,7 +557,7 @@ interactive_p (int exclude_subrs_p) looking at several frames for special forms. Skip past them. */ while (btp && (EQ (*btp->function, Qbytecode) - || btp->nargs == (size_t) UNEVALLED)) + || btp->nargs == UNEVALLED)) btp = btp->next; /* `btp' now points at the frame of the innermost function that isn't @@ -3335,7 +3339,7 @@ Output stream used is value of `standard-output'. */) while (backlist) { write_string (backlist->debug_on_exit ? "* " : " ", 2); - if (backlist->nargs == (size_t) UNEVALLED) + if (backlist->nargs == UNEVALLED) { Fprin1 (Fcons (*backlist->function, *backlist->args), Qnil); write_string ("\n", -1); @@ -3345,8 +3349,8 @@ Output stream used is value of `standard-output'. */) tem = *backlist->function; Fprin1 (tem, Qnil); /* This can QUIT. */ write_string ("(", -1); - if (backlist->nargs == (size_t) MANY) - { + if (backlist->nargs == MANY) + { /* FIXME: Can this happen? */ int i; for (tail = *backlist->args, i = 0; !NILP (tail); @@ -3399,11 +3403,11 @@ If NFRAMES is more than the number of frames, the value is nil. */) if (!backlist) return Qnil; - if (backlist->nargs == (size_t) UNEVALLED) + if (backlist->nargs == UNEVALLED) return Fcons (Qnil, Fcons (*backlist->function, *backlist->args)); else { - if (backlist->nargs == (size_t) MANY) + if (backlist->nargs == MANY) /* FIXME: Can this happen? */ tem = *backlist->args; else tem = Flist (backlist->nargs, backlist->args); @@ -3423,8 +3427,8 @@ mark_backtrace (void) { mark_object (*backlist->function); - if (backlist->nargs == (size_t) UNEVALLED - || backlist->nargs == (size_t) MANY) + if (backlist->nargs == UNEVALLED + || backlist->nargs == MANY) /* FIXME: Can this happen? */ i = 1; else i = backlist->nargs; -- cgit v1.2.1