From 181e045f0c02d530060d453055934c0d542ed341 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Thu, 23 Nov 2023 13:13:07 -0500 Subject: dstring: Use the new REALLOC_FLEX() macro While I'm at it, switch the capacity to include the NUL byte, so that it could be used by __counted_by() for example. And fix a theoretical provenance issue. --- src/dstring.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/dstring.h') diff --git a/src/dstring.h b/src/dstring.h index 07b4ee9..2a94438 100644 --- a/src/dstring.h +++ b/src/dstring.h @@ -38,11 +38,11 @@ void dstrfree(dchar *dstr); /** * Allocate a dynamic string. * - * @param capacity + * @param cap * The initial capacity of the string. */ attr_malloc(dstrfree, 1) -dchar *dstralloc(size_t capacity); +dchar *dstralloc(size_t cap); /** * Create a dynamic copy of a string. @@ -99,24 +99,24 @@ size_t dstrlen(const dchar *dstr); * * @param dstr * The dynamic string to preallocate. - * @param capacity + * @param cap * The new capacity for the string. * @return * 0 on success, -1 on failure. */ -int dstreserve(dchar **dstr, size_t capacity); +int dstreserve(dchar **dstr, size_t cap); /** * Resize a dynamic string. * * @param dstr * The dynamic string to resize. - * @param length + * @param len * The new length for the dynamic string. * @return * 0 on success, -1 on failure. */ -int dstresize(dchar **dstr, size_t length); +int dstresize(dchar **dstr, size_t len); /** * Append to a dynamic string. -- cgit v1.2.3