sds
sds copied to clipboard
Simple Dynamic Strings library for C
Addressing issue : 'realloc may return NULL #23'
Hi @antirez, according to the `man page` ``` realloc() returns a pointer to the newly allocated memory, which is suitably aligned for any kind of variable and may be different...
Doing so enormously simplifies error handling; you no longer have to check for memory allocation errors in a chain of sds function calls, only after the last call.
The idea is that `sds.c` gets compiled with a C99 compliant compiler, and a C++ program then uses it. To do so, it needs access to `sds.h`, and this commit...
I think having `extern "C"` is common for C libraries...
Improved patch for issue #11.
Hi Salvatore. Thanks for releasing this. You should consider using the GCC (and compatible) attribute "warn_unused_result" on the functions that may call realloc(). http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html#index-g_t_0040code_007bwarn_005funused_005fresult_007d-attribute-2997 It's not a perfect backstop, but...
I wonder if "BDS two clause license" is a spelling mistake or if there is indeed a license called "BDS two clause license".
sdsrange(str, 0, -2) should result in an empty string. For example sds str = sdsnew("hello"); while (sdslen(str) > 0) str = sdsrange(str, 0, -2); Would result in an inifinty loop...