summaryrefslogtreecommitdiff
path: root/src/xrdb.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2015-07-31 09:46:45 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2015-07-31 09:47:19 -0700
commit8a7a99e0280103e223b8e1a717107bdf9b8eabc7 (patch)
treebd6794e32994e43745d8764fc252f98c458b7562 /src/xrdb.c
parentf5fc5cd5c207a4fc3bdde381ad4f74c8fe6bb5d6 (diff)
downloademacs-8a7a99e0280103e223b8e1a717107bdf9b8eabc7.tar.gz
emacs-8a7a99e0280103e223b8e1a717107bdf9b8eabc7.tar.bz2
emacs-8a7a99e0280103e223b8e1a717107bdf9b8eabc7.zip
Port to pedantic memcpy
* src/keyboard.c (menu_bar_items, tool_bar_items): * src/xrdb.c (magic_db): Port to pedantic memcpy implementations that reject memcpy (0, 0, 0).
Diffstat (limited to 'src/xrdb.c')
-rw-r--r--src/xrdb.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/xrdb.c b/src/xrdb.c
index 9e85e5a6277..2235b4535da 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -119,8 +119,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 +137,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,8 +179,6 @@ 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)