Namespace all functions
This commit is contained in:
		| @@ -14,7 +14,7 @@ struct dstr { | ||||
|   char buf[]; | ||||
| }; | ||||
|  | ||||
| String *dstr_with_capacity(u64 capacity) { | ||||
| String *wapp_dstr_with_capacity(u64 capacity) { | ||||
|   String *out = (String *)malloc(sizeof(String) + capacity + 1); | ||||
|  | ||||
|   if (!out) { | ||||
| @@ -28,7 +28,7 @@ String *dstr_with_capacity(u64 capacity) { | ||||
|   return out; | ||||
| } | ||||
|  | ||||
| String *dstr_from_string(const char *str) { | ||||
| String *wapp_dstr_from_string(const char *str) { | ||||
|   if (!str) { | ||||
|     return NULL; | ||||
|   } | ||||
| @@ -37,7 +37,7 @@ String *dstr_from_string(const char *str) { | ||||
|  | ||||
|   u64 capacity = length * CAPACITY_SCALAR; | ||||
|  | ||||
|   String *out = dstr_with_capacity(capacity); | ||||
|   String *out = wapp_dstr_with_capacity(capacity); | ||||
|  | ||||
|   if (!out) { | ||||
|     return NULL; | ||||
| @@ -49,7 +49,7 @@ String *dstr_from_string(const char *str) { | ||||
|   return out; | ||||
| } | ||||
|  | ||||
| void dstr_update(String **dst, const char *src) { | ||||
| void wapp_dstr_update(String **dst, const char *src) { | ||||
|   if (!dst || !(*dst)) { | ||||
|     return; | ||||
|   } | ||||
| @@ -81,7 +81,7 @@ void dstr_update(String **dst, const char *src) { | ||||
|   } | ||||
| } | ||||
|  | ||||
| void dstr_free(String **str) { | ||||
| void wapp_dstr_free(String **str) { | ||||
|   if (!str || !(*str)) { | ||||
|     return; | ||||
|   } | ||||
| @@ -90,7 +90,7 @@ void dstr_free(String **str) { | ||||
|   *str = NULL; | ||||
| } | ||||
|  | ||||
| void dstr_concat(String **dst, const char *src) { | ||||
| void wapp_dstr_concat(String **dst, const char *src) { | ||||
|   if (!dst || !(*dst)) { | ||||
|     return; | ||||
|   } | ||||
| @@ -109,10 +109,10 @@ void dstr_concat(String **dst, const char *src) { | ||||
|   strncpy(str, (*dst)->buf, (*dst)->size); | ||||
|   strncat(str, src, src_length); | ||||
|  | ||||
|   dstr_update(dst, str); | ||||
|   wapp_dstr_update(dst, str); | ||||
| } | ||||
|  | ||||
| void dstr_append(String **dst, char c) { | ||||
| void wapp_dstr_append(String **dst, char c) { | ||||
|   if (!dst || !(*dst)) { | ||||
|     return; | ||||
|   } | ||||
| @@ -125,10 +125,10 @@ void dstr_append(String **dst, char c) { | ||||
|   strncpy(str, (*dst)->buf, (*dst)->size); | ||||
|   str[(*dst)->size] = c; | ||||
|  | ||||
|   dstr_update(dst, str); | ||||
|   wapp_dstr_update(dst, str); | ||||
| } | ||||
|  | ||||
| void dstr_resize(String **str) { | ||||
| void wapp_dstr_resize(String **str) { | ||||
|   if (!str || !(*str)) { | ||||
|     return; | ||||
|   } | ||||
| @@ -146,7 +146,7 @@ void dstr_resize(String **str) { | ||||
|   *str = tmp; | ||||
| } | ||||
|  | ||||
| void dstr_clear(String *str) { | ||||
| void wapp_dstr_clear(String *str) { | ||||
|   if (!str || str->size == 0) { | ||||
|     return; | ||||
|   } | ||||
| @@ -155,7 +155,7 @@ void dstr_clear(String *str) { | ||||
|   str->size = 0; | ||||
| } | ||||
|  | ||||
| void dstr_print(const String *str) { | ||||
| void wapp_dstr_print(const String *str) { | ||||
|   if (!str) { | ||||
|     return; | ||||
|   } | ||||
| @@ -163,7 +163,7 @@ void dstr_print(const String *str) { | ||||
|   printf("%s\n", str->buf); | ||||
| } | ||||
|  | ||||
| i64 dstr_find(const String *str, const char *substr) { | ||||
| i64 wapp_dstr_find(const String *str, const char *substr) { | ||||
|   if (!str || !substr) { | ||||
|     return -1; | ||||
|   } | ||||
| @@ -194,7 +194,7 @@ i64 dstr_find(const String *str, const char *substr) { | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
| u64 dstr_length(const String *str) { | ||||
| u64 wapp_dstr_length(const String *str) { | ||||
|   if (!str) { | ||||
|     return 0; | ||||
|   } | ||||
| @@ -202,7 +202,7 @@ u64 dstr_length(const String *str) { | ||||
|   return str->size; | ||||
| } | ||||
|  | ||||
| u64 dstr_capacity(const String *str) { | ||||
| u64 wapp_dstr_capacity(const String *str) { | ||||
|   if (!str) { | ||||
|     return 0; | ||||
|   } | ||||
| @@ -210,7 +210,7 @@ u64 dstr_capacity(const String *str) { | ||||
|   return str->capacity; | ||||
| } | ||||
|  | ||||
| const char *dstr_to_cstr(const String *str) { | ||||
| const char *wapp_dstr_to_cstr(const String *str) { | ||||
|   if (!str) { | ||||
|     return ""; | ||||
|   } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user