summaryrefslogtreecommitdiff
path: root/src/frame.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2014-12-25 04:19:17 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2014-12-25 15:44:23 -0800
commit1e6879dbdb0832427f5c588c89a53a8a80768a00 (patch)
tree155493c6e140264c05356c667a1c9547a45e336f /src/frame.c
parent8dba53d239f5ac00e930f13b73f59cb5b53ffbd1 (diff)
downloademacs-1e6879dbdb0832427f5c588c89a53a8a80768a00.tar.gz
Prefer stpcpy to strcat
* admin/merge-gnulib (GNULIB_MODULES): Add stpcpy. * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. * lib/stpcpy.c, m4/stpcpy.m4: New files, from gnulib. * lib-src/ebrowse.c (sym_scope_1, operator_name, open_file): * lib-src/emacsclient.c (get_server_config, set_local_socket) (start_daemon_and_retry_set_socket): * lib-src/etags.c (main, C_entries, relative_filename): * lib-src/pop.c (sendline): * lib-src/update-game-score.c (main): * lwlib/xlwmenu.c (resource_widget_value): * src/callproc.c (child_setup): * src/dbusbind.c (xd_signature_cat): * src/doc.c (get_doc_string, Fsnarf_documentation): * src/editfns.c (Fuser_full_name): * src/frame.c (xrdb_get_resource): * src/gtkutil.c (xg_get_file_with_chooser): * src/tparam.c (tparam1): * src/xfns.c (xic_create_fontsetname): * src/xrdb.c (gethomedir, get_user_db, get_environ_db): * src/xsmfns.c (smc_save_yourself_CB): Rewrite to avoid the need for strcat, typically by using stpcpy and/or lispstpcpy. strcat tends to be part of O(N**2) algorithms. * src/doc.c (sibling_etc): * src/xrdb.c (xdefaults): Now a top-level static constant.
Diffstat (limited to 'src/frame.c')
-rw-r--r--src/frame.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/frame.c b/src/frame.c
index 31273665e88..2ad1c1b52b7 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -4076,23 +4076,23 @@ xrdb_get_resource (XrmDatabase rdb, Lisp_Object attribute, Lisp_Object class, Li
/* Start with emacs.FRAMENAME for the name (the specific one)
and with `Emacs' for the class key (the general one). */
- lispstpcpy (name_key, Vx_resource_name);
- lispstpcpy (class_key, Vx_resource_class);
+ char *nz = lispstpcpy (name_key, Vx_resource_name);
+ char *cz = lispstpcpy (class_key, Vx_resource_class);
- strcat (class_key, ".");
- strcat (class_key, SSDATA (class));
+ *cz++ = '.';
+ cz = lispstpcpy (cz, class);
if (!NILP (component))
{
- strcat (class_key, ".");
- strcat (class_key, SSDATA (subclass));
+ *cz++ = '.';
+ lispstpcpy (cz, subclass);
- strcat (name_key, ".");
- strcat (name_key, SSDATA (component));
+ *nz++ = '.';
+ nz = lispstpcpy (nz, component);
}
- strcat (name_key, ".");
- strcat (name_key, SSDATA (attribute));
+ *nz++ = '.';
+ lispstpcpy (nz, attribute);
char *value = x_get_string_resource (rdb, name_key, class_key);
SAFE_FREE();