diff options
author | Simon Tatham <anakin@pobox.com> | 2017-05-18 07:03:04 +0100 |
---|---|---|
committer | Simon Tatham <anakin@pobox.com> | 2017-05-18 07:10:17 +0100 |
commit | 48919caa7b9fb99ba8196098c0ca2e1b3dae5160 (patch) | |
tree | 585312e8c0182016e99d8bb35ba12e1c1115ab09 /fake-lib.c | |
parent | 69d886c5757e405785ce811d8622f4ff189a9514 (diff) | |
download | wix-on-linux-48919caa7b9fb99ba8196098c0ca2e1b3dae5160.tar.gz wix-on-linux-48919caa7b9fb99ba8196098c0ca2e1b3dae5160.tar.bz2 wix-on-linux-48919caa7b9fb99ba8196098c0ca2e1b3dae5160.zip |
Move dupcat out into its own file, and add dupstr.
Also a handy #define to replace all those tedious castings of NULL.
Diffstat (limited to 'fake-lib.c')
-rw-r--r-- | fake-lib.c | 25 |
1 files changed, 0 insertions, 25 deletions
@@ -88,28 +88,3 @@ void c16cpy(char16_t *out, uint32_t *outsize, char *s) | |||
88 | } | 88 | } |
89 | *outsize = retlen; | 89 | *outsize = retlen; |
90 | } | 90 | } |
91 | |||
92 | char *dupcat(const char *str, ...) | ||
93 | { | ||
94 | va_list ap; | ||
95 | const char *p; | ||
96 | char *out, *outp; | ||
97 | size_t len; | ||
98 | |||
99 | len = 1; | ||
100 | va_start(ap, str); | ||
101 | for (p = str; p; p = va_arg(ap, const char *)) | ||
102 | len += strlen(p); | ||
103 | va_end(ap); | ||
104 | |||
105 | out = snewn(len, char); | ||
106 | outp = out; | ||
107 | va_start(ap, str); | ||
108 | for (p = str; p; p = va_arg(ap, const char *)) { | ||
109 | strcpy(outp, p); | ||
110 | outp += strlen(p); | ||
111 | } | ||
112 | va_end(ap); | ||
113 | |||
114 | return out; | ||
115 | } | ||