X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/2c82deee7fbb951a90ed3246350fbf9390af038a..d9ea795035f28f700f1456b377013a24a1ea5e6f:/src/xrdb.c diff --git a/src/xrdb.c b/src/xrdb.c index 9e85e5a627..865acc9421 100644 --- a/src/xrdb.c +++ b/src/xrdb.c @@ -1,5 +1,5 @@ /* Deal with the X Resource Manager. - Copyright (C) 1990, 1993-1994, 2000-2015 Free Software Foundation, + Copyright (C) 1990, 1993-1994, 2000-2016 Free Software Foundation, Inc. Author: Joseph Arceneaux @@ -43,11 +43,6 @@ along with GNU Emacs. If not, see . */ #include #endif -#ifdef USE_MOTIF -/* For Vdouble_click_time. */ -#include "keyboard.h" -#endif - /* X file search path processing. */ @@ -119,8 +114,8 @@ magic_db (const char *string, ptrdiff_t string_len, const char *class, while (p < string + string_len) { /* The chunk we're about to stick on the end of result. */ - const char *next = NULL; - ptrdiff_t next_len; + const char *next = p; + ptrdiff_t next_len = 1; if (*p == '%') { @@ -137,10 +132,13 @@ magic_db (const char *string, ptrdiff_t string_len, const char *class, break; case 'C': - next = (x_customization_string - ? x_customization_string - : ""); - next_len = strlen (next); + if (x_customization_string) + { + next = x_customization_string; + next_len = strlen (next); + } + else + next_len = 0; break; case 'N': @@ -176,17 +174,11 @@ magic_db (const char *string, ptrdiff_t string_len, const char *class, return NULL; } } - else - next = p, next_len = 1; /* Do we have room for this component followed by a '\0'? */ if (path_size - path_len <= next_len) - { - 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 = xrealloc (path, path_size); - } + path = xpalloc (path, &path_size, path_len - path_size + next_len + 1, + -1, sizeof *path); memcpy (path + path_len, next, next_len); path_len += next_len;