From 61655b89f454597079c7f1ddf680d654c2c5f4e8 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Tue, 16 Oct 2012 06:22:25 +0400 Subject: [PATCH] * editfns.c (get_system_name): Remove. * lisp.h (get_system_name): Remove prototype. * xrdb.c (getenv, getpwuid, getpwnam): Remove prototypes. (get_environ_db): Use Vsystem_name. Avoid call to strlen. --- src/ChangeLog | 7 +++++++ src/editfns.c | 9 --------- src/lisp.h | 1 - src/xrdb.c | 12 ++++-------- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 398eda841fe..26bd1925a5f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2012-10-16 Dmitry Antipov + + * editfns.c (get_system_name): Remove. + * lisp.h (get_system_name): Remove prototype. + * xrdb.c (getenv, getpwuid, getpwnam): Remove prototypes. + (get_environ_db): Use Vsystem_name. Avoid call to strlen. + 2012-10-15 Daniel Colascione * dbusbind.c: Add comment explaining reason for previous change. diff --git a/src/editfns.c b/src/editfns.c index 19fad7130a7..c5d4ed295ab 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -1339,15 +1339,6 @@ DEFUN ("system-name", Fsystem_name, Ssystem_name, 0, 0, 0, return Vsystem_name; } -const char * -get_system_name (void) -{ - if (STRINGP (Vsystem_name)) - return SSDATA (Vsystem_name); - else - return ""; -} - DEFUN ("emacs-pid", Femacs_pid, Semacs_pid, 0, 0, 0, doc: /* Return the process ID of Emacs, as a number. */) (void) diff --git a/src/lisp.h b/src/lisp.h index 7afe7b373fe..01f6ca5e57c 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3127,7 +3127,6 @@ extern Lisp_Object make_buffer_string (ptrdiff_t, ptrdiff_t, bool); extern Lisp_Object make_buffer_string_both (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, bool); extern void init_editfns (void); -const char *get_system_name (void); extern void syms_of_editfns (void); extern void set_time_zone_rule (const char *); diff --git a/src/xrdb.c b/src/xrdb.c index 73672c9617c..9d056a607e4 100644 --- a/src/xrdb.c +++ b/src/xrdb.c @@ -24,7 +24,7 @@ along with GNU Emacs. If not, see . */ #include #include #include - +#include #include #include "lisp.h" @@ -48,11 +48,6 @@ along with GNU Emacs. If not, see . */ #include "keyboard.h" #endif -extern char *getenv (const char *); - -extern struct passwd *getpwuid (uid_t); -extern struct passwd *getpwnam (const char *); - char *x_get_string_resource (XrmDatabase rdb, const char *name, const char *class); static int file_p (const char *filename); @@ -429,8 +424,9 @@ get_environ_db (void) { static char const xdefaults[] = ".Xdefaults-"; char *home = gethomedir (); - char const *host = get_system_name (); - ptrdiff_t pathsize = strlen (home) + sizeof xdefaults + strlen (host); + char const *host = SSDATA (Vsystem_name); + ptrdiff_t pathsize = (strlen (home) + sizeof xdefaults + + SBYTES (Vsystem_name)); path = xrealloc (home, pathsize); strcat (strcat (path, xdefaults), host); p = path; -- 2.39.2