/* SDSLib, A C dynamic strings library
*
- * Copyright (c) 2006-2009, Salvatore Sanfilippo <antirez at gmail dot com>
+ * Copyright (c) 2006-2010, Salvatore Sanfilippo <antirez at gmail dot com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#define __SDS_H
#include <sys/types.h>
-#include <limits.h>
typedef char *sds;
struct sdshdr {
- int len;
- unsigned short free;
- unsigned short _len; /* USHRT_MAX if it is a "long" sds string */
+ long len;
+ long free;
char buf[];
};
sds sdscat(sds s, char *t);
sds sdscpylen(sds s, char *t, size_t len);
sds sdscpy(sds s, char *t);
+
+#ifdef __GNUC__
+sds sdscatprintf(sds s, const char *fmt, ...)
+ __attribute__((format(printf, 2, 3)));
+#else
sds sdscatprintf(sds s, const char *fmt, ...);
+#endif
+
sds sdstrim(sds s, const char *cset);
sds sdsrange(sds s, long start, long end);
void sdsupdatelen(sds s);
int sdscmp(sds s1, sds s2);
sds *sdssplitlen(char *s, int len, char *sep, int seplen, int *count);
+void sdsfreesplitres(sds *tokens, int count);
void sdstolower(sds s);
+void sdstoupper(sds s);
+sds sdsfromlonglong(long long value);
#endif