aboutsummaryrefslogtreecommitdiffstats
path: root/src/sds.h
AgeCommit message (Collapse)AuthorFilesLines
2015-01-19Rename sdsnewlen to sdsnew, add inline sdsautoJohannes Löthberg1-17/+26
Warning: this commit introduces a breaking change to the public API. The job of the old sdsnew function is replaced with the sdsauto inline function.
2015-01-19sds.h: Reorder function prototypes in groupsJohannes Löthberg1-37/+56
2015-01-19sdsfreesplitres: Change count arg to size_tJohannes Löthberg1-1/+1
This makes it match sdssplitlen
2015-01-19sdssplitlen: Change length arguments to size_tJohannes Löthberg1-1/+1
2015-01-19sdsheader: cast pointer through void pointerJohannes Löthberg1-1/+3
Because a char* and struct sdshdr pointer have a different alignment you get the following warning when try to cast it directly: warning: cast from 'sds' (aka 'char *') to 'struct sdshdr *' increases required alignment from 1 to 8 [-Wcast-align] To silence the warning we cast it to a void pointer first.
2015-01-19sdsIncrLen: change incr argument to size_tJohannes Löthberg1-1/+1
2015-01-19sdsrange: change start/end args to ptrdiff_tJohannes Löthberg1-1/+1
An sds string can hold a much bigger value than an int can hold, but since size_t is unsigned it can’t be used for this function. Using ptrdiff_t limits the function to work on roughly 1 Exabyte long strings, but if you need to work with longer ones you probably will have your custom string library already.
2015-01-19sds.h: Change len and free to size_tJohannes Löthberg1-2/+3
2015-01-18sds.{c,h}: Sort includesJohannes Löthberg1-1/+1
2015-01-18sds.h: len/avail: remove unnecessary temp varJohannes Löthberg1-4/+2
Use the returned value of sdsheader directly in the return call instead of using a temporary variable since we’re not doing pointer arithmetic directly in the sdslen and sdsavail functions anymore.
2015-01-17Reindent with tabs.Johannes Löthberg1-8/+8
All source code should be indented with tabs and aligned with spaces. When talking about line length a tab equals 4 spaces.
2015-01-17sds.c Replace all in-place calculations with sdsheaderJohannes Löthberg1-2/+2
2015-01-17sds.h: Add inline function for getting the sdshdrJohannes Löthberg1-0/+4
2015-01-17sds.h: Clean up sdshdr struct pointer arithmeticJohannes Löthberg1-2/+2
Remove the unnecessary casting of the pointer arithmetic result in sdslen and sdsavail to a void pointer since it will already be an sdshdr struct.
2015-01-17Revert "SDS Header pointer math rewritten in a more elegant form."Johannes Löthberg1-2/+2
This reverts commit c636fc6cd25e455a75dca24ac08ba736f62db6c8. This commit was just utterly senseless, all it does is make the code less clear for literally nothing.
2014-12-05sds.h: Don’t use __ in front of include guardJohannes Löthberg1-2/+2
It’s reserved for the implementation and shouldn’t be used.
2014-12-05Replace testsuite with one based on twbctfJohannes Löthberg1-3/+0
2014-12-05Move source files to src dir, use VPATH in MakefileJohannes Löthberg1-0/+101