summaryrefslogtreecommitdiffhomepage
path: root/cstring.h
diff options
context:
space:
mode:
authortylo <[email protected]>2020-03-11 10:47:54 +0100
committertylo <[email protected]>2020-03-11 10:47:54 +0100
commit7c326f3effd9977cb34e23d9cc9e9eb42ae3c789 (patch)
treec12515d78af541bc12c5726869c0ed811d5ad9ab /cstring.h
parenta191ceeaf2e44a73c83304e4a08d535900f0bc8d (diff)
downloadSTC-modified-7c326f3effd9977cb34e23d9cc9e9eb42ae3c789.tar.gz
STC-modified-7c326f3effd9977cb34e23d9cc9e9eb42ae3c789.zip
Renamed cdef.h to cdefs.h including symbols inside.
Diffstat (limited to 'cstring.h')
-rw-r--r--cstring.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/cstring.h b/cstring.h
index f877847c..bfffe2e3 100644
--- a/cstring.h
+++ b/cstring.h
@@ -25,11 +25,10 @@
#include <malloc.h>
#include <stdbool.h>
-#include <assert.h>
#include <string.h>
#include <stdint.h>
-#include "cdef.h"
+#include "cdefs.h"
typedef struct CString {
char* str;
@@ -138,10 +137,10 @@ static inline void _cstring_internalMove(CString* self, size_t pos1, size_t pos2
}
static inline void cstring_insertN(CString* self, size_t pos, const char* str, size_t n) {
- char* xstr = (char *) memcpy(n > cdef_max_alloca ? malloc(n) : alloca(n), str, n);
+ char* xstr = (char *) memcpy(n > cdefs_max_alloca ? malloc(n) : alloca(n), str, n);
_cstring_internalMove(self, pos, pos + n);
memcpy(&self->str[pos], xstr, n);
- if (n > cdef_max_alloca) free(xstr);
+ if (n > cdefs_max_alloca) free(xstr);
}
static inline void cstring_insert(CString* self, size_t pos, const char* str) {
@@ -161,10 +160,10 @@ static inline size_t cstring_findN(CString cs, size_t pos, const char* needle, s
static inline size_t cstring_replaceN(CString* self, size_t pos, const char* s1, size_t n1, const char* s2, size_t n2) {
size_t pos2 = cstring_findN(*self, pos, s1, n1);
if (pos2 == cstring_npos) return cstring_npos;
- char* xs2 = (char *) memcpy(n2 > cdef_max_alloca ? malloc(n2) : alloca(n2), s2, n2);
+ char* xs2 = (char *) memcpy(n2 > cdefs_max_alloca ? malloc(n2) : alloca(n2), s2, n2);
_cstring_internalMove(self, pos2 + n1, pos2 + n2);
memcpy(&self->str[pos2], xs2, n2);
- if (n2 > cdef_max_alloca) free(xs2);
+ if (n2 > cdefs_max_alloca) free(xs2);
return pos2;
}
@@ -238,7 +237,7 @@ static inline char* cstring_splitNext(const char* delimiters) {
// CVector / CMap API functions:
#define cstring_getRaw(x) ((x).str)
-static inline uint32_t cstring_hashRaw(const char** str, size_t sz_ignored) { return cdef_murmurHash(*str, strlen(*str)); }
+static inline uint32_t cstring_hashRaw(const char** str, size_t sz_ignored) { return cdefs_murmurHash(*str, strlen(*str)); }
static inline int cstring_compareRaw(CString* self, const char** str, size_t sz_ignored) { return strcmp(self->str, *str); }