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:
a7f1a36
)
bc: optimize bc_vec_concat()
author
Denys Vlasenko
<vda.linux@googlemail.com>
Mon, 10 Dec 2018 14:12:58 +0000
(15:12 +0100)
committer
Denys Vlasenko
<vda.linux@googlemail.com>
Mon, 10 Dec 2018 14:12:58 +0000
(15:12 +0100)
function old new delta
bc_vec_concat 71 66 -5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
miscutils/bc.c
patch
|
blob
|
history
diff --git
a/miscutils/bc.c
b/miscutils/bc.c
index afd5c8d0e7e83ee38e18ac42548f45988a6879e2..71022569e420893843d49125af83b2f275bc69e0 100644
(file)
--- a/
miscutils/bc.c
+++ b/
miscutils/bc.c
@@
-1165,13
+1165,14
@@
static void bc_vec_string(BcVec *v, size_t len, const char *str)
static void bc_vec_concat(BcVec *v, const char *str)
{
- size_t len;
+ size_t len
, slen
;
if (v->len == 0) bc_vec_pushZeroByte(v);
- len = v->len + strlen(str);
+ slen = strlen(str);
+ len = v->len + slen;
- if (v->cap < len) bc_vec_grow(v,
len - v->
len);
+ if (v->cap < len) bc_vec_grow(v,
s
len);
strcpy(v->v + v->len - 1, str);
v->len = len;