]> andersk Git - splint.git/blobdiff - src/Headers/cstring.h
*** empty log message ***
[splint.git] / src / Headers / cstring.h
index f2a74f06b13a8ff72d9dc6efe7ad88bf0f2cb4c3..f82502edb286ffd892b567bebb4b89bad04ae53e 100644 (file)
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2000.
+** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2001.
 ** See ../LICENSE for license information.
 **
 */
@@ -21,6 +21,7 @@
 /* typedefs in forwardTypes */
 
 extern /*@notnull@*/ cstring cstring_create (int p_n) /*@*/ ;
+extern /*@only@*/ /*@notnull@*/  cstring cstring_newEmpty (void) ;
 extern /*@notnull@*/ cstring cstring_appendChar (/*@only@*/ cstring p_s1, char p_c);
 
 extern cstring cstring_concatLength (/*@only@*/ cstring p_s1, char *p_s2, int p_len) /*@*/ ;
@@ -38,7 +39,7 @@ typedef enum {
   CGE_DISTINCT, /* significant differences */
   CGE_CASE,     /* case differences */
   CGE_LOOKALIKE /* lookalike differences */
-  } cmpcode;
+} cmpcode;
 
 extern cmpcode cstring_genericEqual (cstring p_s, cstring p_t,
                                     int p_nchars,
@@ -50,15 +51,15 @@ extern void cstring_replaceAll (cstring p_s, char p_old, char p_snew) /*@modifie
 # endif
 
 extern void cstring_replaceLit (/*@unique@*/ cstring p_s, char *p_old, char *p_snew);
-extern char cstring_firstChar (cstring p_s);
-extern char cstring_secondChar (cstring p_s);
+extern char cstring_firstChar (cstring p_s) /*@*/ ;
+extern char cstring_secondChar (cstring p_s) /*@*/ ;
 extern char cstring_lastChar (cstring p_s) /*@*/ ;
 extern char cstring_getChar (cstring p_s, int p_n);
 extern void cstring_setChar (cstring p_s, int p_n, char p_c);
 
 # define cstring_secondChar(s) cstring_getChar (s, 2)
 
-extern /*@exposed@*/ /*@notnull@*/ char *
+extern /*@exposed@*/ /*@notnull@*/ /*@untainted@*/ char *
   cstring_toCharsSafe (/*@temp@*/ /*@exposed@*/ /*@returned@*/ cstring p_s)
      /*@*/ ;
 
@@ -98,21 +99,26 @@ extern bool cstring_lessthan (cstring p_s1, cstring p_s2) /*@*/ ;
 extern bool cstring_equalFree (/*@only@*/ cstring p_c1, /*@only@*/ cstring p_c2);
 
 /* really exposed! */
-extern cstring 
+
+/*
+** Don't allow tainted cstring's
+*/
+
+extern /*@untained@*/ cstring 
   cstring_fromChars (/*@returned@*/ /*@null@*/ 
-                    const /*@exposed@*/ /*@temp@*/ char *p_cp) /*@*/ ;
+                    const /*:untainted@*/ /*@exposed@*/ /*@temp@*/ char *p_cp) /*@*/ ;
 
 extern cstring
-  cstring_fromCharsO (/*@null@*/ /*@only@*/ char *p_cp) /*@*/ ;
+   cstring_fromCharsO (/*@null@*/ /*:untainted@*/ /*@only@*/ char *p_cp) /*@*/ ;
 /*@-mustfree@*/
 # define cstring_fromCharsO(s) cstring_fromChars(s)
 /*@=mustfree@*/
 
-extern cstring cstring_fromCharsNew (/*@null@*/ char *p_s) /*@*/ ;
+extern cstring cstring_fromCharsNew (/*:untainted@*/ /*@null@*/ char *p_s) /*@*/ ;
 # define cstring_fromCharsNew(s) cstring_copy(cstring_fromChars(s))
 
 # ifndef NOLCL
-extern /*@exposed@*/ /*@notnull@*/ 
+extern /*@exposed@*/ /*@notnull@*/ /*@untainted@*/
   char *cstring_toCharsSafeO (/*@only@*/ /*@exposed@*/ /*@returned@*/ cstring p_s);
 /*@-mustfree@*/
 # define cstring_toCharsSafeO(s) cstring_toCharsSafe(s)
@@ -127,7 +133,7 @@ extern void cstring_free (/*@only@*/ cstring p_s);
 extern /*@falsenull@*/ bool cstring_isDefined (cstring p_s) /*@*/ ;
 extern /*@truenull@*/ bool cstring_isUndefined (cstring p_s) /*@*/ ;
 
-extern bool cstring_isEmpty (cstring p_s) /*@*/ ;
+extern /*@truenull@*/ bool cstring_isEmpty (cstring p_s) /*@*/ ;
 extern /*@falsenull@*/ bool cstring_isNonEmpty (cstring p_s) /*@*/ ;
 
 # define cstring_isDefined(s)   ((s) != cstring_undefined)
@@ -180,10 +186,18 @@ extern cstring cstring_beforeChar (cstring p_s, char p_c) /*@*/ ;
 
 extern /*@observer@*/ cstring cstring_advanceWhiteSpace (cstring) /*@*/ ;
 
+extern /*@only@*/ /*@notnull@*/ cstring
+cstring_copySegment (cstring p_s, int p_findex, int p_tindex) /*@*/ ;
+
 extern bool cstring_containsLit (/*@unique@*/ cstring p_c, char *p_sub) /*@*/ ;
 # define cstring_containsLit(c,sub) \
   (cstring_contains (c, cstring_fromChars (sub)))
 
+/*drl added July 2, 001 */
+extern int cstring_compareLit (/*@unique@*/ cstring p_c, char *p_sub) /*@*/ ;
+# define cstring_compareLit(c,sub) \
+  (cstring_compare (c, cstring_fromChars (sub)))
+
 # else
 # error "Multiple include"
 # endif
This page took 0.082878 seconds and 4 git commands to generate.