From 309f24d1ec07646fb1a090ee10fe456e79aea097 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Fri, 9 Aug 2013 16:25:34 +0400 Subject: Use xstrdup and build_unibyte_string where applicable. * alloc.c (xstrdup): Tiny cleanup. Add eassert. * xfns.c (x_window): * xrdb.c (x_get_customization_string): * xterm.c (xim_initialize): * w32fns.c (w32_window): Use xstrdup. (w32_display_monitor_attributes_list): * emacs.c (init_cmdargs): * keyboard.c (PUSH_C_STR): * nsfont.m (nsfont_open): * sysdep.c (system_process_attributes): * w32.c (system_process_attributes): * xdisp.c (message1, message1_nolog): Use build_unibyte_string. --- src/xrdb.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'src/xrdb.c') diff --git a/src/xrdb.c b/src/xrdb.c index 7c9cd53fa8c..6ef5c3bcb41 100644 --- a/src/xrdb.c +++ b/src/xrdb.c @@ -75,18 +75,9 @@ x_get_customization_string (XrmDatabase db, const char *name, sprintf (full_class, "%s.%s", class, "Customization"); result = x_get_string_resource (db, full_name, full_class); - - if (result) - { - char *copy = xmalloc (strlen (result) + 1); - strcpy (copy, result); - return copy; - } - else - return 0; + return result ? xstrdup (result) : NULL; } - /* Expand all the Xt-style %-escapes in STRING, whose length is given by STRING_LEN. Here are the escapes we're supposed to recognize: -- cgit v1.2.3