diff options
author | Wojtek Kosior <koszko@koszko.org> | 2021-08-07 16:58:11 +0200 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2021-08-07 17:01:19 +0200 |
commit | 939c0c2e799734d46e3c3b784545f7c0c489c191 (patch) | |
tree | 9e308bf45b1c5ad015409198d141fc8cae1dbd95 /string_buf.h | |
parent | e3c86f7ff37de0af10b4165216da14bf0f91dc0b (diff) | |
download | hydrilla-939c0c2e799734d46e3c3b784545f7c0c489c191.tar.gz hydrilla-939c0c2e799734d46e3c3b784545f7c0c489c191.zip |
migrate to Autotools
Diffstat (limited to 'string_buf.h')
-rw-r--r-- | string_buf.h | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/string_buf.h b/string_buf.h deleted file mode 100644 index 160b7cb..0000000 --- a/string_buf.h +++ /dev/null @@ -1,59 +0,0 @@ -/** - * C string buffers for easy construction of complex strings - * - * Copyright (C) 2021 Wojtek Kosior - * Redistribution terms are gathered in the `copyright' file. - */ - -#ifndef STRING_BUF_H -#define STRING_BUF_H - -#include <stdio.h> -#include <stdarg.h> - -struct stringbuf { - char *buf; - size_t buf_len; - size_t buf_filled; -}; - -void stringbuf_init(struct stringbuf *sb); -void stringbuf_destroy(struct stringbuf *sb); -void stringbuf_truncate(struct stringbuf *sb, size_t len); - -#define _RAW_BUF_ARGS char **buf, size_t *buf_len, size_t *buf_filled - -#define _SB_HEAD(name, ...) \ - int sb_##name(struct stringbuf *sb, __VA_ARGS__) - -#define _SB_RAW_HEAD(name, ...) \ - int sb_raw_##name(_RAW_BUF_ARGS, __VA_ARGS__) - -#define _SB_DEFINE_2(name, ...) \ - _SB_HEAD(name, __VA_ARGS__); \ - _SB_RAW_HEAD(name, __VA_ARGS__) - -int extend_buf_raw(_RAW_BUF_ARGS, size_t extend_len); -int extend_buf(struct stringbuf *sb, size_t extend_len); - -int crop_buf_raw(_RAW_BUF_ARGS); -int crop_buf(struct stringbuf *sb); - -_SB_DEFINE_2(bytes, const void *bytes, size_t bytes_len); -_SB_DEFINE_2(string, const char *string); -_SB_DEFINE_2(char, char c); -_SB_DEFINE_2(long, long num); -_SB_DEFINE_2(file, FILE *file); -_SB_DEFINE_2(filepath, const char *path); -_SB_DEFINE_2(vsprintf, const char *fmt, va_list ap); -_SB_DEFINE_2(sprintf, const char *fmt, ...); - -#undef _SB_DEFINE_2 - -#ifndef STRING_BUF_C -#undef _RAW_BUF_ARGS -#undef _SB_HEAD -#undef _SB_RAW_HEAD -#endif - -#endif /* STRING_BUF_H */ |