summaryrefslogtreecommitdiff
path: root/lwlib
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2013-11-13 17:52:18 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2013-11-13 17:52:18 -0800
commitd672ac3c611453c624948ed8cc2ced65cadc3400 (patch)
treea5b52d6ff15caf0a755cc0729d29474a5ae4a6a3 /lwlib
parentff6ec81d6dd564080d8407c0a0eae36461b3b75d (diff)
Prefer tail calls.
* lib-src/ebrowse.c (xstrdup): * lib-src/etags.c (savenstr): * lwlib/lwlib.c (safe_strdup): * src/xfns.c (xic_create_fontsetname): * src/xrdb.c (gethomedir): Prefer tail calls. * lib-src/etags.c (concat): Omit unnecessary assignment.
Diffstat (limited to 'lwlib')
-rw-r--r--lwlib/ChangeLog4
-rw-r--r--lwlib/lwlib.c6
2 files changed, 5 insertions, 5 deletions
diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog
index dadb13514e..e4ab1a91ca 100644
--- a/lwlib/ChangeLog
+++ b/lwlib/ChangeLog
@@ -1,3 +1,7 @@
+2013-11-14 Paul Eggert <eggert@cs.ucla.edu>
+
+ * lwlib.c (safe_strdup): Prefer tail calls.
+
2013-11-02 Glenn Morris <rgm@gnu.org>
Use relative filenames in TAGS files.
diff --git a/lwlib/lwlib.c b/lwlib/lwlib.c
index 7d9920e8bc..c8eba9cf35 100644
--- a/lwlib/lwlib.c
+++ b/lwlib/lwlib.c
@@ -103,11 +103,7 @@ static void show_one_widget_busy (Widget, Boolean);
char *
safe_strdup (const char *s)
{
- char *result;
- if (! s) return 0;
- result = (char *) xmalloc (strlen (s) + 1);
- strcpy (result, s);
- return result;
+ return s ? xstrdup (s) : 0;
}
static void