summaryrefslogtreecommitdiffstats
path: root/src/dstring.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-11-23 13:13:07 -0500
committerTavian Barnes <tavianator@tavianator.com>2023-11-23 13:56:03 -0500
commit181e045f0c02d530060d453055934c0d542ed341 (patch)
tree072be503710b03f202734c218408d118ab326b0b /src/dstring.h
parentae18c20d5a585ae4bc1e9ee6859230fee7f73ed8 (diff)
downloadbfs-181e045f0c02d530060d453055934c0d542ed341.tar.xz
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.
Diffstat (limited to 'src/dstring.h')
-rw-r--r--src/dstring.h12
1 files changed, 6 insertions, 6 deletions
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.