diff options
| author | Paul Eggert | 2013-10-16 23:42:21 -0700 |
|---|---|---|
| committer | Paul Eggert | 2013-10-16 23:42:21 -0700 |
| commit | 3d798ba7dbad4bac02226959cfd82099bf11fd9f (patch) | |
| tree | a498f5f85e4b65a4e6b20b470834a304ee127d9e /src | |
| parent | 921c1d62980fe93d4c26d6aeae0ef2a81a752b11 (diff) | |
| download | emacs-3d798ba7dbad4bac02226959cfd82099bf11fd9f.tar.gz emacs-3d798ba7dbad4bac02226959cfd82099bf11fd9f.zip | |
Make some functions static in non-Microsoft builds.
On my platform (Fedora 19 x86-64), this shrinks the
Emacs executable (text+data) by 0.25%.
* dispextern.h (erase_phys_cursor) [!WINDOWSNT]:
(load_color) [!MSDOS]:
* gnutls.h (emacs_gnutls_transport_set_errno) [!WINDOWSNT]:
* keyboard.h (make_ctrl_char) [!WINDOWSNT]:
* lisp.h (check_existing):
* process.h (conv_sockaddr_to_lisp, network_interface_list)
(network_interface_info) [!WINDOWSNT]:
* termhooks.h (encode_terminal_code) [!WINDOWSNT]:
Remove extern decls.
* fileio.c (check_existing):
* keyboard.c (make_ctrl_char) [!WINDOWSNT]:
* process.c (conv_sockaddr_to_lisp, network_interface_list)
(network_interface_info) [!WINDOWSNT]:
* term.c (encode_terminal_code) [!WINDOWSNT]:
* xdisp.c (erase_phys_cursor) [!WINDOWSNT]:
* xfaces.c (load_color) [!MSDOS]:
Now static.
* fileio.c (check_existing, check_executable, check_writable):
* process.c (network_interface_list, network_interface_info):
Move earlier, so that we don't need forward decls.
* gnutls.c (fn_gnutls_transport_set_errno)
(emacs_gnutls_transport_set_errno) [!WINDOWNT]:
Remove; unused.
* w32.c (init_environment): Use faccessat rather than
check_existing, partly for consistency with the rest of the code
in this file, partly so that check_existing can be static.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 30 | ||||
| -rw-r--r-- | src/dispextern.h | 4 | ||||
| -rw-r--r-- | src/fileio.c | 103 | ||||
| -rw-r--r-- | src/gnutls.c | 4 | ||||
| -rw-r--r-- | src/gnutls.h | 2 | ||||
| -rw-r--r-- | src/keyboard.c | 3 | ||||
| -rw-r--r-- | src/keyboard.h | 2 | ||||
| -rw-r--r-- | src/lisp.h | 1 | ||||
| -rw-r--r-- | src/process.c | 81 | ||||
| -rw-r--r-- | src/process.h | 5 | ||||
| -rw-r--r-- | src/term.c | 6 | ||||
| -rw-r--r-- | src/termhooks.h | 2 | ||||
| -rw-r--r-- | src/w32.c | 5 | ||||
| -rw-r--r-- | src/xdisp.c | 6 | ||||
| -rw-r--r-- | src/xfaces.c | 3 |
15 files changed, 163 insertions, 94 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index f95ee3384bf..a0df4425844 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,35 @@ | |||
| 1 | 2013-10-17 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2013-10-17 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | Make some functions static in non-Microsoft builds. | ||
| 4 | On my platform (Fedora 19 x86-64), this shrinks the | ||
| 5 | Emacs executable (text+data) by 0.25%. | ||
| 6 | * dispextern.h (erase_phys_cursor) [!WINDOWSNT]: | ||
| 7 | (load_color) [!MSDOS]: | ||
| 8 | * gnutls.h (emacs_gnutls_transport_set_errno) [!WINDOWSNT]: | ||
| 9 | * keyboard.h (make_ctrl_char) [!WINDOWSNT]: | ||
| 10 | * lisp.h (check_existing): | ||
| 11 | * process.h (conv_sockaddr_to_lisp, network_interface_list) | ||
| 12 | (network_interface_info) [!WINDOWSNT]: | ||
| 13 | * termhooks.h (encode_terminal_code) [!WINDOWSNT]: | ||
| 14 | Remove extern decls. | ||
| 15 | * fileio.c (check_existing): | ||
| 16 | * keyboard.c (make_ctrl_char) [!WINDOWSNT]: | ||
| 17 | * process.c (conv_sockaddr_to_lisp, network_interface_list) | ||
| 18 | (network_interface_info) [!WINDOWSNT]: | ||
| 19 | * term.c (encode_terminal_code) [!WINDOWSNT]: | ||
| 20 | * xdisp.c (erase_phys_cursor) [!WINDOWSNT]: | ||
| 21 | * xfaces.c (load_color) [!MSDOS]: | ||
| 22 | Now static. | ||
| 23 | * fileio.c (check_existing, check_executable, check_writable): | ||
| 24 | * process.c (network_interface_list, network_interface_info): | ||
| 25 | Move earlier, so that we don't need forward decls. | ||
| 26 | * gnutls.c (fn_gnutls_transport_set_errno) | ||
| 27 | (emacs_gnutls_transport_set_errno) [!WINDOWNT]: | ||
| 28 | Remove; unused. | ||
| 29 | * w32.c (init_environment): Use faccessat rather than | ||
| 30 | check_existing, partly for consistency with the rest of the code | ||
| 31 | in this file, partly so that check_existing can be static. | ||
| 32 | |||
| 3 | Make VALMASK visible to GDB even if clang is used (Bug#15574). | 33 | Make VALMASK visible to GDB even if clang is used (Bug#15574). |
| 4 | * emacs.c (MAIN_PROGRAM): New macro. | 34 | * emacs.c (MAIN_PROGRAM): New macro. |
| 5 | * lisp.h (DEFINE_GDB_SYMBOL_BEGIN, DEFINE_GDB_SYMBOL_END): New macros. | 35 | * lisp.h (DEFINE_GDB_SYMBOL_BEGIN, DEFINE_GDB_SYMBOL_END): New macros. |
diff --git a/src/dispextern.h b/src/dispextern.h index 2d09fe7c5fe..681eba25cb3 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -3229,7 +3229,9 @@ extern void draw_phys_cursor_glyph (struct window *, | |||
| 3229 | enum draw_glyphs_face); | 3229 | enum draw_glyphs_face); |
| 3230 | extern void get_phys_cursor_geometry (struct window *, struct glyph_row *, | 3230 | extern void get_phys_cursor_geometry (struct window *, struct glyph_row *, |
| 3231 | struct glyph *, int *, int *, int *); | 3231 | struct glyph *, int *, int *, int *); |
| 3232 | #ifdef WINDOWSNT | ||
| 3232 | extern void erase_phys_cursor (struct window *); | 3233 | extern void erase_phys_cursor (struct window *); |
| 3234 | #endif | ||
| 3233 | extern void display_and_set_cursor (struct window *, bool, int, int, int, int); | 3235 | extern void display_and_set_cursor (struct window *, bool, int, int, int, int); |
| 3234 | extern void x_update_cursor (struct frame *, bool); | 3236 | extern void x_update_cursor (struct frame *, bool); |
| 3235 | extern void x_clear_cursor (struct window *); | 3237 | extern void x_clear_cursor (struct window *); |
| @@ -3343,8 +3345,10 @@ void update_face_from_frame_parameter (struct frame *, Lisp_Object, | |||
| 3343 | Lisp_Object); | 3345 | Lisp_Object); |
| 3344 | Lisp_Object tty_color_name (struct frame *, int); | 3346 | Lisp_Object tty_color_name (struct frame *, int); |
| 3345 | void clear_face_cache (int); | 3347 | void clear_face_cache (int); |
| 3348 | #ifdef MSDOS | ||
| 3346 | unsigned long load_color (struct frame *, struct face *, Lisp_Object, | 3349 | unsigned long load_color (struct frame *, struct face *, Lisp_Object, |
| 3347 | enum lface_attribute_index); | 3350 | enum lface_attribute_index); |
| 3351 | #endif | ||
| 3348 | void unload_color (struct frame *, unsigned long); | 3352 | void unload_color (struct frame *, unsigned long); |
| 3349 | char *choose_face_font (struct frame *, Lisp_Object *, Lisp_Object, | 3353 | char *choose_face_font (struct frame *, Lisp_Object *, Lisp_Object, |
| 3350 | int *); | 3354 | int *); |
diff --git a/src/fileio.c b/src/fileio.c index a80145ae42c..a1dcb72b4e4 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -161,6 +161,56 @@ static bool e_write (int, Lisp_Object, ptrdiff_t, ptrdiff_t, | |||
| 161 | struct coding_system *); | 161 | struct coding_system *); |
| 162 | 162 | ||
| 163 | 163 | ||
| 164 | /* Return true if FILENAME exists. */ | ||
| 165 | |||
| 166 | static bool | ||
| 167 | check_existing (const char *filename) | ||
| 168 | { | ||
| 169 | return faccessat (AT_FDCWD, filename, F_OK, AT_EACCESS) == 0; | ||
| 170 | } | ||
| 171 | |||
| 172 | /* Return true if file FILENAME exists and can be executed. */ | ||
| 173 | |||
| 174 | static bool | ||
| 175 | check_executable (char *filename) | ||
| 176 | { | ||
| 177 | return faccessat (AT_FDCWD, filename, X_OK, AT_EACCESS) == 0; | ||
| 178 | } | ||
| 179 | |||
| 180 | /* Return true if file FILENAME exists and can be accessed | ||
| 181 | according to AMODE, which should include W_OK. | ||
| 182 | On failure, return false and set errno. */ | ||
| 183 | |||
| 184 | static bool | ||
| 185 | check_writable (const char *filename, int amode) | ||
| 186 | { | ||
| 187 | #ifdef MSDOS | ||
| 188 | /* FIXME: an faccessat implementation should be added to the | ||
| 189 | DOS/Windows ports and this #ifdef branch should be removed. */ | ||
| 190 | struct stat st; | ||
| 191 | if (stat (filename, &st) < 0) | ||
| 192 | return 0; | ||
| 193 | errno = EPERM; | ||
| 194 | return (st.st_mode & S_IWRITE || S_ISDIR (st.st_mode)); | ||
| 195 | #else /* not MSDOS */ | ||
| 196 | bool res = faccessat (AT_FDCWD, filename, amode, AT_EACCESS) == 0; | ||
| 197 | #ifdef CYGWIN | ||
| 198 | /* faccessat may have returned failure because Cygwin couldn't | ||
| 199 | determine the file's UID or GID; if so, we return success. */ | ||
| 200 | if (!res) | ||
| 201 | { | ||
| 202 | int faccessat_errno = errno; | ||
| 203 | struct stat st; | ||
| 204 | if (stat (filename, &st) < 0) | ||
| 205 | return 0; | ||
| 206 | res = (st.st_uid == -1 || st.st_gid == -1); | ||
| 207 | errno = faccessat_errno; | ||
| 208 | } | ||
| 209 | #endif /* CYGWIN */ | ||
| 210 | return res; | ||
| 211 | #endif /* not MSDOS */ | ||
| 212 | } | ||
| 213 | |||
| 164 | /* Signal a file-access failure. STRING describes the failure, | 214 | /* Signal a file-access failure. STRING describes the failure, |
| 165 | NAME the file involved, and ERRORNO the errno value. | 215 | NAME the file involved, and ERRORNO the errno value. |
| 166 | 216 | ||
| @@ -1733,7 +1783,7 @@ those `/' is discarded. */) | |||
| 1733 | 1783 | ||
| 1734 | xnm = SSDATA (filename); | 1784 | xnm = SSDATA (filename); |
| 1735 | x = xnm + SBYTES (filename); | 1785 | x = xnm + SBYTES (filename); |
| 1736 | 1786 | ||
| 1737 | /* If /~ or // appears, discard everything through first slash. */ | 1787 | /* If /~ or // appears, discard everything through first slash. */ |
| 1738 | while ((p = search_embedded_absfilename (xnm, x)) != NULL) | 1788 | while ((p = search_embedded_absfilename (xnm, x)) != NULL) |
| 1739 | /* This time we do not start over because we've already expanded envvars | 1789 | /* This time we do not start over because we've already expanded envvars |
| @@ -2440,55 +2490,6 @@ On Unix, this is a name starting with a `/' or a `~'. */) | |||
| 2440 | return file_name_absolute_p (SSDATA (filename)) ? Qt : Qnil; | 2490 | return file_name_absolute_p (SSDATA (filename)) ? Qt : Qnil; |
| 2441 | } | 2491 | } |
| 2442 | 2492 | ||
| 2443 | /* Return true if FILENAME exists. */ | ||
| 2444 | bool | ||
| 2445 | check_existing (const char *filename) | ||
| 2446 | { | ||
| 2447 | return faccessat (AT_FDCWD, filename, F_OK, AT_EACCESS) == 0; | ||
| 2448 | } | ||
| 2449 | |||
| 2450 | /* Return true if file FILENAME exists and can be executed. */ | ||
| 2451 | |||
| 2452 | static bool | ||
| 2453 | check_executable (char *filename) | ||
| 2454 | { | ||
| 2455 | return faccessat (AT_FDCWD, filename, X_OK, AT_EACCESS) == 0; | ||
| 2456 | } | ||
| 2457 | |||
| 2458 | /* Return true if file FILENAME exists and can be accessed | ||
| 2459 | according to AMODE, which should include W_OK. | ||
| 2460 | On failure, return false and set errno. */ | ||
| 2461 | |||
| 2462 | static bool | ||
| 2463 | check_writable (const char *filename, int amode) | ||
| 2464 | { | ||
| 2465 | #ifdef MSDOS | ||
| 2466 | /* FIXME: an faccessat implementation should be added to the | ||
| 2467 | DOS/Windows ports and this #ifdef branch should be removed. */ | ||
| 2468 | struct stat st; | ||
| 2469 | if (stat (filename, &st) < 0) | ||
| 2470 | return 0; | ||
| 2471 | errno = EPERM; | ||
| 2472 | return (st.st_mode & S_IWRITE || S_ISDIR (st.st_mode)); | ||
| 2473 | #else /* not MSDOS */ | ||
| 2474 | bool res = faccessat (AT_FDCWD, filename, amode, AT_EACCESS) == 0; | ||
| 2475 | #ifdef CYGWIN | ||
| 2476 | /* faccessat may have returned failure because Cygwin couldn't | ||
| 2477 | determine the file's UID or GID; if so, we return success. */ | ||
| 2478 | if (!res) | ||
| 2479 | { | ||
| 2480 | int faccessat_errno = errno; | ||
| 2481 | struct stat st; | ||
| 2482 | if (stat (filename, &st) < 0) | ||
| 2483 | return 0; | ||
| 2484 | res = (st.st_uid == -1 || st.st_gid == -1); | ||
| 2485 | errno = faccessat_errno; | ||
| 2486 | } | ||
| 2487 | #endif /* CYGWIN */ | ||
| 2488 | return res; | ||
| 2489 | #endif /* not MSDOS */ | ||
| 2490 | } | ||
| 2491 | |||
| 2492 | DEFUN ("file-exists-p", Ffile_exists_p, Sfile_exists_p, 1, 1, 0, | 2493 | DEFUN ("file-exists-p", Ffile_exists_p, Sfile_exists_p, 1, 1, 0, |
| 2493 | doc: /* Return t if file FILENAME exists (whether or not you can read it.) | 2494 | doc: /* Return t if file FILENAME exists (whether or not you can read it.) |
| 2494 | See also `file-readable-p' and `file-attributes'. | 2495 | See also `file-readable-p' and `file-attributes'. |
| @@ -2514,7 +2515,7 @@ Use `file-symlink-p' to test for such links. */) | |||
| 2514 | 2515 | ||
| 2515 | absname = ENCODE_FILE (absname); | 2516 | absname = ENCODE_FILE (absname); |
| 2516 | 2517 | ||
| 2517 | return (check_existing (SSDATA (absname))) ? Qt : Qnil; | 2518 | return check_existing (SSDATA (absname)) ? Qt : Qnil; |
| 2518 | } | 2519 | } |
| 2519 | 2520 | ||
| 2520 | DEFUN ("file-executable-p", Ffile_executable_p, Sfile_executable_p, 1, 1, 0, | 2521 | DEFUN ("file-executable-p", Ffile_executable_p, Sfile_executable_p, 1, 1, 0, |
diff --git a/src/gnutls.c b/src/gnutls.c index 2157d555053..f9e86d1a697 100644 --- a/src/gnutls.c +++ b/src/gnutls.c | |||
| @@ -249,7 +249,9 @@ init_gnutls_functions (void) | |||
| 249 | #define fn_gnutls_record_recv gnutls_record_recv | 249 | #define fn_gnutls_record_recv gnutls_record_recv |
| 250 | #define fn_gnutls_record_send gnutls_record_send | 250 | #define fn_gnutls_record_send gnutls_record_send |
| 251 | #define fn_gnutls_strerror gnutls_strerror | 251 | #define fn_gnutls_strerror gnutls_strerror |
| 252 | #ifdef WINDOWSNT | ||
| 252 | #define fn_gnutls_transport_set_errno gnutls_transport_set_errno | 253 | #define fn_gnutls_transport_set_errno gnutls_transport_set_errno |
| 254 | #endif | ||
| 253 | #define fn_gnutls_transport_set_ptr2 gnutls_transport_set_ptr2 | 255 | #define fn_gnutls_transport_set_ptr2 gnutls_transport_set_ptr2 |
| 254 | #define fn_gnutls_x509_crt_check_hostname gnutls_x509_crt_check_hostname | 256 | #define fn_gnutls_x509_crt_check_hostname gnutls_x509_crt_check_hostname |
| 255 | #define fn_gnutls_x509_crt_deinit gnutls_x509_crt_deinit | 257 | #define fn_gnutls_x509_crt_deinit gnutls_x509_crt_deinit |
| @@ -364,11 +366,13 @@ emacs_gnutls_record_check_pending (gnutls_session_t state) | |||
| 364 | return fn_gnutls_record_check_pending (state); | 366 | return fn_gnutls_record_check_pending (state); |
| 365 | } | 367 | } |
| 366 | 368 | ||
| 369 | #ifdef WINDOWSNT | ||
| 367 | void | 370 | void |
| 368 | emacs_gnutls_transport_set_errno (gnutls_session_t state, int err) | 371 | emacs_gnutls_transport_set_errno (gnutls_session_t state, int err) |
| 369 | { | 372 | { |
| 370 | fn_gnutls_transport_set_errno (state, err); | 373 | fn_gnutls_transport_set_errno (state, err); |
| 371 | } | 374 | } |
| 375 | #endif | ||
| 372 | 376 | ||
| 373 | ptrdiff_t | 377 | ptrdiff_t |
| 374 | emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, ptrdiff_t nbyte) | 378 | emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, ptrdiff_t nbyte) |
diff --git a/src/gnutls.h b/src/gnutls.h index 86dcab77b62..0f648dbd81c 100644 --- a/src/gnutls.h +++ b/src/gnutls.h | |||
| @@ -64,7 +64,9 @@ extern ptrdiff_t | |||
| 64 | emacs_gnutls_read (struct Lisp_Process *proc, char *buf, ptrdiff_t nbyte); | 64 | emacs_gnutls_read (struct Lisp_Process *proc, char *buf, ptrdiff_t nbyte); |
| 65 | 65 | ||
| 66 | extern int emacs_gnutls_record_check_pending (gnutls_session_t state); | 66 | extern int emacs_gnutls_record_check_pending (gnutls_session_t state); |
| 67 | #ifdef WINDOWSNT | ||
| 67 | extern void emacs_gnutls_transport_set_errno (gnutls_session_t state, int err); | 68 | extern void emacs_gnutls_transport_set_errno (gnutls_session_t state, int err); |
| 69 | #endif | ||
| 68 | extern Lisp_Object emacs_gnutls_deinit (Lisp_Object); | 70 | extern Lisp_Object emacs_gnutls_deinit (Lisp_Object); |
| 69 | 71 | ||
| 70 | extern void syms_of_gnutls (void); | 72 | extern void syms_of_gnutls (void); |
diff --git a/src/keyboard.c b/src/keyboard.c index bb8fefa7046..a776720b807 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -2097,6 +2097,9 @@ bind_polling_period (int n) | |||
| 2097 | 2097 | ||
| 2098 | /* Apply the control modifier to CHARACTER. */ | 2098 | /* Apply the control modifier to CHARACTER. */ |
| 2099 | 2099 | ||
| 2100 | #ifndef WINDOWSNT | ||
| 2101 | static | ||
| 2102 | #endif | ||
| 2100 | int | 2103 | int |
| 2101 | make_ctrl_char (int c) | 2104 | make_ctrl_char (int c) |
| 2102 | { | 2105 | { |
diff --git a/src/keyboard.h b/src/keyboard.h index b9bb006b4ed..b8aad959dd9 100644 --- a/src/keyboard.h +++ b/src/keyboard.h | |||
| @@ -517,7 +517,9 @@ extern bool input_polling_used (void); | |||
| 517 | extern void clear_input_pending (void); | 517 | extern void clear_input_pending (void); |
| 518 | extern bool requeued_events_pending_p (void); | 518 | extern bool requeued_events_pending_p (void); |
| 519 | extern void bind_polling_period (int); | 519 | extern void bind_polling_period (int); |
| 520 | #ifdef WINDOWSNT | ||
| 520 | extern int make_ctrl_char (int) ATTRIBUTE_CONST; | 521 | extern int make_ctrl_char (int) ATTRIBUTE_CONST; |
| 522 | #endif | ||
| 521 | extern void stuff_buffered_input (Lisp_Object); | 523 | extern void stuff_buffered_input (Lisp_Object); |
| 522 | extern void clear_waiting_for_input (void); | 524 | extern void clear_waiting_for_input (void); |
| 523 | extern void swallow_events (bool); | 525 | extern void swallow_events (bool); |
diff --git a/src/lisp.h b/src/lisp.h index 4e141c71319..e1a6fc7c91a 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -3873,7 +3873,6 @@ extern void init_fileio (void); | |||
| 3873 | extern void syms_of_fileio (void); | 3873 | extern void syms_of_fileio (void); |
| 3874 | extern Lisp_Object make_temp_name (Lisp_Object, bool); | 3874 | extern Lisp_Object make_temp_name (Lisp_Object, bool); |
| 3875 | extern Lisp_Object Qdelete_file; | 3875 | extern Lisp_Object Qdelete_file; |
| 3876 | extern bool check_existing (const char *); | ||
| 3877 | 3876 | ||
| 3878 | /* Defined in search.c. */ | 3877 | /* Defined in search.c. */ |
| 3879 | extern void shrink_regexp_cache (void); | 3878 | extern void shrink_regexp_cache (void); |
diff --git a/src/process.c b/src/process.c index cf9d5e265e1..91bc090e76e 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -1958,6 +1958,9 @@ create_pty (Lisp_Object process) | |||
| 1958 | /* Convert an internal struct sockaddr to a lisp object (vector or string). | 1958 | /* Convert an internal struct sockaddr to a lisp object (vector or string). |
| 1959 | The address family of sa is not included in the result. */ | 1959 | The address family of sa is not included in the result. */ |
| 1960 | 1960 | ||
| 1961 | #ifndef WINDOWSNT | ||
| 1962 | static | ||
| 1963 | #endif | ||
| 1961 | Lisp_Object | 1964 | Lisp_Object |
| 1962 | conv_sockaddr_to_lisp (struct sockaddr *sa, int len) | 1965 | conv_sockaddr_to_lisp (struct sockaddr *sa, int len) |
| 1963 | { | 1966 | { |
| @@ -3504,43 +3507,10 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3504 | } | 3507 | } |
| 3505 | 3508 | ||
| 3506 | 3509 | ||
| 3507 | DEFUN ("network-interface-list", Fnetwork_interface_list, Snetwork_interface_list, 0, 0, 0, | 3510 | #ifdef HAVE_NET_IF_H |
| 3508 | doc: /* Return an alist of all network interfaces and their network address. | ||
| 3509 | Each element is a cons, the car of which is a string containing the | ||
| 3510 | interface name, and the cdr is the network address in internal | ||
| 3511 | format; see the description of ADDRESS in `make-network-process'. | ||
| 3512 | |||
| 3513 | If the information is not available, return nil. */) | ||
| 3514 | (void) | ||
| 3515 | { | ||
| 3516 | #if (defined (HAVE_NET_IF_H) && defined (SIOCGIFCONF)) || defined (WINDOWSNT) | ||
| 3517 | return network_interface_list (); | ||
| 3518 | #else | ||
| 3519 | return Qnil; | ||
| 3520 | #endif | ||
| 3521 | } | ||
| 3522 | |||
| 3523 | DEFUN ("network-interface-info", Fnetwork_interface_info, Snetwork_interface_info, 1, 1, 0, | ||
| 3524 | doc: /* Return information about network interface named IFNAME. | ||
| 3525 | The return value is a list (ADDR BCAST NETMASK HWADDR FLAGS), | ||
| 3526 | where ADDR is the layer 3 address, BCAST is the layer 3 broadcast address, | ||
| 3527 | NETMASK is the layer 3 network mask, HWADDR is the layer 2 address, and | ||
| 3528 | FLAGS is the current flags of the interface. | ||
| 3529 | |||
| 3530 | Data that is unavailable is returned as nil. */) | ||
| 3531 | (Lisp_Object ifname) | ||
| 3532 | { | ||
| 3533 | #if (defined (HAVE_NET_IF_H) && (defined (SIOCGIFADDR) || defined (SIOCGIFHWADDR) || defined (SIOCGIFFLAGS))) || defined (WINDOWSNT) | ||
| 3534 | return network_interface_info (ifname); | ||
| 3535 | #else | ||
| 3536 | return Qnil; | ||
| 3537 | #endif | ||
| 3538 | } | ||
| 3539 | |||
| 3540 | #if defined (HAVE_NET_IF_H) | ||
| 3541 | 3511 | ||
| 3542 | #ifdef SIOCGIFCONF | 3512 | #ifdef SIOCGIFCONF |
| 3543 | Lisp_Object | 3513 | static Lisp_Object |
| 3544 | network_interface_list (void) | 3514 | network_interface_list (void) |
| 3545 | { | 3515 | { |
| 3546 | struct ifconf ifconf; | 3516 | struct ifconf ifconf; |
| @@ -3683,7 +3653,7 @@ static const struct ifflag_def ifflag_table[] = { | |||
| 3683 | { 0, 0 } | 3653 | { 0, 0 } |
| 3684 | }; | 3654 | }; |
| 3685 | 3655 | ||
| 3686 | Lisp_Object | 3656 | static Lisp_Object |
| 3687 | network_interface_info (Lisp_Object ifname) | 3657 | network_interface_info (Lisp_Object ifname) |
| 3688 | { | 3658 | { |
| 3689 | struct ifreq rq; | 3659 | struct ifreq rq; |
| @@ -3829,6 +3799,45 @@ network_interface_info (Lisp_Object ifname) | |||
| 3829 | #endif /* !SIOCGIFADDR && !SIOCGIFHWADDR && !SIOCGIFFLAGS */ | 3799 | #endif /* !SIOCGIFADDR && !SIOCGIFHWADDR && !SIOCGIFFLAGS */ |
| 3830 | #endif /* defined (HAVE_NET_IF_H) */ | 3800 | #endif /* defined (HAVE_NET_IF_H) */ |
| 3831 | 3801 | ||
| 3802 | DEFUN ("network-interface-list", Fnetwork_interface_list, | ||
| 3803 | Snetwork_interface_list, 0, 0, 0, | ||
| 3804 | doc: /* Return an alist of all network interfaces and their network address. | ||
| 3805 | Each element is a cons, the car of which is a string containing the | ||
| 3806 | interface name, and the cdr is the network address in internal | ||
| 3807 | format; see the description of ADDRESS in `make-network-process'. | ||
| 3808 | |||
| 3809 | If the information is not available, return nil. */) | ||
| 3810 | (void) | ||
| 3811 | { | ||
| 3812 | #if (defined HAVE_NET_IF_H && defined SIOCGIFCONF) || defined WINDOWSNT | ||
| 3813 | return network_interface_list (); | ||
| 3814 | #else | ||
| 3815 | return Qnil; | ||
| 3816 | #endif | ||
| 3817 | } | ||
| 3818 | |||
| 3819 | DEFUN ("network-interface-info", Fnetwork_interface_info, | ||
| 3820 | Snetwork_interface_info, 1, 1, 0, | ||
| 3821 | doc: /* Return information about network interface named IFNAME. | ||
| 3822 | The return value is a list (ADDR BCAST NETMASK HWADDR FLAGS), | ||
| 3823 | where ADDR is the layer 3 address, BCAST is the layer 3 broadcast address, | ||
| 3824 | NETMASK is the layer 3 network mask, HWADDR is the layer 2 address, and | ||
| 3825 | FLAGS is the current flags of the interface. | ||
| 3826 | |||
| 3827 | Data that is unavailable is returned as nil. */) | ||
| 3828 | (Lisp_Object ifname) | ||
| 3829 | { | ||
| 3830 | #if ((defined HAVE_NET_IF_H \ | ||
| 3831 | && (defined SIOCGIFADDR || defined SIOCGIFHWADDR \ | ||
| 3832 | || defined SIOCGIFFLAGS)) \ | ||
| 3833 | || defined WINDOWSNT) | ||
| 3834 | return network_interface_info (ifname); | ||
| 3835 | #else | ||
| 3836 | return Qnil; | ||
| 3837 | #endif | ||
| 3838 | } | ||
| 3839 | |||
| 3840 | |||
| 3832 | /* Turn off input and output for process PROC. */ | 3841 | /* Turn off input and output for process PROC. */ |
| 3833 | 3842 | ||
| 3834 | static void | 3843 | static void |
diff --git a/src/process.h b/src/process.h index fc69e2761a5..37d220e987c 100644 --- a/src/process.h +++ b/src/process.h | |||
| @@ -227,7 +227,9 @@ extern Lisp_Object system_process_attributes (Lisp_Object); | |||
| 227 | 227 | ||
| 228 | extern void record_deleted_pid (pid_t, Lisp_Object); | 228 | extern void record_deleted_pid (pid_t, Lisp_Object); |
| 229 | struct sockaddr; | 229 | struct sockaddr; |
| 230 | #ifdef WINDOWSNT | ||
| 230 | extern Lisp_Object conv_sockaddr_to_lisp (struct sockaddr *, int); | 231 | extern Lisp_Object conv_sockaddr_to_lisp (struct sockaddr *, int); |
| 232 | #endif | ||
| 231 | extern void hold_keyboard_input (void); | 233 | extern void hold_keyboard_input (void); |
| 232 | extern void unhold_keyboard_input (void); | 234 | extern void unhold_keyboard_input (void); |
| 233 | extern bool kbd_on_hold_p (void); | 235 | extern bool kbd_on_hold_p (void); |
| @@ -242,8 +244,9 @@ extern void delete_write_fd (int fd); | |||
| 242 | extern void catch_child_signal (void); | 244 | extern void catch_child_signal (void); |
| 243 | #endif | 245 | #endif |
| 244 | 246 | ||
| 247 | #ifdef WINDOWSNT | ||
| 245 | extern Lisp_Object network_interface_list (void); | 248 | extern Lisp_Object network_interface_list (void); |
| 246 | extern Lisp_Object network_interface_info (Lisp_Object); | 249 | extern Lisp_Object network_interface_info (Lisp_Object); |
| 247 | 250 | #endif | |
| 248 | 251 | ||
| 249 | INLINE_HEADER_END | 252 | INLINE_HEADER_END |
diff --git a/src/term.c b/src/term.c index ee81c59dcd4..b4c2e2560cc 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -500,8 +500,12 @@ static ptrdiff_t encode_terminal_dst_size; | |||
| 500 | Set CODING->produced to the byte-length of the resulting byte | 500 | Set CODING->produced to the byte-length of the resulting byte |
| 501 | sequence, and return a pointer to that byte sequence. */ | 501 | sequence, and return a pointer to that byte sequence. */ |
| 502 | 502 | ||
| 503 | #ifndef WINDOWSNT | ||
| 504 | static | ||
| 505 | #endif | ||
| 503 | unsigned char * | 506 | unsigned char * |
| 504 | encode_terminal_code (struct glyph *src, int src_len, struct coding_system *coding) | 507 | encode_terminal_code (struct glyph *src, int src_len, |
| 508 | struct coding_system *coding) | ||
| 505 | { | 509 | { |
| 506 | struct glyph *src_end = src + src_len; | 510 | struct glyph *src_end = src + src_len; |
| 507 | unsigned char *buf; | 511 | unsigned char *buf; |
diff --git a/src/termhooks.h b/src/termhooks.h index a3977f5336e..31825a4c95d 100644 --- a/src/termhooks.h +++ b/src/termhooks.h | |||
| @@ -630,8 +630,10 @@ extern void delete_terminal (struct terminal *); | |||
| 630 | /* The initial terminal device, created by initial_term_init. */ | 630 | /* The initial terminal device, created by initial_term_init. */ |
| 631 | extern struct terminal *initial_terminal; | 631 | extern struct terminal *initial_terminal; |
| 632 | 632 | ||
| 633 | #ifdef WINDOWSNT | ||
| 633 | extern unsigned char *encode_terminal_code (struct glyph *, int, | 634 | extern unsigned char *encode_terminal_code (struct glyph *, int, |
| 634 | struct coding_system *); | 635 | struct coding_system *); |
| 636 | #endif | ||
| 635 | 637 | ||
| 636 | #ifdef HAVE_GPM | 638 | #ifdef HAVE_GPM |
| 637 | extern void close_gpm (int gpm_fd); | 639 | extern void close_gpm (int gpm_fd); |
| @@ -2088,7 +2088,7 @@ init_environment (char ** argv) | |||
| 2088 | /* For backwards compatibility, check if a .emacs file exists in C:/ | 2088 | /* For backwards compatibility, check if a .emacs file exists in C:/ |
| 2089 | If not, then we can try to default to the appdata directory under the | 2089 | If not, then we can try to default to the appdata directory under the |
| 2090 | user's profile, which is more likely to be writable. */ | 2090 | user's profile, which is more likely to be writable. */ |
| 2091 | if (!check_existing ("C:/.emacs")) | 2091 | if (faccessat (AT_FDCWD, "C:/.emacs", F_OK, AT_EACCESS) != 0) |
| 2092 | { | 2092 | { |
| 2093 | HRESULT profile_result; | 2093 | HRESULT profile_result; |
| 2094 | /* Dynamically load ShGetFolderPath, as it won't exist on versions | 2094 | /* Dynamically load ShGetFolderPath, as it won't exist on versions |
| @@ -2226,7 +2226,8 @@ init_environment (char ** argv) | |||
| 2226 | strcpy (&fname[pend - pstart + 1], "cmdproxy.exe"); | 2226 | strcpy (&fname[pend - pstart + 1], "cmdproxy.exe"); |
| 2227 | ExpandEnvironmentStrings ((LPSTR) fname, bufc, | 2227 | ExpandEnvironmentStrings ((LPSTR) fname, bufc, |
| 2228 | sizeof (bufc)); | 2228 | sizeof (bufc)); |
| 2229 | if (check_existing (bufc)) | 2229 | if (faccessat (AT_FDCWD, bufc, F_OK, AT_EACCESS) |
| 2230 | == 0) | ||
| 2230 | { | 2231 | { |
| 2231 | lpval = bufc; | 2232 | lpval = bufc; |
| 2232 | dwType = REG_SZ; | 2233 | dwType = REG_SZ; |
diff --git a/src/xdisp.c b/src/xdisp.c index 033d3b47147..395a74e4122 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -26410,9 +26410,11 @@ draw_phys_cursor_glyph (struct window *w, struct glyph_row *row, | |||
| 26410 | } | 26410 | } |
| 26411 | 26411 | ||
| 26412 | 26412 | ||
| 26413 | /* EXPORT: | 26413 | /* Erase the image of a cursor of window W from the screen. */ |
| 26414 | Erase the image of a cursor of window W from the screen. */ | ||
| 26415 | 26414 | ||
| 26415 | #ifndef WINDOWSNT | ||
| 26416 | static | ||
| 26417 | #endif | ||
| 26416 | void | 26418 | void |
| 26417 | erase_phys_cursor (struct window *w) | 26419 | erase_phys_cursor (struct window *w) |
| 26418 | { | 26420 | { |
diff --git a/src/xfaces.c b/src/xfaces.c index 828788b4abd..363d3bb0784 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -1197,6 +1197,9 @@ COLOR must be a valid color name. */) | |||
| 1197 | record that fact in flags of the face so that we don't try to free | 1197 | record that fact in flags of the face so that we don't try to free |
| 1198 | these colors. */ | 1198 | these colors. */ |
| 1199 | 1199 | ||
| 1200 | #ifndef MSDOS | ||
| 1201 | static | ||
| 1202 | #endif | ||
| 1200 | unsigned long | 1203 | unsigned long |
| 1201 | load_color (struct frame *f, struct face *face, Lisp_Object name, | 1204 | load_color (struct frame *f, struct face *face, Lisp_Object name, |
| 1202 | enum lface_attribute_index target_index) | 1205 | enum lface_attribute_index target_index) |