Thu, 11 Oct 2012 16:29:30 +0200
removed const from string.*
suncc.mk | file | annotate | diff | comparison | revisions | |
ucx/string.c | file | annotate | diff | comparison | revisions | |
ucx/string.h | file | annotate | diff | comparison | revisions |
1.1 --- a/suncc.mk Thu Oct 11 11:42:31 2012 +0200 1.2 +++ b/suncc.mk Thu Oct 11 16:29:30 2012 +0200 1.3 @@ -31,7 +31,7 @@ 1.4 AR = ar 1.5 RM = rm 1.6 1.7 -CFLAGS = -O -xalias_level=compatible 1.8 +CFLAGS = -O 1.9 LDFLAGS = 1.10 ARFLAGS = -r 1.11 RMFLAGS = -f
2.1 --- a/ucx/string.c Thu Oct 11 11:42:31 2012 +0200 2.2 +++ b/ucx/string.c Thu Oct 11 16:29:30 2012 +0200 2.3 @@ -11,21 +11,21 @@ 2.4 2.5 #include "string.h" 2.6 2.7 -sstr_t sstr (char *s) { 2.8 +sstr_t sstr(char *s) { 2.9 sstr_t string; 2.10 string.ptr = s; 2.11 string.length = strlen(s); 2.12 return string; 2.13 } 2.14 2.15 -sstr_t sstrn (char *s, size_t n) { 2.16 +sstr_t sstrn(char *s, size_t n) { 2.17 sstr_t string; 2.18 string.ptr = s; 2.19 string.length = n; 2.20 return string; 2.21 } 2.22 2.23 -size_t sstrnlen (size_t n, const sstr_t s, ...) { 2.24 +size_t sstrnlen(size_t n, sstr_t s, ...) { 2.25 va_list ap; 2.26 size_t size = s.length; 2.27 va_start(ap, s); 2.28 @@ -39,7 +39,7 @@ 2.29 return size; 2.30 } 2.31 2.32 -sstr_t sstrcat (sstr_t s, ...) { 2.33 +sstr_t sstrcat(sstr_t s, ...) { 2.34 va_list ap; 2.35 va_start(ap, s); 2.36 s.ptr[0] = 0; 2.37 @@ -54,7 +54,7 @@ 2.38 return s; 2.39 } 2.40 2.41 -sstr_t sstrncat (size_t n, sstr_t s, const sstr_t c1, ...) { 2.42 +sstr_t sstrncat(size_t n, sstr_t s, sstr_t c1, ...) { 2.43 va_list ap; 2.44 va_start(ap, c1); 2.45 s.ptr[0] = 0; 2.46 @@ -82,11 +82,11 @@ 2.47 return s; 2.48 } 2.49 2.50 -sstr_t sstrsubs (const sstr_t s, size_t start) { 2.51 +sstr_t sstrsubs(sstr_t s, size_t start) { 2.52 return sstrsubsl (s, start, s.length-start); 2.53 } 2.54 2.55 -sstr_t sstrsubsl (const sstr_t s, size_t start, size_t length) { 2.56 +sstr_t sstrsubsl(sstr_t s, size_t start, size_t length) { 2.57 sstr_t new_sstr; 2.58 if (start < 0 || start >= s.length || length < 0) { 2.59 return s; 2.60 @@ -99,7 +99,7 @@ 2.61 return new_sstr; 2.62 } 2.63 2.64 -sstr_t* sstrsplit(const sstr_t s, const sstr_t d, size_t *n) { 2.65 +sstr_t* sstrsplit(sstr_t s, sstr_t d, size_t *n) { 2.66 if (d.length == 0) { 2.67 return NULL; 2.68 } 2.69 @@ -155,11 +155,11 @@ 2.70 return result; 2.71 } 2.72 2.73 -int sstrcmp(const sstr_t s1, const sstr_t s2) { 2.74 +int sstrcmp(sstr_t s1, sstr_t s2) { 2.75 return strncmp(s1.ptr, s2.ptr, s1.length>s2.length ? s2.length: s1.length); 2.76 } 2.77 2.78 -sstr_t sstrdup(const sstr_t s) { 2.79 +sstr_t sstrdup(sstr_t s) { 2.80 sstr_t newstring; 2.81 newstring.ptr = (char*) malloc(s.length + 1); 2.82 if (newstring.ptr != NULL) {
3.1 --- a/ucx/string.h Thu Oct 11 11:42:31 2012 +0200 3.2 +++ b/ucx/string.h Thu Oct 11 16:29:30 2012 +0200 3.3 @@ -28,7 +28,7 @@ 3.4 * 3.5 * s null terminated string 3.6 */ 3.7 -sstr_t sstr (char *s); 3.8 +sstr_t sstr(char *s); 3.9 3.10 /* 3.11 * creates a new sstr_t from a string and length 3.12 @@ -36,7 +36,7 @@ 3.13 * s string 3.14 * n length of string 3.15 */ 3.16 -sstr_t sstrn (char *s, size_t n); 3.17 +sstr_t sstrn(char *s, size_t n); 3.18 3.19 3.20 /* 3.21 @@ -46,7 +46,7 @@ 3.22 * s string 3.23 * ... strings 3.24 */ 3.25 -size_t sstrnlen (size_t n, const sstr_t s, ...); 3.26 +size_t sstrnlen(size_t n, sstr_t s, ...); 3.27 3.28 3.29 /* 3.30 @@ -56,18 +56,18 @@ 3.31 * s new string with enough memory allocated 3.32 * ... strings 3.33 */ 3.34 -sstr_t sstrncat (size_t n, sstr_t s, const sstr_t c1, ...); 3.35 +sstr_t sstrncat(size_t n, sstr_t s, sstr_t c1, ...); 3.36 3.37 3.38 /* 3.39 * 3.40 */ 3.41 -sstr_t sstrsubs (const sstr_t s, size_t start); 3.42 +sstr_t sstrsubs(sstr_t s, size_t start); 3.43 3.44 /* 3.45 * 3.46 */ 3.47 -sstr_t sstrsubsl (const sstr_t s, size_t start, size_t length); 3.48 +sstr_t sstrsubsl(sstr_t s, size_t start, size_t length); 3.49 3.50 /* 3.51 * splits s into n parts 3.52 @@ -85,11 +85,11 @@ 3.53 * 3.54 * Returns NULL on error 3.55 */ 3.56 -sstr_t* sstrsplit(const sstr_t s, const sstr_t d, size_t *n); 3.57 +sstr_t* sstrsplit(sstr_t s, sstr_t d, size_t *n); 3.58 3.59 -int sstrcmp(const sstr_t s1, const sstr_t s2); 3.60 +int sstrcmp(sstr_t s1, sstr_t s2); 3.61 3.62 -sstr_t sstrdup(const sstr_t s); 3.63 +sstr_t sstrdup(sstr_t s); 3.64 3.65 #ifdef __cplusplus 3.66 }