This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=deca62bf8f20c62e9acfe02eacf295d08a4af184

commit deca62bf8f20c62e9acfe02eacf295d08a4af184
Author: Guillem Jover <[email protected]>
AuthorDate: Wed Jul 12 04:25:48 2023 +0200

    libdpkg: Switch ustar filename construction to use varbuf_add_strn()
    
    Use varbuf instead of formatting via str_fmt(), which should be more
    performant.
---
 lib/dpkg/tarfn.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/dpkg/tarfn.c b/lib/dpkg/tarfn.c
index c1a711c10..bc39acd7d 100644
--- a/lib/dpkg/tarfn.c
+++ b/lib/dpkg/tarfn.c
@@ -204,8 +204,14 @@ tar_atosl(const char *s, size_t size, intmax_t min, 
intmax_t max)
 static char *
 tar_header_get_prefix_name(struct tar_header *h)
 {
-       return str_fmt("%.*s/%.*s", (int)sizeof(h->prefix), h->prefix,
-                      (int)sizeof(h->name), h->name);
+       struct varbuf path = VARBUF_INIT;
+
+       varbuf_add_strn(&path, h->prefix, sizeof(h->prefix));
+       varbuf_add_char(&path, '/');
+       varbuf_add_strn(&path, h->name, sizeof(h->name));
+       varbuf_end_str(&path);
+
+       return path.buf;
 }
 
 static mode_t

-- 
Dpkg.Org's dpkg

Reply via email to