[svn:parrot] r46098 - in trunk: include/parrot src/string

petdance at svn.parrot.org petdance at svn.parrot.org
Wed Apr 28 03:22:45 UTC 2010


Author: petdance
Date: Wed Apr 28 03:22:43 2010
New Revision: 46098
URL: https://trac.parrot.org/parrot/changeset/46098

Log:
consting more input STRINGs

Modified:
   trunk/include/parrot/string_funcs.h
   trunk/src/string/api.c

Modified: trunk/include/parrot/string_funcs.h
==============================================================================
--- trunk/include/parrot/string_funcs.h	Wed Apr 28 03:18:28 2010	(r46097)
+++ trunk/include/parrot/string_funcs.h	Wed Apr 28 03:22:43 2010	(r46098)
@@ -82,10 +82,9 @@
 
 PARROT_EXPORT
 PARROT_CANNOT_RETURN_NULL
-STRING * Parrot_str_chopn(PARROT_INTERP, ARGMOD(STRING *s), INTVAL n)
+STRING * Parrot_str_chopn(PARROT_INTERP, ARGIN(const STRING *s), INTVAL n)
         __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        FUNC_MODIFIES(*s);
+        __attribute__nonnull__(2);
 
 PARROT_EXPORT
 PARROT_WARN_UNUSED_RESULT
@@ -97,7 +96,7 @@
 PARROT_EXPORT
 PARROT_WARN_UNUSED_RESULT
 PARROT_CAN_RETURN_NULL
-STRING * Parrot_str_compose(PARROT_INTERP, ARGIN_NULLOK(STRING *src))
+STRING * Parrot_str_compose(PARROT_INTERP, ARGIN_NULLOK(const STRING *src))
         __attribute__nonnull__(1);
 
 PARROT_EXPORT
@@ -143,7 +142,7 @@
 PARROT_WARN_UNUSED_RESULT
 INTVAL Parrot_str_find_cclass(PARROT_INTERP,
     INTVAL flags,
-    ARGIN_NULLOK(STRING *s),
+    ARGIN_NULLOK(const STRING *s),
     UINTVAL offset,
     UINTVAL count)
         __attribute__nonnull__(1);
@@ -162,7 +161,7 @@
 PARROT_WARN_UNUSED_RESULT
 INTVAL Parrot_str_find_not_cclass(PARROT_INTERP,
     INTVAL flags,
-    ARGIN_NULLOK(STRING *s),
+    ARGIN_NULLOK(const STRING *s),
     UINTVAL offset,
     UINTVAL count)
         __attribute__nonnull__(1);
@@ -325,7 +324,7 @@
 PARROT_CANNOT_RETURN_NULL
 PARROT_WARN_UNUSED_RESULT
 STRING * Parrot_str_substr(PARROT_INTERP,
-    ARGIN_NULLOK(STRING *src),
+    ARGIN_NULLOK(const STRING *src),
     INTVAL offset,
     INTVAL length)
         __attribute__nonnull__(1);

