summaryrefslogtreecommitdiff
path: root/Src/Zle/compresult.c
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2025-01-30 12:30:40 +0100
committerOliver Kiddle <opk@zsh.org>2025-01-30 12:30:40 +0100
commitf7b5cc431bdda1f7123aca740bf7c535b98ca616 (patch)
tree4cdf1304b1a709b8ed7ae8284e334098b3df3921 /Src/Zle/compresult.c
parent4f3d69e2a0bc6b4d98a4aa3ef37ebea44cbda51f (diff)
downloadzsh-f7b5cc431bdda1f7123aca740bf7c535b98ca616.tar.gz
zsh-f7b5cc431bdda1f7123aca740bf7c535b98ca616.zip
53332, 53334: Avoid strlen calls after sprintf
Diffstat (limited to 'Src/Zle/compresult.c')
-rw-r--r--Src/Zle/compresult.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c
index cd8c7dd64..7dbc5676a 100644
--- a/Src/Zle/compresult.c
+++ b/Src/Zle/compresult.c
@@ -489,7 +489,7 @@ static char *
build_pos_string(LinkList list)
{
LinkNode node;
- int l;
+ int l, buflen;
char buf[40], *s;
long p;
@@ -499,12 +499,12 @@ build_pos_string(LinkList list)
/* This could be used to put an extra colon before the end-of-word
* position if there is nothing missing. */
if (p < 0)
- sprintf(buf, ":%ld", -p);
+ buflen = sprintf(buf, ":%ld", -p);
else
#endif
- sprintf(buf, "%ld", p);
- setdata(node, dupstring(buf));
- l += 1 + strlen(buf);
+ buflen = sprintf(buf, "%ld", p);
+ setdata(node, dupstring_wlen(buf, buflen));
+ l += 1 + buflen;
}
s = (char *) zalloc(l * sizeof(char));
*s = 0;