From: Petr Machata Date: Wed, 6 Nov 2013 10:59:59 +0000 (+0100) Subject: Replace a chain of stpcpy's with a sprintf X-Git-Tag: accepted/tizen/common/20140822.152031~134 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=23040c1b38cbc4488dd1c9877b3195b43c6fd0e0;p=platform%2Fupstream%2Fltrace.git Replace a chain of stpcpy's with a sprintf - That's clearer and doesn't require _POSIX_SOURCE defines (that are missing anyway) --- diff --git a/prototype.c b/prototype.c index a892666..fa52ff3 100644 --- a/prototype.c +++ b/prototype.c @@ -342,9 +342,8 @@ consider_config_dir(struct protolib_cache *cache, const char *path, const char *key) { size_t len = sizeof ".conf"; - char slash[2] = {'/'}; char *buf = alloca(strlen(path) + 1 + strlen(key) + len); - strcpy(stpcpy(stpcpy(stpcpy(buf, path), slash), key), ".conf"); + sprintf(buf, "%s/%s.conf", path, key); return protolib_cache_file(cache, buf, 0); }