projects
/
oweals
/
busybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c472898
)
find: code shrink
author
Denys Vlasenko
<vda.linux@googlemail.com>
Wed, 26 Feb 2014 14:27:10 +0000
(15:27 +0100)
committer
Denys Vlasenko
<vda.linux@googlemail.com>
Wed, 26 Feb 2014 14:27:10 +0000
(15:27 +0100)
function old new delta
func_exec 306 285 -21
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
findutils/find.c
patch
|
blob
|
history
diff --git
a/findutils/find.c
b/findutils/find.c
index 5d5e24bfb35a8fa26ca0f2c319c2d25f393dad03..044f010b0321c2346bd872c0461487790f47923d 100644
(file)
--- a/
findutils/find.c
+++ b/
findutils/find.c
@@
-420,12
+420,10
@@
static char* subst(const char *src, unsigned count, const char* filename)
size_t flen = strlen(filename);
/* we replace each '{}' with filename: growth by strlen-2 */
buf = dst = xmalloc(strlen(src) + count*(flen-2) + 1);
- while ((end = strstr(src, "{}"))) {
-
mem
cpy(dst, src, end - src);
- dst
+= end - src
;
+ while ((end = strstr(src, "{}"))
!= NULL
) {
+
dst = memp
cpy(dst, src, end - src);
+ dst
= mempcpy(dst, filename, flen)
;
src = end + 2;
- memcpy(dst, filename, flen);
- dst += flen;
}
strcpy(dst, src);
return buf;