summaryrefslogtreecommitdiff
path: root/m4/stpcpy.m4
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 /m4/stpcpy.m4
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 'm4/stpcpy.m4')
-rw-r--r--m4/stpcpy.m425
1 files changed, 25 insertions, 0 deletions
diff --git a/m4/stpcpy.m4 b/m4/stpcpy.m4
new file mode 100644
index 00000000000..966ba951f52
--- /dev/null
+++ b/m4/stpcpy.m4
@@ -0,0 +1,25 @@
+# stpcpy.m4 serial 8
+dnl Copyright (C) 2002, 2007, 2009-2014 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_STPCPY],
+[
+ dnl Persuade glibc <string.h> to declare stpcpy().
+ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+ dnl The stpcpy() declaration in lib/string.in.h uses 'restrict'.
+ AC_REQUIRE([AC_C_RESTRICT])
+
+ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
+ AC_CHECK_FUNCS([stpcpy])
+ if test $ac_cv_func_stpcpy = no; then
+ HAVE_STPCPY=0
+ fi
+])
+
+# Prerequisites of lib/stpcpy.c.
+AC_DEFUN([gl_PREREQ_STPCPY], [
+ :
+])