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=426997f8358701a14d03d6890390207c28a009c0 commit 426997f8358701a14d03d6890390207c28a009c0 Author: Guillem Jover <[email protected]> AuthorDate: Fri Jul 21 00:11:30 2023 +0200 libdpkg: Rename varbuf_get_str() to varbuf_str() This shortens a bit the function name so that we can still fit it in long lines without having to wrap them around, and without losing any semantic meaning from its name (it resembles the C++ c_str() member). --- lib/dpkg/libdpkg.map | 2 +- lib/dpkg/t/t-varbuf.c | 8 ++++---- lib/dpkg/varbuf.c | 2 +- lib/dpkg/varbuf.h | 5 +++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/dpkg/libdpkg.map b/lib/dpkg/libdpkg.map index b7bedeffd..b7b5c6ed0 100644 --- a/lib/dpkg/libdpkg.map +++ b/lib/dpkg/libdpkg.map @@ -114,6 +114,7 @@ LIBDPKG_PRIVATE { varbuf_reset; varbuf_grow; varbuf_trunc; + varbuf_str; varbuf_set_varbuf; varbuf_set_buf; varbuf_add_varbuf; @@ -122,7 +123,6 @@ LIBDPKG_PRIVATE { varbuf_map_char; varbuf_add_buf; varbuf_add_dir; - varbuf_get_str; varbuf_end_str; varbuf_printf; varbuf_vprintf; diff --git a/lib/dpkg/t/t-varbuf.c b/lib/dpkg/t/t-varbuf.c index 08998a5a5..b259a197c 100644 --- a/lib/dpkg/t/t-varbuf.c +++ b/lib/dpkg/t/t-varbuf.c @@ -388,7 +388,7 @@ test_varbuf_end_str(void) } static void -test_varbuf_get_str(void) +test_varbuf_str(void) { struct varbuf vb; const char *str; @@ -396,7 +396,7 @@ test_varbuf_get_str(void) varbuf_init(&vb, 10); varbuf_add_buf(&vb, "1234567890", 10); - str = varbuf_get_str(&vb); + str = varbuf_str(&vb); test_pass(vb.buf == str); test_pass(vb.used == 10); test_pass(vb.buf[vb.used] == '\0'); @@ -405,7 +405,7 @@ test_varbuf_get_str(void) test_str(str, ==, "1234567890"); varbuf_add_buf(&vb, "abcde", 5); - str = varbuf_get_str(&vb); + str = varbuf_str(&vb); test_pass(vb.buf == str); test_pass(vb.used == 15); test_pass(vb.buf[vb.used] == '\0'); @@ -550,7 +550,7 @@ TEST_ENTRY(test) test_varbuf_map_char(); test_varbuf_add_dir(); test_varbuf_end_str(); - test_varbuf_get_str(); + test_varbuf_str(); test_varbuf_printf(); test_varbuf_reset(); test_varbuf_snapshot(); diff --git a/lib/dpkg/varbuf.c b/lib/dpkg/varbuf.c index 268a03925..61ac59582 100644 --- a/lib/dpkg/varbuf.c +++ b/lib/dpkg/varbuf.c @@ -92,7 +92,7 @@ varbuf_reset(struct varbuf *v) } const char * -varbuf_get_str(struct varbuf *v) +varbuf_str(struct varbuf *v) { if (v->buf == NULL) return ""; diff --git a/lib/dpkg/varbuf.h b/lib/dpkg/varbuf.h index e58dac5b6..00ecc027d 100644 --- a/lib/dpkg/varbuf.h +++ b/lib/dpkg/varbuf.h @@ -83,6 +83,8 @@ void varbuf_reset(struct varbuf *v); void varbuf_destroy(struct varbuf *v); void varbuf_free(struct varbuf *v); +const char *varbuf_str(struct varbuf *v); + void varbuf_set_varbuf(struct varbuf *v, struct varbuf *other); void varbuf_set_buf(struct varbuf *v, const void *buf, size_t size); #define varbuf_set_str(v, s) varbuf_set_buf(v, s, strlen(s)) @@ -97,7 +99,6 @@ void varbuf_map_char(struct varbuf *v, int c_src, int c_dst); void varbuf_add_dir(struct varbuf *v, const char *dirname); void varbuf_add_buf(struct varbuf *v, const void *s, size_t size); void varbuf_end_str(struct varbuf *v); -const char *varbuf_get_str(struct varbuf *v); int varbuf_printf(struct varbuf *v, const char *fmt, ...) DPKG_ATTR_PRINTF(2); int varbuf_vprintf(struct varbuf *v, const char *fmt, va_list va) @@ -182,7 +183,7 @@ varbuf::operator()(const char *s) inline const char * varbuf::string() { - return varbuf_get_str(this); + return varbuf_str(this); } #endif -- Dpkg.Org's dpkg

