diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2008-03-09 08:58:38 +0000 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2008-03-09 08:58:38 +0000 |
commit | da23c8c5a188324455c8f417293c10d85f65cb63 (patch) | |
tree | d7a4b8cb0af705de6650e20e00ba3da04d84b27f /String.c | |
parent | 12f4f09e6ed288bdedc86e4ef22f3cc34f0e787a (diff) |
Clean up headers by using 'static' whenever possible.
Reduces resulting code size.
Diffstat (limited to 'String.c')
-rw-r--r-- | String.c | 55 |
1 files changed, 0 insertions, 55 deletions
@@ -18,10 +18,6 @@ in the source distribution for its full text. #define String_startsWith(s, match) (strstr((s), (match)) == (s)) }*/ -inline void String_delete(char* s) { - free(s); -} - inline char* String_copy(char* orig) { return strdup(orig); } @@ -49,53 +45,6 @@ char* String_trim(char* in) { return out; } -char* String_copyUpTo(char* orig, char upTo) { - int len; - - int origLen = strlen(orig); - char* at = strchr(orig, upTo); - if (at != NULL) - len = at - orig; - else - len = origLen; - char* copy = (char*) malloc(len+1); - strncpy(copy, orig, len); - copy[len] = '\0'; - return copy; -} - -char* String_sub(char* orig, int from, int to) { - char* copy; - int len; - - len = strlen(orig); - if (to > len) - to = len; - if (from > len) - to = len; - len = to-from+1; - copy = (char*) malloc(len+1); - strncpy(copy, orig+from, len); - copy[len] = '\0'; - return copy; -} - -void String_println(char* s) { - printf("%s\n", s); -} - -void String_print(char* s) { - printf("%s", s); -} - -void String_printInt(int i) { - printf("%i", i); -} - -void String_printPointer(void* p) { - printf("%p", p); -} - inline int String_eq(const char* s1, const char* s2) { if (s1 == NULL || s2 == NULL) { if (s1 == NULL && s2 == NULL) @@ -144,10 +93,6 @@ void String_freeArray(char** s) { free(s); } -int String_startsWith_i(char* s, char* match) { - return (strncasecmp(s, match, strlen(match)) == 0); -} - int String_contains_i(char* s, char* match) { int lens = strlen(s); int lenmatch = strlen(match); |