Commit d672ac3c authored by Paul Eggert's avatar Paul Eggert

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.
parent ff6ec81d
2013-11-14 Paul Eggert <eggert@cs.ucla.edu>
* ebrowse.c (xstrdup):
* etags.c (savenstr): Prefer tail calls.
* etags.c (concat): Omit unnecessary assignment.
2013-10-24 Glenn Morris <rgm@gnu.org>
* Makefile.in ($(DESTDIR)${archlibdir}):
......
......@@ -514,7 +514,7 @@ static char *
xstrdup (char *s)
{
if (s)
s = strcpy (xmalloc (strlen (s) + 1), s);
return strcpy (xmalloc (strlen (s) + 1), s);
return s;
}
......
......@@ -6243,12 +6243,9 @@ savestr (const char *cp)
static char *
savenstr (const char *cp, int len)
{
register char *dp;
dp = xnew (len + 1, char);
memcpy (dp, cp, len);
char *dp = xnew (len + 1, char);
dp[len] = '\0';
return dp;
return memcpy (dp, cp, len);
}
/*
......@@ -6362,7 +6359,6 @@ concat (const char *s1, const char *s2, const char *s3)
strcpy (result, s1);
strcpy (result + len1, s2);
strcpy (result + len1 + len2, s3);
result[len1 + len2 + len3] = '\0';
return result;
}
......
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.
......
......@@ -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
......
2013-11-14 Paul Eggert <eggert@cs.ucla.edu>
* xfns.c (xic_create_fontsetname):
* xrdb.c (gethomedir): Prefer tail calls.
2013-11-12 Paul Eggert <eggert@cs.ucla.edu>
* xterm.c (syms_of_xterm): staticpro Qmodifier_value, Qalt, Qhyper,
......
......@@ -1750,7 +1750,7 @@ xic_create_fontsetname (const char *base_fontname, int motif)
}
}
if (motif)
strcat (fontsetname, ":");
return strcat (fontsetname, ":");
return fontsetname;
}
#endif /* HAVE_X_WINDOWS && USE_X_TOOLKIT */
......
......@@ -234,9 +234,7 @@ gethomedir (void)
copy = xmalloc (strlen (ptr) + 2);
strcpy (copy, ptr);
strcat (copy, "/");
return copy;
return strcat (copy, "/");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment