summaryrefslogtreecommitdiffhomepage
path: root/cstring.h
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2020-03-04 22:24:31 +0100
committerGitHub <[email protected]>2020-03-04 22:24:31 +0100
commitfe30df42ee433a17636b02bc2df45337e96f1ced (patch)
treeeb0398609fd526eaeae8a56f22e4419220b7b5b3 /cstring.h
parent35439649c502897049530dad47633d8e9b3af8c6 (diff)
downloadSTC-modified-fe30df42ee433a17636b02bc2df45337e96f1ced.tar.gz
STC-modified-fe30df42ee433a17636b02bc2df45337e96f1ced.zip
Refactoring, cleanup.
Diffstat (limited to 'cstring.h')
-rw-r--r--cstring.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/cstring.h b/cstring.h
index efedf1b6..5d8b8035 100644
--- a/cstring.h
+++ b/cstring.h
@@ -18,7 +18,7 @@ typedef struct CString {
static cstring_size_t _cstring_null_rep[] = {0, 0, 0};
#define _cstring_rep(cs) (((cstring_size_t *) (cs).str) - 2)
-#define cstring_INIT {(char* ) (_cstring_null_rep + 2)}
+#define cstring_initializer {(char* ) (_cstring_null_rep + 2)}
#define cstring_size(cs) ((cstring_size_t) _cstring_rep(cs)[0])
#define cstring_capacity(cs) ((cstring_size_t) _cstring_rep(cs)[1])
@@ -41,12 +41,12 @@ static inline void cstring_destroy(CString* self) {
}
static inline CString cstring_init(void) {
- CString cs = cstring_INIT;
+ CString cs = cstring_initializer;
return cs;
}
static inline CString cstring_makeN(const char* str, cstring_size_t len) {
- CString cs = cstring_INIT;
+ CString cs = cstring_initializer;
if (len) {
cstring_reserve(&cs, len);
memcpy(cs.str, str, len);
@@ -60,12 +60,12 @@ static inline CString cstring_make(const char* str) {
return cstring_makeN(str, strlen(str));
}
-static inline CString cstring_makeCopy(CString cs) {
+static inline CString cstring_clone(CString cs) {
return cstring_makeN(cs.str, cstring_size(cs));
}
static inline void cstring_clear(CString* self) {
- CString cs = cstring_INIT;
+ CString cs = cstring_initializer;
cstring_destroy(self);
*self = cs;
}