diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2018-10-01 20:52:18 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2018-10-01 20:52:28 -0700 |
commit | 3b747cc5d2981c44ff517f64c355e76d70194f24 (patch) | |
tree | a95195ce970c141ad57801f7ae142f82f817a3ca | |
parent | 65fe4ef6f5674b0b52e797924990b090dbbd52af (diff) |
Replace dsprintf("%s", s) with strdup(s)
dsprintf is an allocating sprintf. With a format string of "%s", it
reduces to just being a more complicated version of strdup, so lets
just use strdup instead to save time and reduce complexity.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | mkfontscale.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/mkfontscale.c b/mkfontscale.c index c2e1255..9e5c01c 100644 --- a/mkfontscale.c +++ b/mkfontscale.c @@ -154,7 +154,7 @@ main(int argc, char **argv) if(prefix[strlen(prefix) - 1] != '/') encodingPrefix = dsprintf("%s/", prefix); else - encodingPrefix = dsprintf("%s", prefix); + encodingPrefix = strdup(prefix); outfilename = NULL; @@ -200,7 +200,7 @@ main(int argc, char **argv) usage(); } free(encodingPrefix); - encodingPrefix = dsprintf("%s", argv[argn + 1]); + encodingPrefix = strdup(argv[argn + 1]); argn += 2; } else if(strcmp(argv[argn], "-e") == 0) { if(argn >= argc - 1) { @@ -797,7 +797,7 @@ doDirectory(const char *dirname_given, int numEncodings, ListPtr encodingsToDo) else if(dirname_given[i - 1] != '/') dirname = dsprintf("%s/", dirname_given); else - dirname = dsprintf("%s", dirname_given); + dirname = strdup(dirname_given); if(dirname == NULL) { perror("dirname"); @@ -816,7 +816,7 @@ doDirectory(const char *dirname_given, int numEncodings, ListPtr encodingsToDo) fontscale_name = NULL; else { if(outfilename[0] == '/') - fontscale_name = dsprintf("%s", outfilename); + fontscale_name = strdup(outfilename); else fontscale_name = dsprintf("%s%s", dirname, outfilename); if(fontscale_name == NULL) { |