diff options
| author | Paul Eggert | 2011-03-22 18:01:59 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-03-22 18:01:59 -0700 |
| commit | c9c49752e15c105ded153e9ab0a42743f57184e5 (patch) | |
| tree | e395db95d87459082bace9fcf3a2cec0ea3d1aea /src | |
| parent | 9d0da923ebd2b78abb6e02f0b90cfe9d818eb301 (diff) | |
| parent | b9b4b7cb4c27f9f6ad644168f0e1241e5c0d6eaa (diff) | |
| download | emacs-c9c49752e15c105ded153e9ab0a42743f57184e5.tar.gz emacs-c9c49752e15c105ded153e9ab0a42743f57184e5.zip | |
Fix more problems found by GCC 4.5.2's static checks.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 127 | ||||
| -rw-r--r-- | src/atimer.c | 47 | ||||
| -rw-r--r-- | src/callproc.c | 20 | ||||
| -rw-r--r-- | src/character.h | 68 | ||||
| -rw-r--r-- | src/cm.c | 10 | ||||
| -rw-r--r-- | src/cm.h | 2 | ||||
| -rw-r--r-- | src/coding.c | 3 | ||||
| -rw-r--r-- | src/composite.c | 34 | ||||
| -rw-r--r-- | src/deps.mk | 4 | ||||
| -rw-r--r-- | src/emacs.c | 17 | ||||
| -rw-r--r-- | src/fileio.c | 7 | ||||
| -rw-r--r-- | src/frame.c | 5 | ||||
| -rw-r--r-- | src/ftfont.c | 49 | ||||
| -rw-r--r-- | src/intervals.c | 3 | ||||
| -rw-r--r-- | src/intervals.h | 10 | ||||
| -rw-r--r-- | src/lisp.h | 10 | ||||
| -rw-r--r-- | src/process.c | 75 | ||||
| -rw-r--r-- | src/region-cache.c | 25 | ||||
| -rw-r--r-- | src/region-cache.h | 2 | ||||
| -rw-r--r-- | src/scroll.c | 4 | ||||
| -rw-r--r-- | src/sound.c | 10 | ||||
| -rw-r--r-- | src/sysdep.c | 6 | ||||
| -rw-r--r-- | src/terminfo.c | 23 | ||||
| -rw-r--r-- | src/textprop.c | 32 | ||||
| -rw-r--r-- | src/tparam.h | 4 | ||||
| -rw-r--r-- | src/xdisp.c | 22 | ||||
| -rw-r--r-- | src/xfont.c | 2 | ||||
| -rw-r--r-- | src/xftfont.c | 16 | ||||
| -rw-r--r-- | src/xmenu.c | 2 | ||||
| -rw-r--r-- | src/xml.c | 3 |
30 files changed, 378 insertions, 264 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index f489a233683..a4312efceb9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,130 @@ | |||
| 1 | 2011-03-23 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Fix more problems found by GCC 4.5.2's static checks. | ||
| 4 | |||
| 5 | * coding.c (encode_coding_raw_text): Avoid unnecessary test | ||
| 6 | the first time through the loop, since we know p0 < p1 then. | ||
| 7 | This also avoids a gcc -Wstrict-overflow warning. | ||
| 8 | |||
| 9 | * lisp.h (SAFE_ALLOCA, SAFE_ALLOCA_LISP): Avoid 'int' overflow | ||
| 10 | leading to a memory leak, possible in functions like | ||
| 11 | load_charset_map_from_file that can allocate an unbounded number | ||
| 12 | of objects (Bug#8318). | ||
| 13 | |||
| 14 | * xmenu.c (set_frame_menubar): Use EMACS_UINT, not int, for indexes | ||
| 15 | that could (at least in theory) be that large. | ||
| 16 | |||
| 17 | * xdisp.c (message_log_check_duplicate): Return unsigned long, not int. | ||
| 18 | This is less likely to overflow, and avoids undefined behavior if | ||
| 19 | overflow does occur. All callers changed. Use strtoul to scan | ||
| 20 | for the unsigned long integer. | ||
| 21 | (pint2hrstr): Simplify and tune code slightly. | ||
| 22 | This also avoids a (bogus) GCC warning with gcc -Wstrict-overflow. | ||
| 23 | |||
| 24 | * scroll.c (do_scrolling): Work around GCC bug 48228. | ||
| 25 | See <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48228>. | ||
| 26 | |||
| 27 | * frame.c (Fmodify_frame_parameters): Simplify loop counter. | ||
| 28 | This also avoids a warning with gcc -Wstrict-overflow. | ||
| 29 | (validate_x_resource_name): Simplify count usage. | ||
| 30 | This also avoids a warning with gcc -Wstrict-overflow. | ||
| 31 | |||
| 32 | * fileio.c (Fcopy_file): Report error if fchown or fchmod | ||
| 33 | fail (Bug#8306). | ||
| 34 | |||
| 35 | * emacs.c (Fdaemon_initialized): Do not ignore I/O errors (Bug#8303). | ||
| 36 | |||
| 37 | * process.c (Fmake_network_process): Use socklen_t, not int, | ||
| 38 | where POSIX says socklen_t is required in portable programs. | ||
| 39 | This fixes a porting bug on hosts like 64-bit HP-UX, where | ||
| 40 | socklen_t is wider than int (Bug#8277). | ||
| 41 | (Fmake_network_process, server_accept_connection): | ||
| 42 | (wait_reading_process_output, read_process_output): | ||
| 43 | Likewise. | ||
| 44 | |||
| 45 | * process.c: Rename or move locals to avoid shadowing. | ||
| 46 | (list_processes_1, Fmake_network_process): | ||
| 47 | (read_process_output_error_handler, exec_sentinel_error_handler): | ||
| 48 | Rename or move locals. | ||
| 49 | (Fmake_network_process): Define label "retry_connect" only if needed. | ||
| 50 | (Fnetwork_interface_info): Fix pointer signedness. | ||
| 51 | (process_send_signal): Add cast to avoid pointer signedness problem. | ||
| 52 | (FIRST_PROC_DESC, IF_NON_BLOCKING_CONNECT): Remove unused macros. | ||
| 53 | (create_process): Use 'volatile' to avoid vfork clobbering (Bug#8298). | ||
| 54 | |||
| 55 | Make tparam.h and terminfo.c consistent. | ||
| 56 | * cm.c (tputs, tgoto, BC, UP): Remove extern decls. Include | ||
| 57 | tparam.h instead, since it declares them. | ||
| 58 | * cm.h (PC): Remove extern decl; tparam.h now does this. | ||
| 59 | * deps.mk (cm.o, terminfo.o): Depend on tparam.h. | ||
| 60 | * terminfo.c: Include tparam.h, to check interfaces. | ||
| 61 | (tparm): Make 1st arg a const pointer in decl. Put it at top level. | ||
| 62 | (tparam): Adjust signature to match interface in tparam.h; | ||
| 63 | this removes some undefined behavior. Check that outstring and len | ||
| 64 | are zero, which they always are with Emacs. | ||
| 65 | * tparam.h (PC, BC, UP): New extern decls. | ||
| 66 | |||
| 67 | * xftfont.c (xftfont_shape): Now static, and defined only if needed. | ||
| 68 | (xftfont_open): Rename locals to avoid shadowing. | ||
| 69 | |||
| 70 | * ftfont.c (ftfont_resolve_generic_family): Fix pointer signedness. | ||
| 71 | (ftfont_otf_capability, ftfont_shape): Omit decls if not needed. | ||
| 72 | (OTF_TAG_SYM): Omit macro if not needed. | ||
| 73 | (ftfont_list): Remove unused local. | ||
| 74 | (get_adstyle_property, ftfont_pattern_entity): | ||
| 75 | (ftfont_lookup_cache, ftfont_open, ftfont_anchor_point): | ||
| 76 | Rename locals to avoid shadowing. | ||
| 77 | |||
| 78 | * xfont.c (xfont_list_family): Mark var as initialized. | ||
| 79 | |||
| 80 | * xml.c (make_dom): Now static. | ||
| 81 | |||
| 82 | * composite.c (composition_compute_stop_pos): Rename local to | ||
| 83 | avoid shadowing. | ||
| 84 | (composition_reseat_it): Remove unused locals. | ||
| 85 | (find_automatic_composition, composition_adjust_point): Likewise. | ||
| 86 | (composition_update_it): Mark var as initialized. | ||
| 87 | (find_automatic_composition): Mark vars as initialized, | ||
| 88 | with a FIXME (Bug#8290). | ||
| 89 | |||
| 90 | character.h: Rename locals to avoid shadowing. | ||
| 91 | * character.h (PREV_CHAR_BOUNDARY, FETCH_STRING_CHAR_ADVANCE): | ||
| 92 | (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE, FETCH_CHAR_ADVANCE): | ||
| 93 | (FETCH_CHAR_ADVANCE_NO_CHECK, INC_POS, DEC_POS, BUF_INC_POS): | ||
| 94 | (BUF_DEC_POS): Be more systematic about renaming local temporaries | ||
| 95 | to avoid shadowing. | ||
| 96 | |||
| 97 | * textprop.c (property_change_between_p): Remove; unused. | ||
| 98 | |||
| 99 | * intervals.c (interval_start_pos): Now static. | ||
| 100 | |||
| 101 | * intervals.h (CHECK_TOTAL_LENGTH): Avoid empty "else". | ||
| 102 | |||
| 103 | * atimer.c (start_atimer, append_atimer_lists, set_alarm): Rename | ||
| 104 | locals to avoid shadowing. | ||
| 105 | |||
| 106 | * sound.c (wav_play, au_play, Fplay_sound_internal): | ||
| 107 | Fix pointer signedness. | ||
| 108 | (alsa_choose_format): Remove unused local var. | ||
| 109 | (wav_play): Initialize a variable to 0, to prevent undefined | ||
| 110 | behavior (Bug#8278). | ||
| 111 | |||
| 112 | * region-cache.c (insert_cache_boundary): Redo var to avoid shadowing. | ||
| 113 | |||
| 114 | * region-cache.h (pp_cache): New decl, for gcc -Wmissing-prototypes. | ||
| 115 | |||
| 116 | * callproc.c (Fcall_process): Use 'volatile' to avoid vfork | ||
| 117 | clobbering (Bug#8298). | ||
| 118 | * sysdep.c (sys_subshell): Likewise. | ||
| 119 | Previously, the sys_subshell 'volatile' was incorrectly IF_LINTted out. | ||
| 120 | |||
| 121 | * lisp.h (child_setup): Now NO_RETURN unless DOS_NT. | ||
| 122 | This should get cleaned up, so that child_setup has the | ||
| 123 | same signature on all platforms. | ||
| 124 | |||
| 125 | * callproc.c (call_process_cleanup): Now static. | ||
| 126 | (relocate_fd): Rename locals to avoid shadowing. | ||
| 127 | |||
| 1 | 2011-03-22 Chong Yidong <cyd@stupidchicken.com> | 128 | 2011-03-22 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 129 | ||
| 3 | * xterm.c (x_clear_frame): Remove XClearWindow call. This appears | 130 | * xterm.c (x_clear_frame): Remove XClearWindow call. This appears |
diff --git a/src/atimer.c b/src/atimer.c index 309a4eaee4f..e10add961eb 100644 --- a/src/atimer.c +++ b/src/atimer.c | |||
| @@ -86,7 +86,7 @@ SIGTYPE alarm_signal_handler (int signo); | |||
| 86 | to cancel_atimer; don't free it yourself. */ | 86 | to cancel_atimer; don't free it yourself. */ |
| 87 | 87 | ||
| 88 | struct atimer * | 88 | struct atimer * |
| 89 | start_atimer (enum atimer_type type, EMACS_TIME time, atimer_callback fn, | 89 | start_atimer (enum atimer_type type, EMACS_TIME timestamp, atimer_callback fn, |
| 90 | void *client_data) | 90 | void *client_data) |
| 91 | { | 91 | { |
| 92 | struct atimer *t; | 92 | struct atimer *t; |
| @@ -94,10 +94,10 @@ start_atimer (enum atimer_type type, EMACS_TIME time, atimer_callback fn, | |||
| 94 | /* Round TIME up to the next full second if we don't have | 94 | /* Round TIME up to the next full second if we don't have |
| 95 | itimers. */ | 95 | itimers. */ |
| 96 | #ifndef HAVE_SETITIMER | 96 | #ifndef HAVE_SETITIMER |
| 97 | if (EMACS_USECS (time) != 0) | 97 | if (EMACS_USECS (timestamp) != 0) |
| 98 | { | 98 | { |
| 99 | EMACS_SET_USECS (time, 0); | 99 | EMACS_SET_USECS (timestamp, 0); |
| 100 | EMACS_SET_SECS (time, EMACS_SECS (time) + 1); | 100 | EMACS_SET_SECS (timestamp, EMACS_SECS (timestamp) + 1); |
| 101 | } | 101 | } |
| 102 | #endif /* not HAVE_SETITIMER */ | 102 | #endif /* not HAVE_SETITIMER */ |
| 103 | 103 | ||
| @@ -123,18 +123,18 @@ start_atimer (enum atimer_type type, EMACS_TIME time, atimer_callback fn, | |||
| 123 | switch (type) | 123 | switch (type) |
| 124 | { | 124 | { |
| 125 | case ATIMER_ABSOLUTE: | 125 | case ATIMER_ABSOLUTE: |
| 126 | t->expiration = time; | 126 | t->expiration = timestamp; |
| 127 | break; | 127 | break; |
| 128 | 128 | ||
| 129 | case ATIMER_RELATIVE: | 129 | case ATIMER_RELATIVE: |
| 130 | EMACS_GET_TIME (t->expiration); | 130 | EMACS_GET_TIME (t->expiration); |
| 131 | EMACS_ADD_TIME (t->expiration, t->expiration, time); | 131 | EMACS_ADD_TIME (t->expiration, t->expiration, timestamp); |
| 132 | break; | 132 | break; |
| 133 | 133 | ||
| 134 | case ATIMER_CONTINUOUS: | 134 | case ATIMER_CONTINUOUS: |
| 135 | EMACS_GET_TIME (t->expiration); | 135 | EMACS_GET_TIME (t->expiration); |
| 136 | EMACS_ADD_TIME (t->expiration, t->expiration, time); | 136 | EMACS_ADD_TIME (t->expiration, t->expiration, timestamp); |
| 137 | t->interval = time; | 137 | t->interval = timestamp; |
| 138 | break; | 138 | break; |
| 139 | } | 139 | } |
| 140 | 140 | ||
| @@ -187,24 +187,24 @@ cancel_atimer (struct atimer *timer) | |||
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | 189 | ||
| 190 | /* Append two lists of atimers LIST1 and LIST2 and return the | 190 | /* Append two lists of atimers LIST_1 and LIST_2 and return the |
| 191 | result list. */ | 191 | result list. */ |
| 192 | 192 | ||
| 193 | static struct atimer * | 193 | static struct atimer * |
| 194 | append_atimer_lists (struct atimer *list1, struct atimer *list2) | 194 | append_atimer_lists (struct atimer *list_1, struct atimer *list_2) |
| 195 | { | 195 | { |
| 196 | if (list1 == NULL) | 196 | if (list_1 == NULL) |
| 197 | return list2; | 197 | return list_2; |
| 198 | else if (list2 == NULL) | 198 | else if (list_2 == NULL) |
| 199 | return list1; | 199 | return list_1; |
| 200 | else | 200 | else |
| 201 | { | 201 | { |
| 202 | struct atimer *p; | 202 | struct atimer *p; |
| 203 | 203 | ||
| 204 | for (p = list1; p->next; p = p->next) | 204 | for (p = list_1; p->next; p = p->next) |
| 205 | ; | 205 | ; |
| 206 | p->next = list2; | 206 | p->next = list_2; |
| 207 | return list1; | 207 | return list_1; |
| 208 | } | 208 | } |
| 209 | } | 209 | } |
| 210 | 210 | ||
| @@ -287,28 +287,28 @@ set_alarm (void) | |||
| 287 | { | 287 | { |
| 288 | if (atimers) | 288 | if (atimers) |
| 289 | { | 289 | { |
| 290 | EMACS_TIME now, time; | 290 | EMACS_TIME now, timestamp; |
| 291 | #ifdef HAVE_SETITIMER | 291 | #ifdef HAVE_SETITIMER |
| 292 | struct itimerval it; | 292 | struct itimerval it; |
| 293 | #endif | 293 | #endif |
| 294 | 294 | ||
| 295 | /* Determine s/us till the next timer is ripe. */ | 295 | /* Determine s/us till the next timer is ripe. */ |
| 296 | EMACS_GET_TIME (now); | 296 | EMACS_GET_TIME (now); |
| 297 | EMACS_SUB_TIME (time, atimers->expiration, now); | 297 | EMACS_SUB_TIME (timestamp, atimers->expiration, now); |
| 298 | 298 | ||
| 299 | #ifdef HAVE_SETITIMER | 299 | #ifdef HAVE_SETITIMER |
| 300 | /* Don't set the interval to 0; this disables the timer. */ | 300 | /* Don't set the interval to 0; this disables the timer. */ |
| 301 | if (EMACS_TIME_LE (atimers->expiration, now)) | 301 | if (EMACS_TIME_LE (atimers->expiration, now)) |
| 302 | { | 302 | { |
| 303 | EMACS_SET_SECS (time, 0); | 303 | EMACS_SET_SECS (timestamp, 0); |
| 304 | EMACS_SET_USECS (time, 1000); | 304 | EMACS_SET_USECS (timestamp, 1000); |
| 305 | } | 305 | } |
| 306 | 306 | ||
| 307 | memset (&it, 0, sizeof it); | 307 | memset (&it, 0, sizeof it); |
| 308 | it.it_value = time; | 308 | it.it_value = timestamp; |
| 309 | setitimer (ITIMER_REAL, &it, 0); | 309 | setitimer (ITIMER_REAL, &it, 0); |
| 310 | #else /* not HAVE_SETITIMER */ | 310 | #else /* not HAVE_SETITIMER */ |
| 311 | alarm (max (EMACS_SECS (time), 1)); | 311 | alarm (max (EMACS_SECS (timestamp), 1)); |
| 312 | #endif /* not HAVE_SETITIMER */ | 312 | #endif /* not HAVE_SETITIMER */ |
| 313 | } | 313 | } |
| 314 | } | 314 | } |
| @@ -442,4 +442,3 @@ init_atimer (void) | |||
| 442 | /* pending_signals is initialized in init_keyboard.*/ | 442 | /* pending_signals is initialized in init_keyboard.*/ |
| 443 | signal (SIGALRM, alarm_signal_handler); | 443 | signal (SIGALRM, alarm_signal_handler); |
| 444 | } | 444 | } |
| 445 | |||
diff --git a/src/callproc.c b/src/callproc.c index c53a92bbaf8..75f239d1be2 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -107,7 +107,7 @@ call_process_kill (Lisp_Object fdpid) | |||
| 107 | return Qnil; | 107 | return Qnil; |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | Lisp_Object | 110 | static Lisp_Object |
| 111 | call_process_cleanup (Lisp_Object arg) | 111 | call_process_cleanup (Lisp_Object arg) |
| 112 | { | 112 | { |
| 113 | Lisp_Object fdpid = Fcdr (arg); | 113 | Lisp_Object fdpid = Fcdr (arg); |
| @@ -180,7 +180,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 180 | (int nargs, register Lisp_Object *args) | 180 | (int nargs, register Lisp_Object *args) |
| 181 | { | 181 | { |
| 182 | Lisp_Object infile, buffer, current_dir, path; | 182 | Lisp_Object infile, buffer, current_dir, path; |
| 183 | int display_p; | 183 | volatile int display_p_volatile; |
| 184 | int fd[2]; | 184 | int fd[2]; |
| 185 | int filefd; | 185 | int filefd; |
| 186 | register int pid; | 186 | register int pid; |
| @@ -190,6 +190,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 190 | int bufsize = CALLPROC_BUFFER_SIZE_MIN; | 190 | int bufsize = CALLPROC_BUFFER_SIZE_MIN; |
| 191 | int count = SPECPDL_INDEX (); | 191 | int count = SPECPDL_INDEX (); |
| 192 | 192 | ||
| 193 | const unsigned char **volatile new_argv_volatile; | ||
| 193 | register const unsigned char **new_argv; | 194 | register const unsigned char **new_argv; |
| 194 | /* File to use for stderr in the child. | 195 | /* File to use for stderr in the child. |
| 195 | t means use same as standard output. */ | 196 | t means use same as standard output. */ |
| @@ -343,7 +344,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 343 | UNGCPRO; | 344 | UNGCPRO; |
| 344 | } | 345 | } |
| 345 | 346 | ||
| 346 | display_p = INTERACTIVE && nargs >= 4 && !NILP (args[3]); | 347 | display_p_volatile = INTERACTIVE && nargs >= 4 && !NILP (args[3]); |
| 347 | 348 | ||
| 348 | filefd = emacs_open (SSDATA (infile), O_RDONLY, 0); | 349 | filefd = emacs_open (SSDATA (infile), O_RDONLY, 0); |
| 349 | if (filefd < 0) | 350 | if (filefd < 0) |
| @@ -371,7 +372,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 371 | && SREF (path, 1) == ':') | 372 | && SREF (path, 1) == ':') |
| 372 | path = Fsubstring (path, make_number (2), Qnil); | 373 | path = Fsubstring (path, make_number (2), Qnil); |
| 373 | 374 | ||
| 374 | new_argv = (const unsigned char **) | 375 | new_argv_volatile = new_argv = (const unsigned char **) |
| 375 | alloca (max (2, nargs - 2) * sizeof (char *)); | 376 | alloca (max (2, nargs - 2) * sizeof (char *)); |
| 376 | if (nargs > 4) | 377 | if (nargs > 4) |
| 377 | { | 378 | { |
| @@ -542,6 +543,8 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 542 | 543 | ||
| 543 | pid = vfork (); | 544 | pid = vfork (); |
| 544 | 545 | ||
| 546 | new_argv = new_argv_volatile; | ||
| 547 | |||
| 545 | if (pid == 0) | 548 | if (pid == 0) |
| 546 | { | 549 | { |
| 547 | if (fd[0] >= 0) | 550 | if (fd[0] >= 0) |
| @@ -673,6 +676,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 673 | int first = 1; | 676 | int first = 1; |
| 674 | EMACS_INT total_read = 0; | 677 | EMACS_INT total_read = 0; |
| 675 | int carryover = 0; | 678 | int carryover = 0; |
| 679 | int display_p = display_p_volatile; | ||
| 676 | int display_on_the_fly = display_p; | 680 | int display_on_the_fly = display_p; |
| 677 | struct coding_system saved_coding; | 681 | struct coding_system saved_coding; |
| 678 | 682 | ||
| @@ -1272,12 +1276,12 @@ relocate_fd (int fd, int minfd) | |||
| 1272 | #endif | 1276 | #endif |
| 1273 | if (new == -1) | 1277 | if (new == -1) |
| 1274 | { | 1278 | { |
| 1275 | const char *message1 = "Error while setting up child: "; | 1279 | const char *message_1 = "Error while setting up child: "; |
| 1276 | const char *errmessage = strerror (errno); | 1280 | const char *errmessage = strerror (errno); |
| 1277 | const char *message2 = "\n"; | 1281 | const char *message_2 = "\n"; |
| 1278 | emacs_write (2, message1, strlen (message1)); | 1282 | emacs_write (2, message_1, strlen (message_1)); |
| 1279 | emacs_write (2, errmessage, strlen (errmessage)); | 1283 | emacs_write (2, errmessage, strlen (errmessage)); |
| 1280 | emacs_write (2, message2, strlen (message2)); | 1284 | emacs_write (2, message_2, strlen (message_2)); |
| 1281 | _exit (1); | 1285 | _exit (1); |
| 1282 | } | 1286 | } |
| 1283 | emacs_close (fd); | 1287 | emacs_close (fd); |
diff --git a/src/character.h b/src/character.h index 4c468e14d2c..91020cadedc 100644 --- a/src/character.h +++ b/src/character.h | |||
| @@ -278,11 +278,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 278 | do { \ | 278 | do { \ |
| 279 | if ((p) > (limit)) \ | 279 | if ((p) > (limit)) \ |
| 280 | { \ | 280 | { \ |
| 281 | const unsigned char *pcb = (p); \ | 281 | const unsigned char *chp = (p); \ |
| 282 | do { \ | 282 | do { \ |
| 283 | pcb--; \ | 283 | chp--; \ |
| 284 | } while (pcb >= limit && ! CHAR_HEAD_P (*pcb)); \ | 284 | } while (chp >= limit && ! CHAR_HEAD_P (*chp)); \ |
| 285 | (p) = (BYTES_BY_CHAR_HEAD (*pcb) == (p) - pcb) ? pcb : (p) - 1; \ | 285 | (p) = (BYTES_BY_CHAR_HEAD (*chp) == (p) - chp) ? chp : (p) - 1; \ |
| 286 | } \ | 286 | } \ |
| 287 | } while (0) | 287 | } while (0) |
| 288 | 288 | ||
| @@ -353,11 +353,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 353 | CHARIDX++; \ | 353 | CHARIDX++; \ |
| 354 | if (STRING_MULTIBYTE (STRING)) \ | 354 | if (STRING_MULTIBYTE (STRING)) \ |
| 355 | { \ | 355 | { \ |
| 356 | unsigned char *string_ptr = &SDATA (STRING)[BYTEIDX]; \ | 356 | unsigned char *chp = &SDATA (STRING)[BYTEIDX]; \ |
| 357 | int string_len; \ | 357 | int chlen; \ |
| 358 | \ | 358 | \ |
| 359 | OUTPUT = STRING_CHAR_AND_LENGTH (string_ptr, string_len); \ | 359 | OUTPUT = STRING_CHAR_AND_LENGTH (chp, chlen); \ |
| 360 | BYTEIDX += string_len; \ | 360 | BYTEIDX += chlen; \ |
| 361 | } \ | 361 | } \ |
| 362 | else \ | 362 | else \ |
| 363 | { \ | 363 | { \ |
| @@ -376,11 +376,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 376 | CHARIDX++; \ | 376 | CHARIDX++; \ |
| 377 | if (STRING_MULTIBYTE (STRING)) \ | 377 | if (STRING_MULTIBYTE (STRING)) \ |
| 378 | { \ | 378 | { \ |
| 379 | unsigned char *ptr = &SDATA (STRING)[BYTEIDX]; \ | 379 | unsigned char *chp = &SDATA (STRING)[BYTEIDX]; \ |
| 380 | int ptrlen; \ | 380 | int chlen; \ |
| 381 | \ | 381 | \ |
| 382 | OUTPUT = STRING_CHAR_AND_LENGTH (ptr, ptrlen); \ | 382 | OUTPUT = STRING_CHAR_AND_LENGTH (chp, chlen); \ |
| 383 | BYTEIDX += ptrlen; \ | 383 | BYTEIDX += chlen; \ |
| 384 | } \ | 384 | } \ |
| 385 | else \ | 385 | else \ |
| 386 | { \ | 386 | { \ |
| @@ -416,11 +416,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 416 | CHARIDX++; \ | 416 | CHARIDX++; \ |
| 417 | if (!NILP (BVAR (current_buffer, enable_multibyte_characters))) \ | 417 | if (!NILP (BVAR (current_buffer, enable_multibyte_characters))) \ |
| 418 | { \ | 418 | { \ |
| 419 | unsigned char *ptr = BYTE_POS_ADDR (BYTEIDX); \ | 419 | unsigned char *chp = BYTE_POS_ADDR (BYTEIDX); \ |
| 420 | int string_len; \ | 420 | int chlen; \ |
| 421 | \ | 421 | \ |
| 422 | OUTPUT= STRING_CHAR_AND_LENGTH (ptr, string_len); \ | 422 | OUTPUT= STRING_CHAR_AND_LENGTH (chp, chlen); \ |
| 423 | BYTEIDX += string_len; \ | 423 | BYTEIDX += chlen; \ |
| 424 | } \ | 424 | } \ |
| 425 | else \ | 425 | else \ |
| 426 | { \ | 426 | { \ |
| @@ -436,11 +436,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 436 | #define FETCH_CHAR_ADVANCE_NO_CHECK(OUTPUT, CHARIDX, BYTEIDX) \ | 436 | #define FETCH_CHAR_ADVANCE_NO_CHECK(OUTPUT, CHARIDX, BYTEIDX) \ |
| 437 | do \ | 437 | do \ |
| 438 | { \ | 438 | { \ |
| 439 | unsigned char *ptr = BYTE_POS_ADDR (BYTEIDX); \ | 439 | unsigned char *chp = BYTE_POS_ADDR (BYTEIDX); \ |
| 440 | int len; \ | 440 | int chlen; \ |
| 441 | \ | 441 | \ |
| 442 | OUTPUT = STRING_CHAR_AND_LENGTH (ptr, len); \ | 442 | OUTPUT = STRING_CHAR_AND_LENGTH (chp, chlen); \ |
| 443 | BYTEIDX += len; \ | 443 | BYTEIDX += chlen; \ |
| 444 | CHARIDX++; \ | 444 | CHARIDX++; \ |
| 445 | } \ | 445 | } \ |
| 446 | while (0) | 446 | while (0) |
| @@ -451,8 +451,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 451 | 451 | ||
| 452 | #define INC_POS(pos_byte) \ | 452 | #define INC_POS(pos_byte) \ |
| 453 | do { \ | 453 | do { \ |
| 454 | unsigned char *ptr = BYTE_POS_ADDR (pos_byte); \ | 454 | unsigned char *chp = BYTE_POS_ADDR (pos_byte); \ |
| 455 | pos_byte += BYTES_BY_CHAR_HEAD (*ptr); \ | 455 | pos_byte += BYTES_BY_CHAR_HEAD (*chp); \ |
| 456 | } while (0) | 456 | } while (0) |
| 457 | 457 | ||
| 458 | 458 | ||
| @@ -461,16 +461,16 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 461 | 461 | ||
| 462 | #define DEC_POS(pos_byte) \ | 462 | #define DEC_POS(pos_byte) \ |
| 463 | do { \ | 463 | do { \ |
| 464 | unsigned char *ptr; \ | 464 | unsigned char *chp; \ |
| 465 | \ | 465 | \ |
| 466 | pos_byte--; \ | 466 | pos_byte--; \ |
| 467 | if (pos_byte < GPT_BYTE) \ | 467 | if (pos_byte < GPT_BYTE) \ |
| 468 | ptr = BEG_ADDR + pos_byte - BEG_BYTE; \ | 468 | chp = BEG_ADDR + pos_byte - BEG_BYTE; \ |
| 469 | else \ | 469 | else \ |
| 470 | ptr = BEG_ADDR + GAP_SIZE + pos_byte - BEG_BYTE; \ | 470 | chp = BEG_ADDR + GAP_SIZE + pos_byte - BEG_BYTE; \ |
| 471 | while (!CHAR_HEAD_P (*ptr)) \ | 471 | while (!CHAR_HEAD_P (*chp)) \ |
| 472 | { \ | 472 | { \ |
| 473 | ptr--; \ | 473 | chp--; \ |
| 474 | pos_byte--; \ | 474 | pos_byte--; \ |
| 475 | } \ | 475 | } \ |
| 476 | } while (0) | 476 | } while (0) |
| @@ -510,8 +510,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 510 | 510 | ||
| 511 | #define BUF_INC_POS(buf, pos_byte) \ | 511 | #define BUF_INC_POS(buf, pos_byte) \ |
| 512 | do { \ | 512 | do { \ |
| 513 | unsigned char *bbp = BUF_BYTE_ADDRESS (buf, pos_byte); \ | 513 | unsigned char *chp = BUF_BYTE_ADDRESS (buf, pos_byte); \ |
| 514 | pos_byte += BYTES_BY_CHAR_HEAD (*bbp); \ | 514 | pos_byte += BYTES_BY_CHAR_HEAD (*chp); \ |
| 515 | } while (0) | 515 | } while (0) |
| 516 | 516 | ||
| 517 | 517 | ||
| @@ -520,15 +520,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 520 | 520 | ||
| 521 | #define BUF_DEC_POS(buf, pos_byte) \ | 521 | #define BUF_DEC_POS(buf, pos_byte) \ |
| 522 | do { \ | 522 | do { \ |
| 523 | unsigned char *p; \ | 523 | unsigned char *chp; \ |
| 524 | pos_byte--; \ | 524 | pos_byte--; \ |
| 525 | if (pos_byte < BUF_GPT_BYTE (buf)) \ | 525 | if (pos_byte < BUF_GPT_BYTE (buf)) \ |
| 526 | p = BUF_BEG_ADDR (buf) + pos_byte - BEG_BYTE; \ | 526 | chp = BUF_BEG_ADDR (buf) + pos_byte - BEG_BYTE; \ |
| 527 | else \ | 527 | else \ |
| 528 | p = BUF_BEG_ADDR (buf) + BUF_GAP_SIZE (buf) + pos_byte - BEG_BYTE;\ | 528 | chp = BUF_BEG_ADDR (buf) + BUF_GAP_SIZE (buf) + pos_byte - BEG_BYTE;\ |
| 529 | while (!CHAR_HEAD_P (*p)) \ | 529 | while (!CHAR_HEAD_P (*chp)) \ |
| 530 | { \ | 530 | { \ |
| 531 | p--; \ | 531 | chp--; \ |
| 532 | pos_byte--; \ | 532 | pos_byte--; \ |
| 533 | } \ | 533 | } \ |
| 534 | } while (0) | 534 | } while (0) |
| @@ -27,19 +27,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 27 | #include "cm.h" | 27 | #include "cm.h" |
| 28 | #include "termhooks.h" | 28 | #include "termhooks.h" |
| 29 | #include "termchar.h" | 29 | #include "termchar.h" |
| 30 | 30 | #include "tparam.h" | |
| 31 | |||
| 32 | /* For now, don't try to include termcap.h. On some systems, | ||
| 33 | configure finds a non-standard termcap.h that the main build | ||
| 34 | won't find. */ | ||
| 35 | extern void tputs (const char *, int, int (*)(int)); | ||
| 36 | extern char *tgoto (const char *, int, int); | ||
| 37 | 31 | ||
| 38 | #define BIG 9999 /* 9999 good on VAXen. For 16 bit machines | 32 | #define BIG 9999 /* 9999 good on VAXen. For 16 bit machines |
| 39 | use about 2000.... */ | 33 | use about 2000.... */ |
| 40 | 34 | ||
| 41 | extern char *BC, *UP; | ||
| 42 | |||
| 43 | int cost; /* sums up costs */ | 35 | int cost; /* sums up costs */ |
| 44 | 36 | ||
| 45 | /* ARGSUSED */ | 37 | /* ARGSUSED */ |
| @@ -96,8 +96,6 @@ struct cm | |||
| 96 | int cc_vabs; | 96 | int cc_vabs; |
| 97 | }; | 97 | }; |
| 98 | 98 | ||
| 99 | extern char PC; /* Pad character */ | ||
| 100 | |||
| 101 | /* Shorthand */ | 99 | /* Shorthand */ |
| 102 | #ifndef NoCMShortHand | 100 | #ifndef NoCMShortHand |
| 103 | #define curY(tty) (tty)->Wcm->cm_curY | 101 | #define curY(tty) (tty)->Wcm->cm_curY |
diff --git a/src/coding.c b/src/coding.c index 0c2836c19f6..0596d16bf46 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -5266,11 +5266,12 @@ encode_coding_raw_text (struct coding_system *coding) | |||
| 5266 | unsigned char str[MAX_MULTIBYTE_LENGTH], *p0 = str, *p1 = str; | 5266 | unsigned char str[MAX_MULTIBYTE_LENGTH], *p0 = str, *p1 = str; |
| 5267 | 5267 | ||
| 5268 | CHAR_STRING_ADVANCE (c, p1); | 5268 | CHAR_STRING_ADVANCE (c, p1); |
| 5269 | while (p0 < p1) | 5269 | do |
| 5270 | { | 5270 | { |
| 5271 | EMIT_ONE_BYTE (*p0); | 5271 | EMIT_ONE_BYTE (*p0); |
| 5272 | p0++; | 5272 | p0++; |
| 5273 | } | 5273 | } |
| 5274 | while (p0 < p1); | ||
| 5274 | } | 5275 | } |
| 5275 | } | 5276 | } |
| 5276 | else | 5277 | else |
diff --git a/src/composite.c b/src/composite.c index 0b0602bf283..bc5644a4612 100644 --- a/src/composite.c +++ b/src/composite.c | |||
| @@ -1115,7 +1115,7 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos, | |||
| 1115 | if (! NILP (val)) | 1115 | if (! NILP (val)) |
| 1116 | { | 1116 | { |
| 1117 | Lisp_Object elt; | 1117 | Lisp_Object elt; |
| 1118 | int ridx, back, len; | 1118 | int ridx, back, blen; |
| 1119 | 1119 | ||
| 1120 | for (ridx = 0; CONSP (val); val = XCDR (val), ridx++) | 1120 | for (ridx = 0; CONSP (val); val = XCDR (val), ridx++) |
| 1121 | { | 1121 | { |
| @@ -1132,17 +1132,17 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos, | |||
| 1132 | bpos = (NILP (string) ? CHAR_TO_BYTE (cpos) | 1132 | bpos = (NILP (string) ? CHAR_TO_BYTE (cpos) |
| 1133 | : string_char_to_byte (string, cpos)); | 1133 | : string_char_to_byte (string, cpos)); |
| 1134 | if (STRINGP (AREF (elt, 0))) | 1134 | if (STRINGP (AREF (elt, 0))) |
| 1135 | len = fast_looking_at (AREF (elt, 0), cpos, bpos, | 1135 | blen = fast_looking_at (AREF (elt, 0), cpos, bpos, |
| 1136 | start + 1, limit, string); | 1136 | start + 1, limit, string); |
| 1137 | else | 1137 | else |
| 1138 | len = 1; | 1138 | blen = 1; |
| 1139 | if (len > 0) | 1139 | if (blen > 0) |
| 1140 | { | 1140 | { |
| 1141 | /* Make CPOS point to the last character of | 1141 | /* Make CPOS point to the last character of |
| 1142 | match. Note that LEN is byte-length. */ | 1142 | match. Note that BLEN is byte-length. */ |
| 1143 | if (len > 1) | 1143 | if (blen > 1) |
| 1144 | { | 1144 | { |
| 1145 | bpos += len; | 1145 | bpos += blen; |
| 1146 | if (NILP (string)) | 1146 | if (NILP (string)) |
| 1147 | cpos = BYTE_TO_CHAR (bpos) - 1; | 1147 | cpos = BYTE_TO_CHAR (bpos) - 1; |
| 1148 | else | 1148 | else |
| @@ -1248,8 +1248,8 @@ composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_I | |||
| 1248 | else if (w) | 1248 | else if (w) |
| 1249 | { | 1249 | { |
| 1250 | Lisp_Object lgstring = Qnil; | 1250 | Lisp_Object lgstring = Qnil; |
| 1251 | Lisp_Object val, elt, re; | 1251 | Lisp_Object val, elt; |
| 1252 | int len, i; | 1252 | int i; |
| 1253 | 1253 | ||
| 1254 | val = CHAR_TABLE_REF (Vcomposition_function_table, cmp_it->ch); | 1254 | val = CHAR_TABLE_REF (Vcomposition_function_table, cmp_it->ch); |
| 1255 | for (i = 0; i < cmp_it->rule_idx; i++, val = XCDR (val)); | 1255 | for (i = 0; i < cmp_it->rule_idx; i++, val = XCDR (val)); |
| @@ -1364,7 +1364,7 @@ composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_I | |||
| 1364 | int | 1364 | int |
| 1365 | composition_update_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_INT bytepos, Lisp_Object string) | 1365 | composition_update_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_INT bytepos, Lisp_Object string) |
| 1366 | { | 1366 | { |
| 1367 | int i, c; | 1367 | int i, c IF_LINT (= 0); |
| 1368 | 1368 | ||
| 1369 | if (cmp_it->ch < 0) | 1369 | if (cmp_it->ch < 0) |
| 1370 | { | 1370 | { |
| @@ -1489,9 +1489,14 @@ find_automatic_composition (EMACS_INT pos, EMACS_INT limit, EMACS_INT *start, EM | |||
| 1489 | EMACS_INT head, tail, stop; | 1489 | EMACS_INT head, tail, stop; |
| 1490 | /* Limit to check a composition after POS. */ | 1490 | /* Limit to check a composition after POS. */ |
| 1491 | EMACS_INT fore_check_limit; | 1491 | EMACS_INT fore_check_limit; |
| 1492 | struct position_record orig, cur, check, prev; | 1492 | struct position_record orig, cur; |
| 1493 | |||
| 1494 | /* FIXME: It's not obvious whether these two variables need initialization. | ||
| 1495 | If they do, please supply initial values. | ||
| 1496 | If not, please remove this comment. */ | ||
| 1497 | struct position_record check IF_LINT (= {0}), prev IF_LINT (= {0}); | ||
| 1498 | |||
| 1493 | Lisp_Object check_val, val, elt; | 1499 | Lisp_Object check_val, val, elt; |
| 1494 | int check_lookback; | ||
| 1495 | int c; | 1500 | int c; |
| 1496 | Lisp_Object window; | 1501 | Lisp_Object window; |
| 1497 | struct window *w; | 1502 | struct window *w; |
| @@ -1657,7 +1662,7 @@ find_automatic_composition (EMACS_INT pos, EMACS_INT limit, EMACS_INT *start, EM | |||
| 1657 | EMACS_INT | 1662 | EMACS_INT |
| 1658 | composition_adjust_point (EMACS_INT last_pt, EMACS_INT new_pt) | 1663 | composition_adjust_point (EMACS_INT last_pt, EMACS_INT new_pt) |
| 1659 | { | 1664 | { |
| 1660 | EMACS_INT charpos, bytepos, startpos, beg, end, pos; | 1665 | EMACS_INT beg, end; |
| 1661 | Lisp_Object val; | 1666 | Lisp_Object val; |
| 1662 | int i; | 1667 | int i; |
| 1663 | 1668 | ||
| @@ -2032,4 +2037,3 @@ See also the documentation of `auto-composition-mode'. */); | |||
| 2032 | defsubr (&Sfind_composition_internal); | 2037 | defsubr (&Sfind_composition_internal); |
| 2033 | defsubr (&Scomposition_get_gstring); | 2038 | defsubr (&Scomposition_get_gstring); |
| 2034 | } | 2039 | } |
| 2035 | |||
diff --git a/src/deps.mk b/src/deps.mk index 35754dfa7de..d84e80dca44 100644 --- a/src/deps.mk +++ b/src/deps.mk | |||
| @@ -65,7 +65,7 @@ coding.o: coding.c coding.h ccl.h buffer.h character.h charset.h composite.h \ | |||
| 65 | window.h dispextern.h msdos.h frame.h termhooks.h \ | 65 | window.h dispextern.h msdos.h frame.h termhooks.h \ |
| 66 | lisp.h globals.h $(config_h) | 66 | lisp.h globals.h $(config_h) |
| 67 | cm.o: cm.c frame.h cm.h termhooks.h termchar.h dispextern.h msdos.h \ | 67 | cm.o: cm.c frame.h cm.h termhooks.h termchar.h dispextern.h msdos.h \ |
| 68 | lisp.h globals.h $(config_h) | 68 | tparam.h lisp.h globals.h $(config_h) |
| 69 | cmds.o: cmds.c syntax.h buffer.h character.h commands.h window.h lisp.h \ | 69 | cmds.o: cmds.c syntax.h buffer.h character.h commands.h window.h lisp.h \ |
| 70 | globals.h $(config_h) msdos.h dispextern.h keyboard.h keymap.h systime.h \ | 70 | globals.h $(config_h) msdos.h dispextern.h keyboard.h keymap.h systime.h \ |
| 71 | coding.h frame.h composite.h | 71 | coding.h frame.h composite.h |
| @@ -196,7 +196,7 @@ termcap.o: termcap.c lisp.h tparam.h msdos.h $(config_h) | |||
| 196 | terminal.o: terminal.c frame.h termchar.h termhooks.h charset.h coding.h \ | 196 | terminal.o: terminal.c frame.h termchar.h termhooks.h charset.h coding.h \ |
| 197 | keyboard.h lisp.h globals.h $(config_h) dispextern.h composite.h systime.h \ | 197 | keyboard.h lisp.h globals.h $(config_h) dispextern.h composite.h systime.h \ |
| 198 | msdos.h | 198 | msdos.h |
| 199 | terminfo.o: terminfo.c lisp.h globals.h $(config_h) | 199 | terminfo.o: terminfo.c tparam.h lisp.h globals.h $(config_h) |
| 200 | tparam.o: tparam.c tparam.h lisp.h $(config_h) | 200 | tparam.o: tparam.c tparam.h lisp.h $(config_h) |
| 201 | undo.o: undo.c buffer.h commands.h window.h dispextern.h msdos.h \ | 201 | undo.o: undo.c buffer.h commands.h window.h dispextern.h msdos.h \ |
| 202 | lisp.h globals.h $(config_h) | 202 | lisp.h globals.h $(config_h) |
diff --git a/src/emacs.c b/src/emacs.c index 052f22ea622..bc7c07a9326 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -2312,6 +2312,7 @@ from the parent process and its tty file descriptors. */) | |||
| 2312 | (void) | 2312 | (void) |
| 2313 | { | 2313 | { |
| 2314 | int nfd; | 2314 | int nfd; |
| 2315 | int err = 0; | ||
| 2315 | 2316 | ||
| 2316 | if (!IS_DAEMON) | 2317 | if (!IS_DAEMON) |
| 2317 | error ("This function can only be called if emacs is run as a daemon"); | 2318 | error ("This function can only be called if emacs is run as a daemon"); |
| @@ -2324,10 +2325,11 @@ from the parent process and its tty file descriptors. */) | |||
| 2324 | 2325 | ||
| 2325 | /* Get rid of stdin, stdout and stderr. */ | 2326 | /* Get rid of stdin, stdout and stderr. */ |
| 2326 | nfd = open ("/dev/null", O_RDWR); | 2327 | nfd = open ("/dev/null", O_RDWR); |
| 2327 | dup2 (nfd, 0); | 2328 | err |= nfd < 0; |
| 2328 | dup2 (nfd, 1); | 2329 | err |= dup2 (nfd, 0) < 0; |
| 2329 | dup2 (nfd, 2); | 2330 | err |= dup2 (nfd, 1) < 0; |
| 2330 | close (nfd); | 2331 | err |= dup2 (nfd, 2) < 0; |
| 2332 | err |= close (nfd) != 0; | ||
| 2331 | 2333 | ||
| 2332 | /* Closing the pipe will notify the parent that it can exit. | 2334 | /* Closing the pipe will notify the parent that it can exit. |
| 2333 | FIXME: In case some other process inherited the pipe, closing it here | 2335 | FIXME: In case some other process inherited the pipe, closing it here |
| @@ -2336,10 +2338,13 @@ from the parent process and its tty file descriptors. */) | |||
| 2336 | Instead, we should probably close the pipe in start-process and | 2338 | Instead, we should probably close the pipe in start-process and |
| 2337 | call-process to make sure the pipe is never inherited by | 2339 | call-process to make sure the pipe is never inherited by |
| 2338 | subprocesses. */ | 2340 | subprocesses. */ |
| 2339 | write (daemon_pipe[1], "\n", 1); | 2341 | err |= write (daemon_pipe[1], "\n", 1) < 0; |
| 2340 | close (daemon_pipe[1]); | 2342 | err |= close (daemon_pipe[1]) != 0; |
| 2341 | /* Set it to an invalid value so we know we've already run this function. */ | 2343 | /* Set it to an invalid value so we know we've already run this function. */ |
| 2342 | daemon_pipe[1] = -1; | 2344 | daemon_pipe[1] = -1; |
| 2345 | |||
| 2346 | if (err) | ||
| 2347 | error ("I/O error during daemon initialization"); | ||
| 2343 | return Qt; | 2348 | return Qt; |
| 2344 | } | 2349 | } |
| 2345 | 2350 | ||
diff --git a/src/fileio.c b/src/fileio.c index 5d33fb93878..7d2f10d517c 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -1951,9 +1951,10 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */) | |||
| 1951 | owner and group. */ | 1951 | owner and group. */ |
| 1952 | if (input_file_statable_p) | 1952 | if (input_file_statable_p) |
| 1953 | { | 1953 | { |
| 1954 | if (! NILP (preserve_uid_gid)) | 1954 | if (!NILP (preserve_uid_gid) && fchown (ofd, st.st_uid, st.st_gid) != 0) |
| 1955 | fchown (ofd, st.st_uid, st.st_gid); | 1955 | report_file_error ("Doing chown", Fcons (newname, Qnil)); |
| 1956 | fchmod (ofd, st.st_mode & 07777); | 1956 | if (fchmod (ofd, st.st_mode & 07777) != 0) |
| 1957 | report_file_error ("Doing chmod", Fcons (newname, Qnil)); | ||
| 1957 | } | 1958 | } |
| 1958 | #endif /* not MSDOS */ | 1959 | #endif /* not MSDOS */ |
| 1959 | 1960 | ||
diff --git a/src/frame.c b/src/frame.c index 05938f3e1f0..3e00e1bf107 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -2529,7 +2529,7 @@ use is not recommended. Explicitly check for a frame-parameter instead. */) | |||
| 2529 | } | 2529 | } |
| 2530 | 2530 | ||
| 2531 | /* Now process them in reverse of specified order. */ | 2531 | /* Now process them in reverse of specified order. */ |
| 2532 | for (i--; i >= 0; i--) | 2532 | while (--i >= 0) |
| 2533 | { | 2533 | { |
| 2534 | prop = parms[i]; | 2534 | prop = parms[i]; |
| 2535 | val = values[i]; | 2535 | val = values[i]; |
| @@ -3713,8 +3713,7 @@ validate_x_resource_name (void) | |||
| 3713 | return; | 3713 | return; |
| 3714 | 3714 | ||
| 3715 | /* If name is entirely invalid, or nearly so, use `emacs'. */ | 3715 | /* If name is entirely invalid, or nearly so, use `emacs'. */ |
| 3716 | if (good_count == 0 | 3716 | if (good_count < 2) |
| 3717 | || (good_count == 1 && bad_count > 0)) | ||
| 3718 | { | 3717 | { |
| 3719 | Vx_resource_name = build_string ("emacs"); | 3718 | Vx_resource_name = build_string ("emacs"); |
| 3720 | return; | 3719 | return; |
diff --git a/src/ftfont.c b/src/ftfont.c index db6b29421dc..ad01149106e 100644 --- a/src/ftfont.c +++ b/src/ftfont.c | |||
| @@ -168,11 +168,11 @@ get_adstyle_property (FcPattern *p) | |||
| 168 | for (end = str; *end && *end != ' '; end++); | 168 | for (end = str; *end && *end != ' '; end++); |
| 169 | if (*end) | 169 | if (*end) |
| 170 | { | 170 | { |
| 171 | char *p = alloca (end - str + 1); | 171 | char *newstr = alloca (end - str + 1); |
| 172 | memcpy (p, str, end - str); | 172 | memcpy (newstr, str, end - str); |
| 173 | p[end - str] = '\0'; | 173 | newstr[end - str] = '\0'; |
| 174 | end = p + (end - str); | 174 | end = newstr + (end - str); |
| 175 | str = p; | 175 | str = newstr; |
| 176 | } | 176 | } |
| 177 | if (xstrcasecmp (str, "Regular") == 0 | 177 | if (xstrcasecmp (str, "Regular") == 0 |
| 178 | || xstrcasecmp (str, "Bold") == 0 | 178 | || xstrcasecmp (str, "Bold") == 0 |
| @@ -190,18 +190,18 @@ ftfont_pattern_entity (FcPattern *p, Lisp_Object extra) | |||
| 190 | { | 190 | { |
| 191 | Lisp_Object key, cache, entity; | 191 | Lisp_Object key, cache, entity; |
| 192 | char *file, *str; | 192 | char *file, *str; |
| 193 | int index; | 193 | int idx; |
| 194 | int numeric; | 194 | int numeric; |
| 195 | double dbl; | 195 | double dbl; |
| 196 | FcBool b; | 196 | FcBool b; |
| 197 | 197 | ||
| 198 | if (FcPatternGetString (p, FC_FILE, 0, (FcChar8 **) &file) != FcResultMatch) | 198 | if (FcPatternGetString (p, FC_FILE, 0, (FcChar8 **) &file) != FcResultMatch) |
| 199 | return Qnil; | 199 | return Qnil; |
| 200 | if (FcPatternGetInteger (p, FC_INDEX, 0, &index) != FcResultMatch) | 200 | if (FcPatternGetInteger (p, FC_INDEX, 0, &idx) != FcResultMatch) |
| 201 | return Qnil; | 201 | return Qnil; |
| 202 | 202 | ||
| 203 | key = Fcons (make_unibyte_string ((char *) file, strlen ((char *) file)), | 203 | key = Fcons (make_unibyte_string ((char *) file, strlen ((char *) file)), |
| 204 | make_number (index)); | 204 | make_number (idx)); |
| 205 | cache = ftfont_lookup_cache (key, FTFONT_CACHE_FOR_ENTITY); | 205 | cache = ftfont_lookup_cache (key, FTFONT_CACHE_FOR_ENTITY); |
| 206 | entity = XCAR (cache); | 206 | entity = XCAR (cache); |
| 207 | if (! NILP (entity)) | 207 | if (! NILP (entity)) |
| @@ -265,7 +265,7 @@ ftfont_pattern_entity (FcPattern *p, Lisp_Object extra) | |||
| 265 | 265 | ||
| 266 | ASET (entity, FONT_ADSTYLE_INDEX, get_adstyle_property (p)); | 266 | ASET (entity, FONT_ADSTYLE_INDEX, get_adstyle_property (p)); |
| 267 | if ((ft_library || FT_Init_FreeType (&ft_library) == 0) | 267 | if ((ft_library || FT_Init_FreeType (&ft_library) == 0) |
| 268 | && FT_New_Face (ft_library, file, index, &ft_face) == 0) | 268 | && FT_New_Face (ft_library, file, idx, &ft_face) == 0) |
| 269 | { | 269 | { |
| 270 | BDF_PropertyRec rec; | 270 | BDF_PropertyRec rec; |
| 271 | 271 | ||
| @@ -311,8 +311,9 @@ ftfont_resolve_generic_family (Lisp_Object family, FcPattern *pattern) | |||
| 311 | if (FcPatternGetLangSet (pattern, FC_LANG, 0, &langset) != FcResultMatch) | 311 | if (FcPatternGetLangSet (pattern, FC_LANG, 0, &langset) != FcResultMatch) |
| 312 | { | 312 | { |
| 313 | /* This is to avoid the effect of locale. */ | 313 | /* This is to avoid the effect of locale. */ |
| 314 | static const FcChar8 lang[] = "en"; | ||
| 314 | langset = FcLangSetCreate (); | 315 | langset = FcLangSetCreate (); |
| 315 | FcLangSetAdd (langset, "en"); | 316 | FcLangSetAdd (langset, lang); |
| 316 | FcPatternAddLangSet (pattern, FC_LANG, langset); | 317 | FcPatternAddLangSet (pattern, FC_LANG, langset); |
| 317 | FcLangSetDestroy (langset); | 318 | FcLangSetDestroy (langset); |
| 318 | } | 319 | } |
| @@ -393,14 +394,14 @@ ftfont_lookup_cache (Lisp_Object key, enum ftfont_cache_for cache_for) | |||
| 393 | ? ! cache_data->ft_face : ! cache_data->fc_charset) | 394 | ? ! cache_data->ft_face : ! cache_data->fc_charset) |
| 394 | { | 395 | { |
| 395 | char *filename = SSDATA (XCAR (key)); | 396 | char *filename = SSDATA (XCAR (key)); |
| 396 | int index = XINT (XCDR (key)); | 397 | int idx = XINT (XCDR (key)); |
| 397 | 398 | ||
| 398 | if (cache_for == FTFONT_CACHE_FOR_FACE) | 399 | if (cache_for == FTFONT_CACHE_FOR_FACE) |
| 399 | { | 400 | { |
| 400 | if (! ft_library | 401 | if (! ft_library |
| 401 | && FT_Init_FreeType (&ft_library) != 0) | 402 | && FT_Init_FreeType (&ft_library) != 0) |
| 402 | return Qnil; | 403 | return Qnil; |
| 403 | if (FT_New_Face (ft_library, filename, index, &cache_data->ft_face) | 404 | if (FT_New_Face (ft_library, filename, idx, &cache_data->ft_face) |
| 404 | != 0) | 405 | != 0) |
| 405 | return Qnil; | 406 | return Qnil; |
| 406 | } | 407 | } |
| @@ -412,7 +413,7 @@ ftfont_lookup_cache (Lisp_Object key, enum ftfont_cache_for cache_for) | |||
| 412 | FcCharSet *charset = NULL; | 413 | FcCharSet *charset = NULL; |
| 413 | 414 | ||
| 414 | pat = FcPatternBuild (0, FC_FILE, FcTypeString, (FcChar8 *) filename, | 415 | pat = FcPatternBuild (0, FC_FILE, FcTypeString, (FcChar8 *) filename, |
| 415 | FC_INDEX, FcTypeInteger, index, NULL); | 416 | FC_INDEX, FcTypeInteger, idx, NULL); |
| 416 | if (! pat) | 417 | if (! pat) |
| 417 | goto finish; | 418 | goto finish; |
| 418 | objset = FcObjectSetBuild (FC_CHARSET, FC_STYLE, NULL); | 419 | objset = FcObjectSetBuild (FC_CHARSET, FC_STYLE, NULL); |
| @@ -490,8 +491,12 @@ static int ftfont_get_bitmap (struct font *, unsigned, | |||
| 490 | struct font_bitmap *, int); | 491 | struct font_bitmap *, int); |
| 491 | static int ftfont_anchor_point (struct font *, unsigned, int, | 492 | static int ftfont_anchor_point (struct font *, unsigned, int, |
| 492 | int *, int *); | 493 | int *, int *); |
| 494 | #ifdef HAVE_LIBOTF | ||
| 493 | static Lisp_Object ftfont_otf_capability (struct font *); | 495 | static Lisp_Object ftfont_otf_capability (struct font *); |
| 496 | # ifdef HAVE_M17N_FLT | ||
| 494 | static Lisp_Object ftfont_shape (Lisp_Object); | 497 | static Lisp_Object ftfont_shape (Lisp_Object); |
| 498 | # endif | ||
| 499 | #endif | ||
| 495 | 500 | ||
| 496 | #ifdef HAVE_OTF_GET_VARIATION_GLYPHS | 501 | #ifdef HAVE_OTF_GET_VARIATION_GLYPHS |
| 497 | static int ftfont_variation_glyphs (struct font *, int c, | 502 | static int ftfont_variation_glyphs (struct font *, int c, |
| @@ -618,6 +623,7 @@ struct OpenTypeSpec | |||
| 618 | (P)[4] = '\0'; \ | 623 | (P)[4] = '\0'; \ |
| 619 | } while (0) | 624 | } while (0) |
| 620 | 625 | ||
| 626 | #ifdef HAVE_LIBOTF | ||
| 621 | #define OTF_TAG_SYM(SYM, TAG) \ | 627 | #define OTF_TAG_SYM(SYM, TAG) \ |
| 622 | do { \ | 628 | do { \ |
| 623 | char str[5]; \ | 629 | char str[5]; \ |
| @@ -625,6 +631,7 @@ struct OpenTypeSpec | |||
| 625 | OTF_TAG_STR (TAG, str); \ | 631 | OTF_TAG_STR (TAG, str); \ |
| 626 | (SYM) = font_intern_prop (str, 4, 1); \ | 632 | (SYM) = font_intern_prop (str, 4, 1); \ |
| 627 | } while (0) | 633 | } while (0) |
| 634 | #endif | ||
| 628 | 635 | ||
| 629 | 636 | ||
| 630 | static struct OpenTypeSpec * | 637 | static struct OpenTypeSpec * |
| @@ -864,7 +871,6 @@ ftfont_list (Lisp_Object frame, Lisp_Object spec) | |||
| 864 | FcObjectSet *objset = NULL; | 871 | FcObjectSet *objset = NULL; |
| 865 | FcCharSet *charset; | 872 | FcCharSet *charset; |
| 866 | Lisp_Object chars = Qnil; | 873 | Lisp_Object chars = Qnil; |
| 867 | FcResult result; | ||
| 868 | char otlayout[15]; /* For "otlayout:XXXX" */ | 874 | char otlayout[15]; /* For "otlayout:XXXX" */ |
| 869 | struct OpenTypeSpec *otspec = NULL; | 875 | struct OpenTypeSpec *otspec = NULL; |
| 870 | int spacing = -1; | 876 | int spacing = -1; |
| @@ -1153,7 +1159,7 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 1153 | FT_Face ft_face; | 1159 | FT_Face ft_face; |
| 1154 | FT_Size ft_size; | 1160 | FT_Size ft_size; |
| 1155 | FT_UInt size; | 1161 | FT_UInt size; |
| 1156 | Lisp_Object val, filename, index, cache, font_object; | 1162 | Lisp_Object val, filename, idx, cache, font_object; |
| 1157 | int scalable; | 1163 | int scalable; |
| 1158 | int spacing; | 1164 | int spacing; |
| 1159 | char name[256]; | 1165 | char name[256]; |
| @@ -1168,7 +1174,7 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 1168 | if (NILP (cache)) | 1174 | if (NILP (cache)) |
| 1169 | return Qnil; | 1175 | return Qnil; |
| 1170 | filename = XCAR (val); | 1176 | filename = XCAR (val); |
| 1171 | index = XCDR (val); | 1177 | idx = XCDR (val); |
| 1172 | val = XCDR (cache); | 1178 | val = XCDR (cache); |
| 1173 | cache_data = XSAVE_VALUE (XCDR (cache))->pointer; | 1179 | cache_data = XSAVE_VALUE (XCDR (cache))->pointer; |
| 1174 | ft_face = cache_data->ft_face; | 1180 | ft_face = cache_data->ft_face; |
| @@ -1210,7 +1216,7 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 1210 | font = XFONT_OBJECT (font_object); | 1216 | font = XFONT_OBJECT (font_object); |
| 1211 | ftfont_info = (struct ftfont_info *) font; | 1217 | ftfont_info = (struct ftfont_info *) font; |
| 1212 | ftfont_info->ft_size = ft_face->size; | 1218 | ftfont_info->ft_size = ft_face->size; |
| 1213 | ftfont_info->index = XINT (index); | 1219 | ftfont_info->index = XINT (idx); |
| 1214 | #ifdef HAVE_LIBOTF | 1220 | #ifdef HAVE_LIBOTF |
| 1215 | ftfont_info->maybe_otf = ft_face->face_flags & FT_FACE_FLAG_SFNT; | 1221 | ftfont_info->maybe_otf = ft_face->face_flags & FT_FACE_FLAG_SFNT; |
| 1216 | ftfont_info->otf = NULL; | 1222 | ftfont_info->otf = NULL; |
| @@ -1455,7 +1461,8 @@ ftfont_get_bitmap (struct font *font, unsigned int code, struct font_bitmap *bit | |||
| 1455 | } | 1461 | } |
| 1456 | 1462 | ||
| 1457 | static int | 1463 | static int |
| 1458 | ftfont_anchor_point (struct font *font, unsigned int code, int index, int *x, int *y) | 1464 | ftfont_anchor_point (struct font *font, unsigned int code, int idx, |
| 1465 | int *x, int *y) | ||
| 1459 | { | 1466 | { |
| 1460 | struct ftfont_info *ftfont_info = (struct ftfont_info *) font; | 1467 | struct ftfont_info *ftfont_info = (struct ftfont_info *) font; |
| 1461 | FT_Face ft_face = ftfont_info->ft_size->face; | 1468 | FT_Face ft_face = ftfont_info->ft_size->face; |
| @@ -1466,10 +1473,10 @@ ftfont_anchor_point (struct font *font, unsigned int code, int index, int *x, in | |||
| 1466 | return -1; | 1473 | return -1; |
| 1467 | if (ft_face->glyph->format != FT_GLYPH_FORMAT_OUTLINE) | 1474 | if (ft_face->glyph->format != FT_GLYPH_FORMAT_OUTLINE) |
| 1468 | return -1; | 1475 | return -1; |
| 1469 | if (index >= ft_face->glyph->outline.n_points) | 1476 | if (idx >= ft_face->glyph->outline.n_points) |
| 1470 | return -1; | 1477 | return -1; |
| 1471 | *x = ft_face->glyph->outline.points[index].x; | 1478 | *x = ft_face->glyph->outline.points[idx].x; |
| 1472 | *y = ft_face->glyph->outline.points[index].y; | 1479 | *y = ft_face->glyph->outline.points[idx].y; |
| 1473 | return 0; | 1480 | return 0; |
| 1474 | } | 1481 | } |
| 1475 | 1482 | ||
diff --git a/src/intervals.c b/src/intervals.c index 12b2789cc77..351677ad27e 100644 --- a/src/intervals.c +++ b/src/intervals.c | |||
| @@ -586,7 +586,7 @@ split_interval_left (INTERVAL interval, EMACS_INT offset) | |||
| 586 | Don't use this function on an interval which is the child | 586 | Don't use this function on an interval which is the child |
| 587 | of another interval! */ | 587 | of another interval! */ |
| 588 | 588 | ||
| 589 | int | 589 | static int |
| 590 | interval_start_pos (INTERVAL source) | 590 | interval_start_pos (INTERVAL source) |
| 591 | { | 591 | { |
| 592 | Lisp_Object parent; | 592 | Lisp_Object parent; |
| @@ -2559,4 +2559,3 @@ set_intervals_multibyte (int multi_flag) | |||
| 2559 | set_intervals_multibyte_1 (BUF_INTERVALS (current_buffer), multi_flag, | 2559 | set_intervals_multibyte_1 (BUF_INTERVALS (current_buffer), multi_flag, |
| 2560 | BEG, BEG_BYTE, Z, Z_BYTE); | 2560 | BEG, BEG_BYTE, Z, Z_BYTE); |
| 2561 | } | 2561 | } |
| 2562 | |||
diff --git a/src/intervals.h b/src/intervals.h index f6c1c002ce0..d7c34012e1f 100644 --- a/src/intervals.h +++ b/src/intervals.h | |||
| @@ -161,8 +161,13 @@ struct interval | |||
| 161 | (INTERVAL_HAS_PARENT (i) ? INTERVAL_PARENT (i) : 0) | 161 | (INTERVAL_HAS_PARENT (i) ? INTERVAL_PARENT (i) : 0) |
| 162 | 162 | ||
| 163 | /* Abort if interval I's size is negative. */ | 163 | /* Abort if interval I's size is negative. */ |
| 164 | #define CHECK_TOTAL_LENGTH(i) \ | 164 | #define CHECK_TOTAL_LENGTH(i) \ |
| 165 | if ((int) (i)->total_length < 0) abort (); else | 165 | do \ |
| 166 | { \ | ||
| 167 | if ((int) (i)->total_length < 0) \ | ||
| 168 | abort (); \ | ||
| 169 | } \ | ||
| 170 | while (0) | ||
| 166 | 171 | ||
| 167 | /* Reset this interval to its vanilla, or no-property state. */ | 172 | /* Reset this interval to its vanilla, or no-property state. */ |
| 168 | #define RESET_INTERVAL(i) \ | 173 | #define RESET_INTERVAL(i) \ |
| @@ -339,4 +344,3 @@ extern Lisp_Object get_pos_property (Lisp_Object pos, Lisp_Object prop, | |||
| 339 | extern void syms_of_textprop (void); | 344 | extern void syms_of_textprop (void); |
| 340 | 345 | ||
| 341 | #include "composite.h" | 346 | #include "composite.h" |
| 342 | |||
diff --git a/src/lisp.h b/src/lisp.h index 283b0989c1d..e98172ec104 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -3233,7 +3233,11 @@ extern void syms_of_process (void); | |||
| 3233 | extern void setup_process_coding_systems (Lisp_Object); | 3233 | extern void setup_process_coding_systems (Lisp_Object); |
| 3234 | 3234 | ||
| 3235 | EXFUN (Fcall_process, MANY); | 3235 | EXFUN (Fcall_process, MANY); |
| 3236 | extern int child_setup (int, int, int, char **, int, Lisp_Object); | 3236 | extern int child_setup (int, int, int, char **, int, Lisp_Object) |
| 3237 | #ifndef DOS_NT | ||
| 3238 | NO_RETURN | ||
| 3239 | #endif | ||
| 3240 | ; | ||
| 3237 | extern void init_callproc_1 (void); | 3241 | extern void init_callproc_1 (void); |
| 3238 | extern void init_callproc (void); | 3242 | extern void init_callproc (void); |
| 3239 | extern void set_initial_environment (void); | 3243 | extern void set_initial_environment (void); |
| @@ -3598,7 +3602,7 @@ extern Lisp_Object safe_alloca_unwind (Lisp_Object); | |||
| 3598 | else \ | 3602 | else \ |
| 3599 | { \ | 3603 | { \ |
| 3600 | buf = (type) xmalloc (size); \ | 3604 | buf = (type) xmalloc (size); \ |
| 3601 | sa_must_free++; \ | 3605 | sa_must_free = 1; \ |
| 3602 | record_unwind_protect (safe_alloca_unwind, \ | 3606 | record_unwind_protect (safe_alloca_unwind, \ |
| 3603 | make_save_value (buf, 0)); \ | 3607 | make_save_value (buf, 0)); \ |
| 3604 | } \ | 3608 | } \ |
| @@ -3628,7 +3632,7 @@ extern Lisp_Object safe_alloca_unwind (Lisp_Object); | |||
| 3628 | buf = (Lisp_Object *) xmalloc (size_); \ | 3632 | buf = (Lisp_Object *) xmalloc (size_); \ |
| 3629 | arg_ = make_save_value (buf, nelt); \ | 3633 | arg_ = make_save_value (buf, nelt); \ |
| 3630 | XSAVE_VALUE (arg_)->dogc = 1; \ | 3634 | XSAVE_VALUE (arg_)->dogc = 1; \ |
| 3631 | sa_must_free++; \ | 3635 | sa_must_free = 1; \ |
| 3632 | record_unwind_protect (safe_alloca_unwind, arg_); \ | 3636 | record_unwind_protect (safe_alloca_unwind, arg_); \ |
| 3633 | } \ | 3637 | } \ |
| 3634 | } while (0) | 3638 | } while (0) |
diff --git a/src/process.c b/src/process.c index c9b420ab2ae..4a7202388bf 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -159,9 +159,6 @@ extern Lisp_Object QCfilter; | |||
| 159 | #define SERIALCONN_P(p) (EQ (XPROCESS (p)->type, Qserial)) | 159 | #define SERIALCONN_P(p) (EQ (XPROCESS (p)->type, Qserial)) |
| 160 | #define SERIALCONN1_P(p) (EQ ((p)->type, Qserial)) | 160 | #define SERIALCONN1_P(p) (EQ ((p)->type, Qserial)) |
| 161 | 161 | ||
| 162 | /* Define first descriptor number available for subprocesses. */ | ||
| 163 | #define FIRST_PROC_DESC 3 | ||
| 164 | |||
| 165 | #ifndef HAVE_H_ERRNO | 162 | #ifndef HAVE_H_ERRNO |
| 166 | extern int h_errno; | 163 | extern int h_errno; |
| 167 | #endif | 164 | #endif |
| @@ -278,10 +275,6 @@ static SELECT_TYPE connect_wait_mask; | |||
| 278 | 275 | ||
| 279 | /* Number of bits set in connect_wait_mask. */ | 276 | /* Number of bits set in connect_wait_mask. */ |
| 280 | static int num_pending_connects; | 277 | static int num_pending_connects; |
| 281 | |||
| 282 | #define IF_NON_BLOCKING_CONNECT(s) s | ||
| 283 | #else /* NON_BLOCKING_CONNECT */ | ||
| 284 | #define IF_NON_BLOCKING_CONNECT(s) | ||
| 285 | #endif /* NON_BLOCKING_CONNECT */ | 278 | #endif /* NON_BLOCKING_CONNECT */ |
| 286 | 279 | ||
| 287 | /* The largest descriptor currently in use for a process object. */ | 280 | /* The largest descriptor currently in use for a process object. */ |
| @@ -1250,8 +1243,8 @@ Returns nil if format of ADDRESS is invalid. */) | |||
| 1250 | static Lisp_Object | 1243 | static Lisp_Object |
| 1251 | list_processes_1 (Lisp_Object query_only) | 1244 | list_processes_1 (Lisp_Object query_only) |
| 1252 | { | 1245 | { |
| 1253 | register Lisp_Object tail, tem; | 1246 | register Lisp_Object tail; |
| 1254 | Lisp_Object proc, minspace, tem1; | 1247 | Lisp_Object proc, minspace; |
| 1255 | register struct Lisp_Process *p; | 1248 | register struct Lisp_Process *p; |
| 1256 | char tembuf[300]; | 1249 | char tembuf[300]; |
| 1257 | int w_proc, w_buffer, w_tty; | 1250 | int w_proc, w_buffer, w_tty; |
| @@ -1453,10 +1446,10 @@ list_processes_1 (Lisp_Object query_only) | |||
| 1453 | } | 1446 | } |
| 1454 | else | 1447 | else |
| 1455 | { | 1448 | { |
| 1456 | tem = p->command; | 1449 | Lisp_Object tem = p->command; |
| 1457 | while (1) | 1450 | while (1) |
| 1458 | { | 1451 | { |
| 1459 | tem1 = Fcar (tem); | 1452 | Lisp_Object tem1 = Fcar (tem); |
| 1460 | if (NILP (tem1)) | 1453 | if (NILP (tem1)) |
| 1461 | break; | 1454 | break; |
| 1462 | Finsert (1, &tem1); | 1455 | Finsert (1, &tem1); |
| @@ -1919,8 +1912,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1919 | /* child_setup must clobber environ on systems with true vfork. | 1912 | /* child_setup must clobber environ on systems with true vfork. |
| 1920 | Protect it from permanent change. */ | 1913 | Protect it from permanent change. */ |
| 1921 | char **save_environ = environ; | 1914 | char **save_environ = environ; |
| 1922 | 1915 | volatile Lisp_Object encoded_current_dir = ENCODE_FILE (current_dir); | |
| 1923 | current_dir = ENCODE_FILE (current_dir); | ||
| 1924 | 1916 | ||
| 1925 | #ifndef WINDOWSNT | 1917 | #ifndef WINDOWSNT |
| 1926 | pid = vfork (); | 1918 | pid = vfork (); |
| @@ -2061,13 +2053,13 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 2061 | child_setup_tty (xforkout); | 2053 | child_setup_tty (xforkout); |
| 2062 | #ifdef WINDOWSNT | 2054 | #ifdef WINDOWSNT |
| 2063 | pid = child_setup (xforkin, xforkout, xforkout, | 2055 | pid = child_setup (xforkin, xforkout, xforkout, |
| 2064 | new_argv, 1, current_dir); | 2056 | new_argv, 1, encoded_current_dir); |
| 2065 | #else /* not WINDOWSNT */ | 2057 | #else /* not WINDOWSNT */ |
| 2066 | #ifdef FD_CLOEXEC | 2058 | #ifdef FD_CLOEXEC |
| 2067 | emacs_close (wait_child_setup[0]); | 2059 | emacs_close (wait_child_setup[0]); |
| 2068 | #endif | 2060 | #endif |
| 2069 | child_setup (xforkin, xforkout, xforkout, | 2061 | child_setup (xforkin, xforkout, xforkout, |
| 2070 | new_argv, 1, current_dir); | 2062 | new_argv, 1, encoded_current_dir); |
| 2071 | #endif /* not WINDOWSNT */ | 2063 | #endif /* not WINDOWSNT */ |
| 2072 | } | 2064 | } |
| 2073 | environ = save_environ; | 2065 | environ = save_environ; |
| @@ -3403,7 +3395,9 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3403 | { | 3395 | { |
| 3404 | int optn, optbits; | 3396 | int optn, optbits; |
| 3405 | 3397 | ||
| 3398 | #ifdef WINDOWSNT | ||
| 3406 | retry_connect: | 3399 | retry_connect: |
| 3400 | #endif | ||
| 3407 | 3401 | ||
| 3408 | s = socket (lres->ai_family, lres->ai_socktype, lres->ai_protocol); | 3402 | s = socket (lres->ai_family, lres->ai_socktype, lres->ai_protocol); |
| 3409 | if (s < 0) | 3403 | if (s < 0) |
| @@ -3467,7 +3461,7 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3467 | if (EQ (service, Qt)) | 3461 | if (EQ (service, Qt)) |
| 3468 | { | 3462 | { |
| 3469 | struct sockaddr_in sa1; | 3463 | struct sockaddr_in sa1; |
| 3470 | int len1 = sizeof (sa1); | 3464 | socklen_t len1 = sizeof (sa1); |
| 3471 | if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0) | 3465 | if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0) |
| 3472 | { | 3466 | { |
| 3473 | ((struct sockaddr_in *)(lres->ai_addr))->sin_port = sa1.sin_port; | 3467 | ((struct sockaddr_in *)(lres->ai_addr))->sin_port = sa1.sin_port; |
| @@ -3514,7 +3508,8 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3514 | /* Unlike most other syscalls connect() cannot be called | 3508 | /* Unlike most other syscalls connect() cannot be called |
| 3515 | again. (That would return EALREADY.) The proper way to | 3509 | again. (That would return EALREADY.) The proper way to |
| 3516 | wait for completion is select(). */ | 3510 | wait for completion is select(). */ |
| 3517 | int sc, len; | 3511 | int sc; |
| 3512 | socklen_t len; | ||
| 3518 | SELECT_TYPE fdset; | 3513 | SELECT_TYPE fdset; |
| 3519 | retry_select: | 3514 | retry_select: |
| 3520 | FD_ZERO (&fdset); | 3515 | FD_ZERO (&fdset); |
| @@ -3587,7 +3582,7 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3587 | if (!is_server) | 3582 | if (!is_server) |
| 3588 | { | 3583 | { |
| 3589 | struct sockaddr_in sa1; | 3584 | struct sockaddr_in sa1; |
| 3590 | int len1 = sizeof (sa1); | 3585 | socklen_t len1 = sizeof (sa1); |
| 3591 | if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0) | 3586 | if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0) |
| 3592 | contact = Fplist_put (contact, QClocal, | 3587 | contact = Fplist_put (contact, QClocal, |
| 3593 | conv_sockaddr_to_lisp ((struct sockaddr *)&sa1, len1)); | 3588 | conv_sockaddr_to_lisp ((struct sockaddr *)&sa1, len1)); |
| @@ -3705,10 +3700,10 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3705 | 3700 | ||
| 3706 | { | 3701 | { |
| 3707 | /* Setup coding systems for communicating with the network stream. */ | 3702 | /* Setup coding systems for communicating with the network stream. */ |
| 3708 | struct gcpro gcpro1; | 3703 | struct gcpro inner_gcpro1; |
| 3709 | /* Qt denotes we have not yet called Ffind_operation_coding_system. */ | 3704 | /* Qt denotes we have not yet called Ffind_operation_coding_system. */ |
| 3710 | Lisp_Object coding_systems = Qt; | 3705 | Lisp_Object coding_systems = Qt; |
| 3711 | Lisp_Object args[5], val; | 3706 | Lisp_Object fargs[5], val; |
| 3712 | 3707 | ||
| 3713 | if (!NILP (tem)) | 3708 | if (!NILP (tem)) |
| 3714 | { | 3709 | { |
| @@ -3731,11 +3726,11 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3731 | coding_systems = Qnil; | 3726 | coding_systems = Qnil; |
| 3732 | else | 3727 | else |
| 3733 | { | 3728 | { |
| 3734 | args[0] = Qopen_network_stream, args[1] = name, | 3729 | fargs[0] = Qopen_network_stream, fargs[1] = name, |
| 3735 | args[2] = buffer, args[3] = host, args[4] = service; | 3730 | fargs[2] = buffer, fargs[3] = host, fargs[4] = service; |
| 3736 | GCPRO1 (proc); | 3731 | GCPRO1_VAR (proc, inner_gcpro); |
| 3737 | coding_systems = Ffind_operation_coding_system (5, args); | 3732 | coding_systems = Ffind_operation_coding_system (5, fargs); |
| 3738 | UNGCPRO; | 3733 | UNGCPRO_VAR (inner_gcpro); |
| 3739 | } | 3734 | } |
| 3740 | if (CONSP (coding_systems)) | 3735 | if (CONSP (coding_systems)) |
| 3741 | val = XCAR (coding_systems); | 3736 | val = XCAR (coding_systems); |
| @@ -3764,11 +3759,11 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3764 | coding_systems = Qnil; | 3759 | coding_systems = Qnil; |
| 3765 | else | 3760 | else |
| 3766 | { | 3761 | { |
| 3767 | args[0] = Qopen_network_stream, args[1] = name, | 3762 | fargs[0] = Qopen_network_stream, fargs[1] = name, |
| 3768 | args[2] = buffer, args[3] = host, args[4] = service; | 3763 | fargs[2] = buffer, fargs[3] = host, fargs[4] = service; |
| 3769 | GCPRO1 (proc); | 3764 | GCPRO1_VAR (proc, inner_gcpro); |
| 3770 | coding_systems = Ffind_operation_coding_system (5, args); | 3765 | coding_systems = Ffind_operation_coding_system (5, fargs); |
| 3771 | UNGCPRO; | 3766 | UNGCPRO_VAR (inner_gcpro); |
| 3772 | } | 3767 | } |
| 3773 | } | 3768 | } |
| 3774 | if (CONSP (coding_systems)) | 3769 | if (CONSP (coding_systems)) |
| @@ -3948,7 +3943,7 @@ FLAGS is the current flags of the interface. */) | |||
| 3948 | CHECK_STRING (ifname); | 3943 | CHECK_STRING (ifname); |
| 3949 | 3944 | ||
| 3950 | memset (rq.ifr_name, 0, sizeof rq.ifr_name); | 3945 | memset (rq.ifr_name, 0, sizeof rq.ifr_name); |
| 3951 | strncpy (rq.ifr_name, SDATA (ifname), sizeof (rq.ifr_name)); | 3946 | strncpy (rq.ifr_name, SSDATA (ifname), sizeof (rq.ifr_name)); |
| 3952 | 3947 | ||
| 3953 | s = socket (AF_INET, SOCK_STREAM, 0); | 3948 | s = socket (AF_INET, SOCK_STREAM, 0); |
| 3954 | if (s < 0) | 3949 | if (s < 0) |
| @@ -4192,7 +4187,7 @@ server_accept_connection (Lisp_Object server, int channel) | |||
| 4192 | struct sockaddr_un un; | 4187 | struct sockaddr_un un; |
| 4193 | #endif | 4188 | #endif |
| 4194 | } saddr; | 4189 | } saddr; |
| 4195 | int len = sizeof saddr; | 4190 | socklen_t len = sizeof saddr; |
| 4196 | 4191 | ||
| 4197 | s = accept (channel, &saddr.sa, &len); | 4192 | s = accept (channel, &saddr.sa, &len); |
| 4198 | 4193 | ||
| @@ -4928,8 +4923,6 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd, | |||
| 4928 | d->func (channel, d->data, 0); | 4923 | d->func (channel, d->data, 0); |
| 4929 | } | 4924 | } |
| 4930 | 4925 | ||
| 4931 | /* Really FIRST_PROC_DESC should be 0 on Unix, | ||
| 4932 | but this is safer in the short run. */ | ||
| 4933 | for (channel = 0; channel <= max_process_desc; channel++) | 4926 | for (channel = 0; channel <= max_process_desc; channel++) |
| 4934 | { | 4927 | { |
| 4935 | if (FD_ISSET (channel, &Available) | 4928 | if (FD_ISSET (channel, &Available) |
| @@ -5059,7 +5052,7 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd, | |||
| 5059 | /* getsockopt(,,SO_ERROR,,) is said to hang on some systems. | 5052 | /* getsockopt(,,SO_ERROR,,) is said to hang on some systems. |
| 5060 | So only use it on systems where it is known to work. */ | 5053 | So only use it on systems where it is known to work. */ |
| 5061 | { | 5054 | { |
| 5062 | int xlen = sizeof (xerrno); | 5055 | socklen_t xlen = sizeof (xerrno); |
| 5063 | if (getsockopt (channel, SOL_SOCKET, SO_ERROR, &xerrno, &xlen)) | 5056 | if (getsockopt (channel, SOL_SOCKET, SO_ERROR, &xerrno, &xlen)) |
| 5064 | xerrno = errno; | 5057 | xerrno = errno; |
| 5065 | } | 5058 | } |
| @@ -5128,9 +5121,9 @@ read_process_output_call (Lisp_Object fun_and_args) | |||
| 5128 | } | 5121 | } |
| 5129 | 5122 | ||
| 5130 | static Lisp_Object | 5123 | static Lisp_Object |
| 5131 | read_process_output_error_handler (Lisp_Object error) | 5124 | read_process_output_error_handler (Lisp_Object error_val) |
| 5132 | { | 5125 | { |
| 5133 | cmd_error_internal (error, "error in process filter: "); | 5126 | cmd_error_internal (error_val, "error in process filter: "); |
| 5134 | Vinhibit_quit = Qt; | 5127 | Vinhibit_quit = Qt; |
| 5135 | update_echo_area (); | 5128 | update_echo_area (); |
| 5136 | Fsleep_for (make_number (2), Qnil); | 5129 | Fsleep_for (make_number (2), Qnil); |
| @@ -5171,7 +5164,7 @@ read_process_output (Lisp_Object proc, register int channel) | |||
| 5171 | /* We have a working select, so proc_buffered_char is always -1. */ | 5164 | /* We have a working select, so proc_buffered_char is always -1. */ |
| 5172 | if (DATAGRAM_CHAN_P (channel)) | 5165 | if (DATAGRAM_CHAN_P (channel)) |
| 5173 | { | 5166 | { |
| 5174 | int len = datagram_address[channel].len; | 5167 | socklen_t len = datagram_address[channel].len; |
| 5175 | nbytes = recvfrom (channel, chars + carryover, readmax, | 5168 | nbytes = recvfrom (channel, chars + carryover, readmax, |
| 5176 | 0, datagram_address[channel].sa, &len); | 5169 | 0, datagram_address[channel].sa, &len); |
| 5177 | } | 5170 | } |
| @@ -5925,7 +5918,7 @@ process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group, | |||
| 5925 | 5918 | ||
| 5926 | if (sig_char && *sig_char != CDISABLE) | 5919 | if (sig_char && *sig_char != CDISABLE) |
| 5927 | { | 5920 | { |
| 5928 | send_process (proc, sig_char, 1, Qnil); | 5921 | send_process (proc, (char *) sig_char, 1, Qnil); |
| 5929 | return; | 5922 | return; |
| 5930 | } | 5923 | } |
| 5931 | /* If we can't send the signal with a character, | 5924 | /* If we can't send the signal with a character, |
| @@ -6534,9 +6527,9 @@ exec_sentinel_unwind (Lisp_Object data) | |||
| 6534 | } | 6527 | } |
| 6535 | 6528 | ||
| 6536 | static Lisp_Object | 6529 | static Lisp_Object |
| 6537 | exec_sentinel_error_handler (Lisp_Object error) | 6530 | exec_sentinel_error_handler (Lisp_Object error_val) |
| 6538 | { | 6531 | { |
| 6539 | cmd_error_internal (error, "error in process sentinel: "); | 6532 | cmd_error_internal (error_val, "error in process sentinel: "); |
| 6540 | Vinhibit_quit = Qt; | 6533 | Vinhibit_quit = Qt; |
| 6541 | update_echo_area (); | 6534 | update_echo_area (); |
| 6542 | Fsleep_for (make_number (2), Qnil); | 6535 | Fsleep_for (make_number (2), Qnil); |
diff --git a/src/region-cache.c b/src/region-cache.c index 1f9b62da9fa..53ce0e9d802 100644 --- a/src/region-cache.c +++ b/src/region-cache.c | |||
| @@ -290,37 +290,37 @@ move_cache_gap (struct region_cache *c, EMACS_INT pos, EMACS_INT min_size) | |||
| 290 | } | 290 | } |
| 291 | 291 | ||
| 292 | 292 | ||
| 293 | /* Insert a new boundary in cache C; it will have cache index INDEX, | 293 | /* Insert a new boundary in cache C; it will have cache index I, |
| 294 | and have the specified POS and VALUE. */ | 294 | and have the specified POS and VALUE. */ |
| 295 | static void | 295 | static void |
| 296 | insert_cache_boundary (struct region_cache *c, EMACS_INT index, EMACS_INT pos, | 296 | insert_cache_boundary (struct region_cache *c, EMACS_INT i, EMACS_INT pos, |
| 297 | int value) | 297 | int value) |
| 298 | { | 298 | { |
| 299 | /* index must be a valid cache index. */ | 299 | /* i must be a valid cache index. */ |
| 300 | if (index < 0 || index > c->cache_len) | 300 | if (i < 0 || i > c->cache_len) |
| 301 | abort (); | 301 | abort (); |
| 302 | 302 | ||
| 303 | /* We must never want to insert something before the dummy first | 303 | /* We must never want to insert something before the dummy first |
| 304 | boundary. */ | 304 | boundary. */ |
| 305 | if (index == 0) | 305 | if (i == 0) |
| 306 | abort (); | 306 | abort (); |
| 307 | 307 | ||
| 308 | /* We must only be inserting things in order. */ | 308 | /* We must only be inserting things in order. */ |
| 309 | if (! (BOUNDARY_POS (c, index-1) < pos | 309 | if (! (BOUNDARY_POS (c, i - 1) < pos |
| 310 | && (index == c->cache_len | 310 | && (i == c->cache_len |
| 311 | || pos < BOUNDARY_POS (c, index)))) | 311 | || pos < BOUNDARY_POS (c, i)))) |
| 312 | abort (); | 312 | abort (); |
| 313 | 313 | ||
| 314 | /* The value must be different from the ones around it. However, we | 314 | /* The value must be different from the ones around it. However, we |
| 315 | temporarily create boundaries that establish the same value as | 315 | temporarily create boundaries that establish the same value as |
| 316 | the subsequent boundary, so we're not going to flag that case. */ | 316 | the subsequent boundary, so we're not going to flag that case. */ |
| 317 | if (BOUNDARY_VALUE (c, index-1) == value) | 317 | if (BOUNDARY_VALUE (c, i - 1) == value) |
| 318 | abort (); | 318 | abort (); |
| 319 | 319 | ||
| 320 | move_cache_gap (c, index, 1); | 320 | move_cache_gap (c, i, 1); |
| 321 | 321 | ||
| 322 | c->boundaries[index].pos = pos - c->buffer_beg; | 322 | c->boundaries[i].pos = pos - c->buffer_beg; |
| 323 | c->boundaries[index].value = value; | 323 | c->boundaries[i].value = value; |
| 324 | c->gap_start++; | 324 | c->gap_start++; |
| 325 | c->gap_len--; | 325 | c->gap_len--; |
| 326 | c->cache_len++; | 326 | c->cache_len++; |
| @@ -808,4 +808,3 @@ pp_cache (struct region_cache *c) | |||
| 808 | fprintf (stderr, "%ld : %d\n", (long)pos, BOUNDARY_VALUE (c, i)); | 808 | fprintf (stderr, "%ld : %d\n", (long)pos, BOUNDARY_VALUE (c, i)); |
| 809 | } | 809 | } |
| 810 | } | 810 | } |
| 811 | |||
diff --git a/src/region-cache.h b/src/region-cache.h index 0da159285e4..8e4336c2885 100644 --- a/src/region-cache.h +++ b/src/region-cache.h | |||
| @@ -111,3 +111,5 @@ extern int region_cache_backward (struct buffer *BUF, | |||
| 111 | EMACS_INT POS, | 111 | EMACS_INT POS, |
| 112 | EMACS_INT *NEXT); | 112 | EMACS_INT *NEXT); |
| 113 | 113 | ||
| 114 | /* For debugging. */ | ||
| 115 | void pp_cache (struct region_cache *); | ||
diff --git a/src/scroll.c b/src/scroll.c index 33af18d2090..f013ebbee0e 100644 --- a/src/scroll.c +++ b/src/scroll.c | |||
| @@ -245,8 +245,8 @@ do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix, struct m | |||
| 245 | int i, j, k; | 245 | int i, j, k; |
| 246 | 246 | ||
| 247 | /* Set to 1 if we have set a terminal window with | 247 | /* Set to 1 if we have set a terminal window with |
| 248 | set_terminal_window. */ | 248 | set_terminal_window. It's unsigned to work around GCC bug 48228. */ |
| 249 | int terminal_window_p = 0; | 249 | unsigned int terminal_window_p = 0; |
| 250 | 250 | ||
| 251 | /* A queue for line insertions to be done. */ | 251 | /* A queue for line insertions to be done. */ |
| 252 | struct queue { int count, pos; }; | 252 | struct queue { int count, pos; }; |
diff --git a/src/sound.c b/src/sound.c index 3a1668e4903..a2fe7ccc8ce 100644 --- a/src/sound.c +++ b/src/sound.c | |||
| @@ -595,12 +595,12 @@ wav_play (struct sound *s, struct sound_device *sd) | |||
| 595 | files I found so far. If someone feels inclined to implement the | 595 | files I found so far. If someone feels inclined to implement the |
| 596 | whole RIFF-WAVE spec, please do. */ | 596 | whole RIFF-WAVE spec, please do. */ |
| 597 | if (STRINGP (s->data)) | 597 | if (STRINGP (s->data)) |
| 598 | sd->write (sd, SDATA (s->data) + sizeof *header, | 598 | sd->write (sd, SSDATA (s->data) + sizeof *header, |
| 599 | SBYTES (s->data) - sizeof *header); | 599 | SBYTES (s->data) - sizeof *header); |
| 600 | else | 600 | else |
| 601 | { | 601 | { |
| 602 | char *buffer; | 602 | char *buffer; |
| 603 | int nbytes; | 603 | int nbytes = 0; |
| 604 | int blksize = sd->period_size ? sd->period_size (sd) : 2048; | 604 | int blksize = sd->period_size ? sd->period_size (sd) : 2048; |
| 605 | int data_left = header->data_length; | 605 | int data_left = header->data_length; |
| 606 | 606 | ||
| @@ -686,7 +686,7 @@ au_play (struct sound *s, struct sound_device *sd) | |||
| 686 | sd->configure (sd); | 686 | sd->configure (sd); |
| 687 | 687 | ||
| 688 | if (STRINGP (s->data)) | 688 | if (STRINGP (s->data)) |
| 689 | sd->write (sd, SDATA (s->data) + header->data_offset, | 689 | sd->write (sd, SSDATA (s->data) + header->data_offset, |
| 690 | SBYTES (s->data) - header->data_offset); | 690 | SBYTES (s->data) - header->data_offset); |
| 691 | else | 691 | else |
| 692 | { | 692 | { |
| @@ -1104,7 +1104,6 @@ alsa_close (struct sound_device *sd) | |||
| 1104 | static void | 1104 | static void |
| 1105 | alsa_choose_format (struct sound_device *sd, struct sound *s) | 1105 | alsa_choose_format (struct sound_device *sd, struct sound *s) |
| 1106 | { | 1106 | { |
| 1107 | struct alsa_params *p = (struct alsa_params *) sd->data; | ||
| 1108 | if (s->type == RIFF) | 1107 | if (s->type == RIFF) |
| 1109 | { | 1108 | { |
| 1110 | struct wav_header *h = (struct wav_header *) s->header; | 1109 | struct wav_header *h = (struct wav_header *) s->header; |
| @@ -1410,7 +1409,7 @@ Internal use only, use `play-sound' instead. */) | |||
| 1410 | { | 1409 | { |
| 1411 | int len = SCHARS (attrs[SOUND_DEVICE]); | 1410 | int len = SCHARS (attrs[SOUND_DEVICE]); |
| 1412 | current_sound_device->file = (char *) alloca (len + 1); | 1411 | current_sound_device->file = (char *) alloca (len + 1); |
| 1413 | strcpy (current_sound_device->file, SDATA (attrs[SOUND_DEVICE])); | 1412 | strcpy (current_sound_device->file, SSDATA (attrs[SOUND_DEVICE])); |
| 1414 | } | 1413 | } |
| 1415 | 1414 | ||
| 1416 | if (INTEGERP (attrs[SOUND_VOLUME])) | 1415 | if (INTEGERP (attrs[SOUND_VOLUME])) |
| @@ -1498,4 +1497,3 @@ init_sound (void) | |||
| 1498 | } | 1497 | } |
| 1499 | 1498 | ||
| 1500 | #endif /* HAVE_SOUND */ | 1499 | #endif /* HAVE_SOUND */ |
| 1501 | |||
diff --git a/src/sysdep.c b/src/sysdep.c index 6ef3d88c5c8..14db0fd26d0 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -488,7 +488,8 @@ sys_subshell (void) | |||
| 488 | int pid; | 488 | int pid; |
| 489 | struct save_signal saved_handlers[5]; | 489 | struct save_signal saved_handlers[5]; |
| 490 | Lisp_Object dir; | 490 | Lisp_Object dir; |
| 491 | unsigned char * IF_LINT (volatile) str = 0; | 491 | unsigned char *volatile str_volatile = 0; |
| 492 | unsigned char *str; | ||
| 492 | int len; | 493 | int len; |
| 493 | 494 | ||
| 494 | saved_handlers[0].code = SIGINT; | 495 | saved_handlers[0].code = SIGINT; |
| @@ -512,7 +513,7 @@ sys_subshell (void) | |||
| 512 | goto xyzzy; | 513 | goto xyzzy; |
| 513 | 514 | ||
| 514 | dir = expand_and_dir_to_file (Funhandled_file_name_directory (dir), Qnil); | 515 | dir = expand_and_dir_to_file (Funhandled_file_name_directory (dir), Qnil); |
| 515 | str = (unsigned char *) alloca (SCHARS (dir) + 2); | 516 | str_volatile = str = (unsigned char *) alloca (SCHARS (dir) + 2); |
| 516 | len = SCHARS (dir); | 517 | len = SCHARS (dir); |
| 517 | memcpy (str, SDATA (dir), len); | 518 | memcpy (str, SDATA (dir), len); |
| 518 | if (str[len - 1] != '/') str[len++] = '/'; | 519 | if (str[len - 1] != '/') str[len++] = '/'; |
| @@ -544,6 +545,7 @@ sys_subshell (void) | |||
| 544 | sh = "sh"; | 545 | sh = "sh"; |
| 545 | 546 | ||
| 546 | /* Use our buffer's default directory for the subshell. */ | 547 | /* Use our buffer's default directory for the subshell. */ |
| 548 | str = str_volatile; | ||
| 547 | if (str && chdir ((char *) str) != 0) | 549 | if (str && chdir ((char *) str) != 0) |
| 548 | { | 550 | { |
| 549 | #ifndef DOS_NT | 551 | #ifndef DOS_NT |
diff --git a/src/terminfo.c b/src/terminfo.c index 905a8edacc7..c0418984efa 100644 --- a/src/terminfo.c +++ b/src/terminfo.c | |||
| @@ -17,6 +17,8 @@ You should have received a copy of the GNU General Public License | |||
| 17 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | 17 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 18 | 18 | ||
| 19 | #include <config.h> | 19 | #include <config.h> |
| 20 | #include "tparam.h" | ||
| 21 | |||
| 20 | #include <setjmp.h> | 22 | #include <setjmp.h> |
| 21 | #include "lisp.h" | 23 | #include "lisp.h" |
| 22 | 24 | ||
| @@ -33,18 +35,19 @@ char *UP, *BC, PC; | |||
| 33 | format is different too. | 35 | format is different too. |
| 34 | */ | 36 | */ |
| 35 | 37 | ||
| 38 | extern char *tparm (const char *str, ...); | ||
| 39 | |||
| 40 | |||
| 36 | char * | 41 | char * |
| 37 | tparam (char *string, char *outstring, | 42 | tparam (const char *string, char *outstring, int len, |
| 38 | int len, int arg1, int arg2, int arg3, int arg4, | 43 | int arg1, int arg2, int arg3, int arg4) |
| 39 | int arg5, int arg6, int arg7, int arg8, int arg9) | ||
| 40 | { | 44 | { |
| 41 | char *temp; | 45 | char *temp; |
| 42 | extern char *tparm (char *str, ...); | ||
| 43 | 46 | ||
| 44 | temp = tparm (string, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); | 47 | /* Emacs always should pass a null OUTSTRING and zero LEN. */ |
| 45 | if (outstring == 0) | 48 | if (outstring || len) |
| 46 | outstring = ((char *) (xmalloc ((strlen (temp)) + 1))); | 49 | abort (); |
| 47 | strcpy (outstring, temp); | ||
| 48 | return outstring; | ||
| 49 | } | ||
| 50 | 50 | ||
| 51 | temp = tparm (string, arg1, arg2, arg3, arg4); | ||
| 52 | return xstrdup (temp); | ||
| 53 | } | ||
diff --git a/src/textprop.c b/src/textprop.c index 5db6033670b..cd89efeb38d 100644 --- a/src/textprop.c +++ b/src/textprop.c | |||
| @@ -974,37 +974,6 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */) | |||
| 974 | return make_number (next->position); | 974 | return make_number (next->position); |
| 975 | } | 975 | } |
| 976 | 976 | ||
| 977 | /* Return 1 if there's a change in some property between BEG and END. */ | ||
| 978 | |||
| 979 | int | ||
| 980 | property_change_between_p (EMACS_INT beg, EMACS_INT end) | ||
| 981 | { | ||
| 982 | register INTERVAL i, next; | ||
| 983 | Lisp_Object object, pos; | ||
| 984 | |||
| 985 | XSETBUFFER (object, current_buffer); | ||
| 986 | XSETFASTINT (pos, beg); | ||
| 987 | |||
| 988 | i = validate_interval_range (object, &pos, &pos, soft); | ||
| 989 | if (NULL_INTERVAL_P (i)) | ||
| 990 | return 0; | ||
| 991 | |||
| 992 | next = next_interval (i); | ||
| 993 | while (! NULL_INTERVAL_P (next) && intervals_equal (i, next)) | ||
| 994 | { | ||
| 995 | next = next_interval (next); | ||
| 996 | if (NULL_INTERVAL_P (next)) | ||
| 997 | return 0; | ||
| 998 | if (next->position >= end) | ||
| 999 | return 0; | ||
| 1000 | } | ||
| 1001 | |||
| 1002 | if (NULL_INTERVAL_P (next)) | ||
| 1003 | return 0; | ||
| 1004 | |||
| 1005 | return 1; | ||
| 1006 | } | ||
| 1007 | |||
| 1008 | DEFUN ("next-single-property-change", Fnext_single_property_change, | 977 | DEFUN ("next-single-property-change", Fnext_single_property_change, |
| 1009 | Snext_single_property_change, 2, 4, 0, | 978 | Snext_single_property_change, 2, 4, 0, |
| 1010 | doc: /* Return the position of next property change for a specific property. | 979 | doc: /* Return the position of next property change for a specific property. |
| @@ -2331,4 +2300,3 @@ inherits it if NONSTICKINESS is nil. The `front-sticky' and | |||
| 2331 | /* defsubr (&Serase_text_properties); */ | 2300 | /* defsubr (&Serase_text_properties); */ |
| 2332 | /* defsubr (&Scopy_text_properties); */ | 2301 | /* defsubr (&Scopy_text_properties); */ |
| 2333 | } | 2302 | } |
| 2334 | |||
diff --git a/src/tparam.h b/src/tparam.h index 3cd3e6053cc..dc4cdfaa28c 100644 --- a/src/tparam.h +++ b/src/tparam.h | |||
| @@ -29,3 +29,7 @@ char *tgetstr (const char *, char **); | |||
| 29 | char *tgoto (const char *, int, int); | 29 | char *tgoto (const char *, int, int); |
| 30 | 30 | ||
| 31 | char *tparam (const char *, char *, int, int, int, int, int); | 31 | char *tparam (const char *, char *, int, int, int, int, int); |
| 32 | |||
| 33 | extern char PC; | ||
| 34 | extern char *BC; | ||
| 35 | extern char *UP; | ||
diff --git a/src/xdisp.c b/src/xdisp.c index a7955f41e0c..457a5e3e11b 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -802,8 +802,8 @@ static int cursor_row_fully_visible_p (struct window *, int, int); | |||
| 802 | static int try_scrolling (Lisp_Object, int, EMACS_INT, EMACS_INT, int, int); | 802 | static int try_scrolling (Lisp_Object, int, EMACS_INT, EMACS_INT, int, int); |
| 803 | static int try_cursor_movement (Lisp_Object, struct text_pos, int *); | 803 | static int try_cursor_movement (Lisp_Object, struct text_pos, int *); |
| 804 | static int trailing_whitespace_p (EMACS_INT); | 804 | static int trailing_whitespace_p (EMACS_INT); |
| 805 | static int message_log_check_duplicate (EMACS_INT, EMACS_INT, | 805 | static unsigned long int message_log_check_duplicate (EMACS_INT, EMACS_INT, |
| 806 | EMACS_INT, EMACS_INT); | 806 | EMACS_INT, EMACS_INT); |
| 807 | static void push_it (struct it *); | 807 | static void push_it (struct it *); |
| 808 | static void pop_it (struct it *); | 808 | static void pop_it (struct it *); |
| 809 | static void sync_frame_with_window_matrix_rows (struct window *); | 809 | static void sync_frame_with_window_matrix_rows (struct window *); |
| @@ -7973,7 +7973,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte) | |||
| 7973 | if (nlflag) | 7973 | if (nlflag) |
| 7974 | { | 7974 | { |
| 7975 | EMACS_INT this_bol, this_bol_byte, prev_bol, prev_bol_byte; | 7975 | EMACS_INT this_bol, this_bol_byte, prev_bol, prev_bol_byte; |
| 7976 | int dups; | 7976 | unsigned long int dups; |
| 7977 | insert_1 ("\n", 1, 1, 0, 0); | 7977 | insert_1 ("\n", 1, 1, 0, 0); |
| 7978 | 7978 | ||
| 7979 | scan_newline (Z, Z_BYTE, BEG, BEG_BYTE, -2, 0); | 7979 | scan_newline (Z, Z_BYTE, BEG, BEG_BYTE, -2, 0); |
| @@ -8001,7 +8001,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte) | |||
| 8001 | 8001 | ||
| 8002 | /* If you change this format, don't forget to also | 8002 | /* If you change this format, don't forget to also |
| 8003 | change message_log_check_duplicate. */ | 8003 | change message_log_check_duplicate. */ |
| 8004 | sprintf (dupstr, " [%d times]", dups); | 8004 | sprintf (dupstr, " [%lu times]", dups); |
| 8005 | duplen = strlen (dupstr); | 8005 | duplen = strlen (dupstr); |
| 8006 | TEMP_SET_PT_BOTH (Z - 1, Z_BYTE - 1); | 8006 | TEMP_SET_PT_BOTH (Z - 1, Z_BYTE - 1); |
| 8007 | insert_1 (dupstr, duplen, 1, 0, 1); | 8007 | insert_1 (dupstr, duplen, 1, 0, 1); |
| @@ -8063,7 +8063,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte) | |||
| 8063 | Return 0 if different, 1 if the new one should just replace it, or a | 8063 | Return 0 if different, 1 if the new one should just replace it, or a |
| 8064 | value N > 1 if we should also append " [N times]". */ | 8064 | value N > 1 if we should also append " [N times]". */ |
| 8065 | 8065 | ||
| 8066 | static int | 8066 | static unsigned long int |
| 8067 | message_log_check_duplicate (EMACS_INT prev_bol, EMACS_INT prev_bol_byte, | 8067 | message_log_check_duplicate (EMACS_INT prev_bol, EMACS_INT prev_bol_byte, |
| 8068 | EMACS_INT this_bol, EMACS_INT this_bol_byte) | 8068 | EMACS_INT this_bol, EMACS_INT this_bol_byte) |
| 8069 | { | 8069 | { |
| @@ -8085,10 +8085,9 @@ message_log_check_duplicate (EMACS_INT prev_bol, EMACS_INT prev_bol_byte, | |||
| 8085 | return 2; | 8085 | return 2; |
| 8086 | if (*p1++ == ' ' && *p1++ == '[') | 8086 | if (*p1++ == ' ' && *p1++ == '[') |
| 8087 | { | 8087 | { |
| 8088 | int n = 0; | 8088 | char *pend; |
| 8089 | while (*p1 >= '0' && *p1 <= '9') | 8089 | unsigned long int n = strtoul ((char *) p1, &pend, 10); |
| 8090 | n = n * 10 + *p1++ - '0'; | 8090 | if (strncmp (pend, " times]\n", 8) == 0) |
| 8091 | if (strncmp ((char *) p1, " times]\n", 8) == 0) | ||
| 8092 | return n+1; | 8091 | return n+1; |
| 8093 | } | 8092 | } |
| 8094 | return 0; | 8093 | return 0; |
| @@ -19007,7 +19006,7 @@ pint2str (register char *buf, register int width, register EMACS_INT d) | |||
| 19007 | 19006 | ||
| 19008 | static const char power_letter[] = | 19007 | static const char power_letter[] = |
| 19009 | { | 19008 | { |
| 19010 | 0, /* not used */ | 19009 | 0, /* no letter */ |
| 19011 | 'k', /* kilo */ | 19010 | 'k', /* kilo */ |
| 19012 | 'M', /* mega */ | 19011 | 'M', /* mega */ |
| 19013 | 'G', /* giga */ | 19012 | 'G', /* giga */ |
| @@ -19089,8 +19088,7 @@ pint2hrstr (char *buf, int width, int d) | |||
| 19089 | p = psuffix = buf + max (width, length); | 19088 | p = psuffix = buf + max (width, length); |
| 19090 | 19089 | ||
| 19091 | /* Print EXPONENT. */ | 19090 | /* Print EXPONENT. */ |
| 19092 | if (exponent) | 19091 | *psuffix++ = power_letter[exponent]; |
| 19093 | *psuffix++ = power_letter[exponent]; | ||
| 19094 | *psuffix = '\0'; | 19092 | *psuffix = '\0'; |
| 19095 | 19093 | ||
| 19096 | /* Print TENTHS. */ | 19094 | /* Print TENTHS. */ |
diff --git a/src/xfont.c b/src/xfont.c index f8aace3663c..3e0fcd2cd75 100644 --- a/src/xfont.c +++ b/src/xfont.c | |||
| @@ -629,7 +629,7 @@ xfont_list_family (Lisp_Object frame) | |||
| 629 | char **names; | 629 | char **names; |
| 630 | int num_fonts, i; | 630 | int num_fonts, i; |
| 631 | Lisp_Object list; | 631 | Lisp_Object list; |
| 632 | char *last_family; | 632 | char *last_family IF_LINT (= 0); |
| 633 | int last_len; | 633 | int last_len; |
| 634 | 634 | ||
| 635 | BLOCK_INPUT; | 635 | BLOCK_INPUT; |
diff --git a/src/xftfont.c b/src/xftfont.c index 695527c4236..c27a4fcf91a 100644 --- a/src/xftfont.c +++ b/src/xftfont.c | |||
| @@ -280,7 +280,7 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 280 | { | 280 | { |
| 281 | FcResult result; | 281 | FcResult result; |
| 282 | Display *display = FRAME_X_DISPLAY (f); | 282 | Display *display = FRAME_X_DISPLAY (f); |
| 283 | Lisp_Object val, filename, index, font_object; | 283 | Lisp_Object val, filename, idx, font_object; |
| 284 | FcPattern *pat = NULL, *match; | 284 | FcPattern *pat = NULL, *match; |
| 285 | struct xftfont_info *xftfont_info = NULL; | 285 | struct xftfont_info *xftfont_info = NULL; |
| 286 | struct font *font; | 286 | struct font *font; |
| @@ -298,7 +298,7 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 298 | return Qnil; | 298 | return Qnil; |
| 299 | val = XCDR (val); | 299 | val = XCDR (val); |
| 300 | filename = XCAR (val); | 300 | filename = XCAR (val); |
| 301 | index = XCDR (val); | 301 | idx = XCDR (val); |
| 302 | size = XINT (AREF (entity, FONT_SIZE_INDEX)); | 302 | size = XINT (AREF (entity, FONT_SIZE_INDEX)); |
| 303 | if (size == 0) | 303 | if (size == 0) |
| 304 | size = pixel_size; | 304 | size = pixel_size; |
| @@ -335,7 +335,7 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 335 | xftfont_add_rendering_parameters (pat, entity); | 335 | xftfont_add_rendering_parameters (pat, entity); |
| 336 | 336 | ||
| 337 | FcPatternAddString (pat, FC_FILE, (FcChar8 *) SDATA (filename)); | 337 | FcPatternAddString (pat, FC_FILE, (FcChar8 *) SDATA (filename)); |
| 338 | FcPatternAddInteger (pat, FC_INDEX, XINT (index)); | 338 | FcPatternAddInteger (pat, FC_INDEX, XINT (idx)); |
| 339 | 339 | ||
| 340 | 340 | ||
| 341 | BLOCK_INPUT; | 341 | BLOCK_INPUT; |
| @@ -409,9 +409,9 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 409 | spacing = FC_PROPORTIONAL; | 409 | spacing = FC_PROPORTIONAL; |
| 410 | if (! ascii_printable[0]) | 410 | if (! ascii_printable[0]) |
| 411 | { | 411 | { |
| 412 | int i; | 412 | int ch; |
| 413 | for (i = 0; i < 95; i++) | 413 | for (ch = 0; ch < 95; ch++) |
| 414 | ascii_printable[i] = ' ' + i; | 414 | ascii_printable[ch] = ' ' + ch; |
| 415 | } | 415 | } |
| 416 | BLOCK_INPUT; | 416 | BLOCK_INPUT; |
| 417 | if (spacing != FC_PROPORTIONAL | 417 | if (spacing != FC_PROPORTIONAL |
| @@ -672,7 +672,8 @@ xftfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_b | |||
| 672 | return len; | 672 | return len; |
| 673 | } | 673 | } |
| 674 | 674 | ||
| 675 | Lisp_Object | 675 | #if defined HAVE_M17N_FLT && defined HAVE_LIBOTF |
| 676 | static Lisp_Object | ||
| 676 | xftfont_shape (Lisp_Object lgstring) | 677 | xftfont_shape (Lisp_Object lgstring) |
| 677 | { | 678 | { |
| 678 | struct font *font; | 679 | struct font *font; |
| @@ -688,6 +689,7 @@ xftfont_shape (Lisp_Object lgstring) | |||
| 688 | XftUnlockFace (xftfont_info->xftfont); | 689 | XftUnlockFace (xftfont_info->xftfont); |
| 689 | return val; | 690 | return val; |
| 690 | } | 691 | } |
| 692 | #endif | ||
| 691 | 693 | ||
| 692 | static int | 694 | static int |
| 693 | xftfont_end_for_frame (FRAME_PTR f) | 695 | xftfont_end_for_frame (FRAME_PTR f) |
diff --git a/src/xmenu.c b/src/xmenu.c index eab7bb03f20..60ac27a5b8f 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -922,7 +922,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) | |||
| 922 | #endif | 922 | #endif |
| 923 | Lisp_Object items; | 923 | Lisp_Object items; |
| 924 | widget_value *wv, *first_wv, *prev_wv = 0; | 924 | widget_value *wv, *first_wv, *prev_wv = 0; |
| 925 | int i, last_i = 0; | 925 | EMACS_UINT i, last_i = 0; |
| 926 | int *submenu_start, *submenu_end; | 926 | int *submenu_start, *submenu_end; |
| 927 | int *submenu_top_level_items, *submenu_n_panes; | 927 | int *submenu_top_level_items, *submenu_n_panes; |
| 928 | 928 | ||
| @@ -28,7 +28,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 28 | #include "lisp.h" | 28 | #include "lisp.h" |
| 29 | #include "buffer.h" | 29 | #include "buffer.h" |
| 30 | 30 | ||
| 31 | Lisp_Object make_dom (xmlNode *node) | 31 | static Lisp_Object |
| 32 | make_dom (xmlNode *node) | ||
| 32 | { | 33 | { |
| 33 | if (node->type == XML_ELEMENT_NODE) | 34 | if (node->type == XML_ELEMENT_NODE) |
| 34 | { | 35 | { |