summaryrefslogtreecommitdiffstats
path: root/src/dstring.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/dstring.h')
-rw-r--r--src/dstring.h26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/dstring.h b/src/dstring.h
index 14e1d3e..79458e4 100644
--- a/src/dstring.h
+++ b/src/dstring.h
@@ -8,8 +8,9 @@
#ifndef BFS_DSTRING_H
#define BFS_DSTRING_H
-#include "prelude.h"
+#include "bfs.h"
#include "bfstd.h"
+
#include <stdarg.h>
#include <stddef.h>
@@ -41,7 +42,7 @@ void dstrfree(dchar *dstr);
* @param cap
* The initial capacity of the string.
*/
-attr(malloc(dstrfree, 1))
+_malloc(dstrfree, 1)
dchar *dstralloc(size_t cap);
/**
@@ -50,7 +51,7 @@ dchar *dstralloc(size_t cap);
* @param str
* The NUL-terminated string to copy.
*/
-attr(malloc(dstrfree, 1))
+_malloc(dstrfree, 1)
dchar *dstrdup(const char *str);
/**
@@ -61,7 +62,7 @@ dchar *dstrdup(const char *str);
* @param n
* The maximum number of characters to copy from str.
*/
-attr(malloc(dstrfree, 1))
+_malloc(dstrfree, 1)
dchar *dstrndup(const char *str, size_t n);
/**
@@ -70,7 +71,7 @@ dchar *dstrndup(const char *str, size_t n);
* @param dstr
* The dynamic string to copy.
*/
-attr(malloc(dstrfree, 1))
+_malloc(dstrfree, 1)
dchar *dstrddup(const dchar *dstr);
/**
@@ -81,7 +82,7 @@ dchar *dstrddup(const dchar *dstr);
* @param len
* The length of the string, which may include internal NUL bytes.
*/
-attr(malloc(dstrfree, 1))
+_malloc(dstrfree, 1)
dchar *dstrxdup(const char *str, size_t len);
/**
@@ -243,7 +244,7 @@ int dstrxcpy(dchar **dest, const char *str, size_t len);
* @return
* The created string, or NULL on failure.
*/
-attr(printf(1, 2))
+_printf(1, 2)
dchar *dstrprintf(const char *format, ...);
/**
@@ -256,7 +257,7 @@ dchar *dstrprintf(const char *format, ...);
* @return
* The created string, or NULL on failure.
*/
-attr(printf(1, 0))
+_printf(1, 0)
dchar *dstrvprintf(const char *format, va_list args);
/**
@@ -271,7 +272,7 @@ dchar *dstrvprintf(const char *format, va_list args);
* @return
* 0 on success, -1 on failure.
*/
-attr(printf(2, 3))
+_printf(2, 3)
int dstrcatf(dchar **str, const char *format, ...);
/**
@@ -286,7 +287,7 @@ int dstrcatf(dchar **str, const char *format, ...);
* @return
* 0 on success, -1 on failure.
*/
-attr(printf(2, 0))
+_printf(2, 0)
int dstrvcatf(dchar **str, const char *format, va_list args);
/**
@@ -319,4 +320,9 @@ int dstrescat(dchar **dest, const char *str, enum wesc_flags flags);
*/
int dstrnescat(dchar **dest, const char *str, size_t n, enum wesc_flags flags);
+/**
+ * Repeat a string n times.
+ */
+dchar *dstrepeat(const char *str, size_t n);
+
#endif // BFS_DSTRING_H