diff options
author | Ron Yorston <rmy@pobox.com> | 2023-04-23 09:00:04 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2023-04-23 09:04:01 +0100 |
commit | 0575aaaa0779812752427badbc0f80a09aac02a4 (patch) | |
tree | 350b636dad1766e43d1d0c7d132a895c3cc2a628 /win32/mingw.c | |
parent | 7b81a44c87cf71dfb4f647ba107624e208ffbefe (diff) | |
download | busybox-w32-0575aaaa0779812752427badbc0f80a09aac02a4.tar.gz busybox-w32-0575aaaa0779812752427badbc0f80a09aac02a4.tar.bz2 busybox-w32-0575aaaa0779812752427badbc0f80a09aac02a4.zip |
win32: export xappendword()
Export the function xappendword() from make. Use it in drop and
watch.
Saves 8-80 bytes, an unusually large disparity.
Diffstat (limited to 'win32/mingw.c')
-rw-r--r-- | win32/mingw.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/win32/mingw.c b/win32/mingw.c index e81f17f11..9e1cf5eea 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
@@ -2389,3 +2389,15 @@ const char *applet_to_exe(const char *name) | |||
2389 | return name; | 2389 | return name; |
2390 | } | 2390 | } |
2391 | #endif | 2391 | #endif |
2392 | |||
2393 | /* | ||
2394 | * Append a word to a space-separated string of words. The first | ||
2395 | * call should use a NULL pointer for str, subsequent calls should | ||
2396 | * pass an allocated string which will be freed. | ||
2397 | */ | ||
2398 | char *xappendword(const char *str, const char *word) | ||
2399 | { | ||
2400 | char *newstr = str ? xasprintf("%s %s", str, word) : xstrdup(word); | ||
2401 | free((void *)str); | ||
2402 | return newstr; | ||
2403 | } | ||