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/process.c | |
| 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/process.c')
| -rw-r--r-- | src/process.c | 81 |
1 files changed, 45 insertions, 36 deletions
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 |