removed const from string.*

Thu, 11 Oct 2012 16:29:30 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Thu, 11 Oct 2012 16:29:30 +0200
changeset 68
88dbea299440
parent 67
27e67e725d35
child 69
fb59270b1de3

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
--- a/suncc.mk	Thu Oct 11 11:42:31 2012 +0200
+++ b/suncc.mk	Thu Oct 11 16:29:30 2012 +0200
@@ -31,7 +31,7 @@
 AR = ar
 RM = rm
 
-CFLAGS  = -O -xalias_level=compatible
+CFLAGS  = -O
 LDFLAGS = 
 ARFLAGS = -r
 RMFLAGS = -f
--- a/ucx/string.c	Thu Oct 11 11:42:31 2012 +0200
+++ b/ucx/string.c	Thu Oct 11 16:29:30 2012 +0200
@@ -11,21 +11,21 @@
 
 #include "string.h"
 
-sstr_t sstr (char *s) {
+sstr_t sstr(char *s) {
     sstr_t string;
     string.ptr = s;
     string.length = strlen(s);
     return string;
 }
 
-sstr_t sstrn (char *s, size_t n) {
+sstr_t sstrn(char *s, size_t n) {
     sstr_t string;
     string.ptr = s;
     string.length = n;
     return string;
 }
 
-size_t sstrnlen (size_t n, const sstr_t s, ...) {
+size_t sstrnlen(size_t n, sstr_t s, ...) {
     va_list ap;
     size_t size = s.length;
     va_start(ap, s);
@@ -39,7 +39,7 @@
     return size;
 }
 
-sstr_t sstrcat (sstr_t s, ...) {
+sstr_t sstrcat(sstr_t s, ...) {
     va_list ap;
     va_start(ap, s);
     s.ptr[0] = 0;
@@ -54,7 +54,7 @@
     return s;
 }
 
-sstr_t sstrncat (size_t n, sstr_t s, const sstr_t c1, ...) {
+sstr_t sstrncat(size_t n, sstr_t s, sstr_t c1, ...) {
     va_list ap;
     va_start(ap, c1);
     s.ptr[0] = 0;
@@ -82,11 +82,11 @@
     return s;
 }
 
-sstr_t sstrsubs (const sstr_t s, size_t start) {
+sstr_t sstrsubs(sstr_t s, size_t start) {
     return sstrsubsl (s, start, s.length-start);
 }
 
-sstr_t sstrsubsl (const sstr_t s, size_t start, size_t length) {
+sstr_t sstrsubsl(sstr_t s, size_t start, size_t length) {
     sstr_t new_sstr;
     if (start < 0 || start >= s.length || length < 0) {
         return s;
@@ -99,7 +99,7 @@
     return new_sstr;
 }
 
-sstr_t* sstrsplit(const sstr_t s, const sstr_t d, size_t *n) {
+sstr_t* sstrsplit(sstr_t s, sstr_t d, size_t *n) {
     if (d.length == 0) {
         return NULL;
     }
@@ -155,11 +155,11 @@
     return result;
 }
 
-int sstrcmp(const sstr_t s1, const sstr_t s2) {
+int sstrcmp(sstr_t s1, sstr_t s2) {
     return strncmp(s1.ptr, s2.ptr, s1.length>s2.length ? s2.length: s1.length);
 }
 
-sstr_t sstrdup(const sstr_t s) {
+sstr_t sstrdup(sstr_t s) {
     sstr_t newstring;
     newstring.ptr = (char*) malloc(s.length + 1);
     if (newstring.ptr != NULL) {
--- a/ucx/string.h	Thu Oct 11 11:42:31 2012 +0200
+++ b/ucx/string.h	Thu Oct 11 16:29:30 2012 +0200
@@ -28,7 +28,7 @@
  *
  * s  null terminated string
  */
-sstr_t sstr (char *s);
+sstr_t sstr(char *s);
 
 /*
  * creates a new sstr_t from a string and length
@@ -36,7 +36,7 @@
  * s  string
  * n  length of string
  */
-sstr_t sstrn (char *s, size_t n);
+sstr_t sstrn(char *s, size_t n);
 
 
 /*
@@ -46,7 +46,7 @@
  * s    string
  * ...  strings
  */
-size_t sstrnlen (size_t n, const sstr_t s, ...);
+size_t sstrnlen(size_t n, sstr_t s, ...);
 
 
 /*
@@ -56,18 +56,18 @@
  * s    new string with enough memory allocated
  * ...  strings
  */
-sstr_t sstrncat (size_t n, sstr_t s, const sstr_t c1, ...);
+sstr_t sstrncat(size_t n, sstr_t s, sstr_t c1, ...);
 
 
 /*
  *
  */
-sstr_t sstrsubs (const sstr_t s, size_t start);
+sstr_t sstrsubs(sstr_t s, size_t start);
 
 /*
  *
  */
-sstr_t sstrsubsl (const sstr_t s, size_t start, size_t length);
+sstr_t sstrsubsl(sstr_t s, size_t start, size_t length);
 
 /*
  * splits s into n parts
@@ -85,11 +85,11 @@
  *
  * Returns NULL on error
  */
-sstr_t* sstrsplit(const sstr_t s, const sstr_t d, size_t *n);
+sstr_t* sstrsplit(sstr_t s, sstr_t d, size_t *n);
 
-int sstrcmp(const sstr_t s1, const sstr_t s2);
+int sstrcmp(sstr_t s1, sstr_t s2);
 
-sstr_t sstrdup(const sstr_t s);
+sstr_t sstrdup(sstr_t s);
 
 #ifdef	__cplusplus
 }

mercurial