diff options
author | Benny Baumann <BenBE@geshi.org> | 2020-09-19 20:22:34 +0200 |
---|---|---|
committer | Benny Baumann <BenBE@geshi.org> | 2020-10-16 20:29:45 +0200 |
commit | c6f04a9c5d33d16623f1c20f0987dd3a992379e7 (patch) | |
tree | 9e00e160a1eea3d99ac9348cc5f56b45376e7279 /XAlloc.c | |
parent | 7cd093ce95c1f59cfc1ee2786578457ea6fa1559 (diff) |
Move xAsprintf, xSnprintf and xStrdup to StringUtils.h
Diffstat (limited to 'XAlloc.c')
-rw-r--r-- | XAlloc.c | 34 |
1 files changed, 0 insertions, 34 deletions
@@ -40,37 +40,3 @@ void* xRealloc(void* ptr, size_t size) { } return data; } - -int xAsprintf(char** strp, const char* fmt, ...) { - va_list vl; - va_start(vl, fmt); - int _r = vasprintf(strp, fmt, vl); - va_end(vl); - - if (_r < 0) { - fail(); - } - - return _r; -} - -int xSnprintf(char* buf, int len, const char* fmt, ...) { - va_list vl; - va_start(vl, fmt); - int _n=vsnprintf(buf, len, fmt, vl); - va_end(vl); - - if (!(_n > -1 && _n < len)) { - fail(); - } - - return _n; -} - -char* xStrdup(const char* str) { - char* data = strdup(str); - if (!data) { - fail(); - } - return data; -} |