diff options
author | pommicket <pommicket@gmail.com> | 2022-12-06 14:29:40 -0500 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2022-12-06 14:29:40 -0500 |
commit | 80400babc4a95edc4e4c96e85af79301cdffae69 (patch) | |
tree | b7af6472c2c4a175edb398f22a426526265e4b42 /util.c | |
parent | ac3a7a0c40864339b4c94ab3f58f8dd5d144ed2e (diff) |
more work on lsp
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -97,6 +97,19 @@ static char *str_dup(char const *src) { #define strbuf_catf(str, ...) assert(sizeof str != 4 && sizeof str != 8), \ str_catf(str, sizeof str, __VA_ARGS__) +#if __unix__ +static char *a_sprintf(const char *fmt, ...) ATTRIBUTE_PRINTF(1, 2); +static char *a_sprintf(const char *fmt, ...) { + va_list args; + va_start(args, fmt); + char *str = NULL; + vasprintf(&str, fmt, args); + return str; +} +#else +#error "@TODO" +#endif + // on 16-bit systems, this is 16383. on 32/64-bit systems, this is 1073741823 // it is unusual to have a string that long. #define STRLEN_SAFE_MAX (UINT_MAX >> 2) |