diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2019-05-23 17:03:17 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2019-05-23 17:03:17 -0400 |
commit | 28bbaeac8058653a4a46ae439c37d251a550f4f9 (patch) | |
tree | 558ad73913a747c1e59b1ac582f5fca0ed20708d /dstring.h | |
parent | ecd079c32272783144d881647f81eea8cce39386 (diff) | |
download | bfs-28bbaeac8058653a4a46ae439c37d251a550f4f9.tar.xz |
dstring: Add a printf()-style creation API
Diffstat (limited to 'dstring.h')
-rw-r--r-- | dstring.h | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -21,6 +21,7 @@ #ifndef BFS_DSTRING_H #define BFS_DSTRING_H +#include "util.h" #include <stddef.h> /** @@ -106,6 +107,19 @@ int dstrncat(char **dest, const char *src, size_t n); int dstrapp(char **str, char c); /** + * Create a dynamic string from a format string. + * + * @param format + * The format string to fill in. + * @param ... + * Any arguments for the format string. + * @return + * The created string, or NULL on failure. + */ +BFS_FORMATTER(1, 2) +char *dstrprintf(const char *format, ...); + +/** * Free a dynamic string. * * @param dstr |