sdsutils /

Filename Size Date modified Message
78 B
1.6 KB
2.2 KB
158 B
9.3 KB
3.3 KB
22.8 KB
3.3 KB
1.1 KB
3.7 KB
523 B
4.3 KB
5.7 KB
8.8 KB
6.0 KB
733 B
8.7 KB
12.9 KB
2.7 KB
14.5 KB
1.5 KB
10.1 KB
1.0 KB
13.7 KB
2.8 KB
3.5 KB
6.5 KB
2.0 KB
Collection of C utils based on the excellent Redis SDSlib string library

This is intended to be used in standalone C programs and has no dependencies
other than libc. This is mostly for the benefit of people who dislike dynamic
library depenencies.

The library supports the normal SDSlib functions and also adds a number of
utility functions based around these including basic file reading, regex
searching (using SLRE), compression (using LZF), encryption (using Blowfish),
and functional list-processing utilities (map/reduce/apply)

There isn't (currently( and documentation other tha the sdsutil.c source code
and the example programs (readfile.c provides a fairly useful example of use of
the library)

NOTE: The library is based on a fairly old version of the zmalloc/sds/list code
from Redis. At some point syncing with head would be a good thing.

License: BSD

The additional functions provided are (from sdsutil.h): 

int sdscount(sds s,char c);
int sdsstartswith(sds s,sds prefix);
int64_t sdsgetint(sds s,int len);
sds sdscatint(sds s,int64_t num,int len);
sds sdsread(FILE *fp,size_t nbyte);
sds sdsreadfile(FILE *fp);
sds sdsreaddelim(FILE *fp,void *delim,int len);
sds sdsreadline(FILE *fp,const char *prompt);
list *sdsmatchre(sds s,struct slre *slre,int ncap);
list *sdsmatch(sds s,char *re);
sds sdssha256(sds s);
sds sdscompress(sds s);
sds sdsdecompress(sds s);
sds sdsencrypt(sds s,sds key,sds iv);
sds sdsdecrypt(sds z,sds key);
sds sdshex(sds s);
sds sdsunhex(sds s);
sds sdsrepr(sds s);
sds sdsunrepr(sds s);
void sdsprintrepr(FILE *fp,char *prefix,sds s,char *suffix);
void sdsprinthex(FILE *fp,char *prefix,sds s,char *suffix);
sds sdsexec(char *cmd);
sds sdspipe(char *cmd,sds input);
list *sdssplit(sds s,sds delim);
sds listJoin(list *l,sds delim);
list *listMap(list *l,void *(*f)(void *data),void (*free)(void *ptr),void *(*dup)(void *));
void listApply(list *l,void *(*f)(void *data));
void listReduce(list *l,void *init,void (*f)(void *acc,void *val));
list *listRange(list *l,int start,int end);
list *listRangeDup(list *l,int start,int end);
list *listFilter(list *l,int (*f)(void *data));
list *listFilterDup(list *l,int (*f)(void *data));