X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/ef25feb44365ed60211bc0b965e421b58b3dc075..6e432f0cda1daa7bcee1fb5872dcfa130abe5018:/src/xrdb.c
diff --git a/src/xrdb.c b/src/xrdb.c
index 63f06738b9..9d3ce1670b 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -1,5 +1,6 @@
/* Deal with the X Resource Manager.
- Copyright (C) 1990, 1993-1994, 2000-2011 Free Software Foundation, Inc.
+ Copyright (C) 1990, 1993-1994, 2000-2013 Free Software Foundation,
+ Inc.
Author: Joseph Arceneaux
Created: 4/90
@@ -24,9 +25,8 @@ along with GNU Emacs. If not, see . */
#include
#include
#include
-
+#include
#include
-#include
#include "lisp.h"
@@ -49,11 +49,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);
@@ -74,10 +69,8 @@ static char *
x_get_customization_string (XrmDatabase db, const char *name,
const char *class)
{
- char *full_name
- = (char *) alloca (strlen (name) + sizeof ("customization") + 3);
- char *full_class
- = (char *) alloca (strlen (class) + sizeof ("Customization") + 3);
+ char *full_name = alloca (strlen (name) + sizeof "customization" + 3);
+ char *full_class = alloca (strlen (class) + sizeof "Customization" + 3);
char *result;
sprintf (full_name, "%s.%s", name, "customization");
@@ -87,7 +80,7 @@ x_get_customization_string (XrmDatabase db, const char *name,
if (result)
{
- char *copy = (char *) xmalloc (strlen (result) + 1);
+ char *copy = xmalloc (strlen (result) + 1);
strcpy (copy, result);
return copy;
}
@@ -126,13 +119,13 @@ x_get_customization_string (XrmDatabase db, const char *name,
Return NULL otherwise. */
static char *
-magic_file_p (const char *string, EMACS_INT string_len, const char *class,
+magic_file_p (const char *string, ptrdiff_t string_len, const char *class,
const char *escaped_suffix)
{
char *lang = getenv ("LANG");
ptrdiff_t path_size = 100;
- char *path = (char *) xmalloc (path_size);
+ char *path = xmalloc (path_size);
ptrdiff_t path_len = 0;
const char *p = string;
@@ -206,7 +199,7 @@ magic_file_p (const char *string, EMACS_INT string_len, const char *class,
if (min (PTRDIFF_MAX, SIZE_MAX) / 2 - 1 - path_len < next_len)
memory_full (SIZE_MAX);
path_size = (path_len + next_len + 1) * 2;
- path = (char *) xrealloc (path, path_size);
+ path = xrealloc (path, path_size);
}
memcpy (path + path_len, next, next_len);
@@ -258,7 +251,7 @@ gethomedir (void)
if (ptr == NULL)
return xstrdup ("/");
- copy = (char *) xmalloc (strlen (ptr) + 2);
+ copy = xmalloc (strlen (ptr) + 2);
strcpy (copy, ptr);
strcat (copy, "/");
@@ -400,7 +393,7 @@ get_user_db (Display *display)
char *xdefault;
home = gethomedir ();
- xdefault = (char *) xmalloc (strlen (home) + sizeof (".Xdefaults"));
+ xdefault = xmalloc (strlen (home) + sizeof ".Xdefaults");
strcpy (xdefault, home);
strcat (xdefault, ".Xdefaults");
db = XrmGetFileDatabase (xdefault);
@@ -432,9 +425,10 @@ 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);
- path = (char *) xrealloc (home, pathsize);
+ 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;
}
@@ -602,8 +596,8 @@ x_get_resource (XrmDatabase rdb, const char *name, const char *class,
XrmClass classlist[100];
XrmRepresentation type;
- XrmStringToNameList(name, namelist);
- XrmStringToClassList(class, classlist);
+ XrmStringToNameList (name, namelist);
+ XrmStringToClassList (class, classlist);
if (XrmQGetResource (rdb, namelist, classlist, &type, &value) == True
&& (type == expected_type))