summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2020-07-16 16:53:00 +0200
committerTyge Løvset <[email protected]>2020-07-16 16:53:00 +0200
commit1d8b2adc084d684b90ec525e342b7a3a159a0474 (patch)
tree05901c8547a91d48485f5fd86d0358b56b4bd826
parentd75429864d14e744d251a7393d505584701f61cc (diff)
downloadSTC-modified-1d8b2adc084d684b90ec525e342b7a3a159a0474.tar.gz
STC-modified-1d8b2adc084d684b90ec525e342b7a3a159a0474.zip
Renamed cstring_release to cstring_move, and removed old cstring_move func.
-rw-r--r--stc/chash.h2
-rw-r--r--stc/cstring.h15
2 files changed, 6 insertions, 11 deletions
diff --git a/stc/chash.h b/stc/chash.h
index 8cc6fbb4..aa6ceadc 100644
--- a/stc/chash.h
+++ b/stc/chash.h
@@ -237,7 +237,7 @@ chash_##tag##_bucket(const CHash_##tag* self, const CHashRawKey_##tag* rawKeyPtr
\
STC_API CHashEntry_##tag* \
chash_##tag##_get(const CHash_##tag* self, CHashRawKey_##tag rawKey) { \
- if (chash_bucketCount(*self) == 0) return NULL; \
+ if (chash_size(*self) == 0) return NULL; \
uint32_t hx; \
size_t idx = chash_##tag##_bucket(self, &rawKey, &hx); \
return self->_hashx[idx] ? &self->table[idx] : NULL; \
diff --git a/stc/cstring.h b/stc/cstring.h
index ca22c4d5..5ce9b868 100644
--- a/stc/cstring.h
+++ b/stc/cstring.h
@@ -162,19 +162,11 @@ cstring_take(CString* self, CString s) {
}
static inline CString
-cstring_release(CString* self) {
+cstring_move(CString* self) {
CString tmp = *self;
*self = cstring_init;
return tmp;
}
-/* cstring_move(&s1, &s2) short for: cstring_take(&s1, cstring_release(&s2)) */
-static inline CString*
-cstring_move(CString* self, CString* s) {
- cstring_take(self, *s);
- *s = cstring_init;
- return self;
-}
-
static inline CString*
cstring_appendN(CString* self, const char* str, size_t len) {
@@ -187,12 +179,15 @@ cstring_appendN(CString* self, const char* str, size_t len) {
}
return self;
}
-
static inline CString*
cstring_append(CString* self, const char* str) {
return cstring_appendN(self, str, strlen(str));
}
static inline CString*
+cstring_appendC(CString* self, char ch) {
+ return cstring_appendN(self, &ch, 1);
+}
+static inline CString*
cstring_appendS(CString* self, CString s) {
return cstring_appendN(self, s.str, cstring_size(s));
}