Modified: trunk/src/string/api.c
==============================================================================
--- trunk/src/string/api.c	Wed Apr 28 03:18:28 2010	(r46097)
+++ trunk/src/string/api.c	Wed Apr 28 03:22:43 2010	(r46098)
@@ -1036,8 +1036,8 @@
 
 /*
 
-=item C<STRING * Parrot_str_substr(PARROT_INTERP, STRING *src, INTVAL offset,
-INTVAL length)>
+=item C<STRING * Parrot_str_substr(PARROT_INTERP, const STRING *src, INTVAL
+offset, INTVAL length)>
 
 Returns substring of length C<length> from C<offset> from the specified
 Parrot string.
@@ -1051,7 +1051,7 @@
 PARROT_WARN_UNUSED_RESULT
 STRING *
 Parrot_str_substr(PARROT_INTERP,
-        ARGIN_NULLOK(STRING *src), INTVAL offset, INTVAL length)
+        ARGIN_NULLOK(const STRING *src), INTVAL offset, INTVAL length)
 {
     ASSERT_ARGS(Parrot_str_substr)
 
@@ -1216,7 +1216,7 @@
 
 /*
 
-=item C<STRING * Parrot_str_chopn(PARROT_INTERP, STRING *s, INTVAL n)>
+=item C<STRING * Parrot_str_chopn(PARROT_INTERP, const STRING *s, INTVAL n)>
 
 Removes the last C<n> characters of the specified Parrot string and returns the
 modified string. If C<n> is negative, cuts the string after C<+n> characters.
@@ -1228,7 +1228,7 @@
 PARROT_EXPORT
 PARROT_CANNOT_RETURN_NULL
 STRING *
-Parrot_str_chopn(PARROT_INTERP, ARGMOD(STRING *s), INTVAL n)
+Parrot_str_chopn(PARROT_INTERP, ARGIN(const STRING *s), INTVAL n)
 {
     ASSERT_ARGS(Parrot_str_chopn)
 
@@ -1835,7 +1835,7 @@
     ASSERT_ARGS(Parrot_str_to_int)
     if (STRING_IS_NULL(s))
         return 0;
-    {
+    else {
         const UINTVAL       max_safe  = -(UINTVAL)PARROT_INTVAL_MIN / 10;
         const UINTVAL       last_dig  = (-(UINTVAL)PARROT_INTVAL_MIN) % 10;
         int                 sign      = 1;
@@ -2786,8 +2786,8 @@
 
 /*
 
-=item C<INTVAL Parrot_str_find_cclass(PARROT_INTERP, INTVAL flags, STRING *s,
-UINTVAL offset, UINTVAL count)>
+=item C<INTVAL Parrot_str_find_cclass(PARROT_INTERP, INTVAL flags, const STRING
+*s, UINTVAL offset, UINTVAL count)>
 
 Finds the first occurrence of the given character class in C<flags> in the
 string, and returns its glyph-wise index.
@@ -2799,7 +2799,7 @@
 PARROT_EXPORT
 PARROT_WARN_UNUSED_RESULT
 INTVAL
-Parrot_str_find_cclass(PARROT_INTERP, INTVAL flags, ARGIN_NULLOK(STRING *s),
+Parrot_str_find_cclass(PARROT_INTERP, INTVAL flags, ARGIN_NULLOK(const STRING *s),
                           UINTVAL offset, UINTVAL count)
 {
     ASSERT_ARGS(Parrot_str_find_cclass)
@@ -2813,8 +2813,8 @@
 
 /*
 
-=item C<INTVAL Parrot_str_find_not_cclass(PARROT_INTERP, INTVAL flags, STRING
-*s, UINTVAL offset, UINTVAL count)>
+=item C<INTVAL Parrot_str_find_not_cclass(PARROT_INTERP, INTVAL flags, const
+STRING *s, UINTVAL offset, UINTVAL count)>
 
 Finds the first occurrence of the a character I<not> in the given character
 class in C<flags> in the string starting from C<offset> and looking at C<count>
@@ -2829,7 +2829,7 @@
 PARROT_WARN_UNUSED_RESULT
 INTVAL
 Parrot_str_find_not_cclass(PARROT_INTERP, INTVAL flags,
-    ARGIN_NULLOK(STRING *s), UINTVAL offset, UINTVAL count)
+    ARGIN_NULLOK(const STRING *s), UINTVAL offset, UINTVAL count)
 {
     ASSERT_ARGS(Parrot_str_find_not_cclass)
 
@@ -2918,7 +2918,7 @@
 
 /*
 
-=item C<STRING * Parrot_str_compose(PARROT_INTERP, STRING *src)>
+=item C<STRING * Parrot_str_compose(PARROT_INTERP, const STRING *src)>
 
 Normalizes the string.
 
@@ -2930,7 +2930,7 @@
 PARROT_WARN_UNUSED_RESULT
 PARROT_CAN_RETURN_NULL
 STRING *
-Parrot_str_compose(PARROT_INTERP, ARGIN_NULLOK(STRING *src))
+Parrot_str_compose(PARROT_INTERP, ARGIN_NULLOK(const STRING *src))
 {
     ASSERT_ARGS(Parrot_str_compose)
 


More information about the parrot-commits mailing list