Ticket #1576: str-consting.patch
File str-consting.patch, 3.4 KB (added by tcurtis, 12 years ago) |
---|
-
src/string/api.c
2845 2845 2846 2846 /* 2847 2847 2848 =item C<STRING* Parrot_str_change_charset(PARROT_INTERP, STRING *src, INTVAL2849 charset_nr)>2848 =item C<STRING* Parrot_str_change_charset(PARROT_INTERP, const STRING *src, 2849 INTVAL charset_nr)> 2850 2850 2851 2851 Converts C<src> to the given charset or encoding and returns the result as a 2852 2852 new string. … … 2859 2859 PARROT_WARN_UNUSED_RESULT 2860 2860 PARROT_CAN_RETURN_NULL 2861 2861 STRING* 2862 Parrot_str_change_charset(PARROT_INTERP, ARG MOD_NULLOK(STRING *src),2862 Parrot_str_change_charset(PARROT_INTERP, ARGIN_NULLOK(const STRING *src), 2863 2863 INTVAL charset_nr) 2864 2864 { 2865 2865 ASSERT_ARGS(Parrot_str_change_charset) … … 2875 2875 "charset #%d not found", (int) charset_nr); 2876 2876 2877 2877 if (new_charset == src->charset) 2878 return src;2878 return (STRING *)src; 2879 2879 2880 2880 return new_charset->to_charset(interp, src); 2881 2881 } … … 2883 2883 2884 2884 /* 2885 2885 2886 =item C<STRING* Parrot_str_change_encoding(PARROT_INTERP, STRING *src, INTVAL2887 encoding_nr)>2886 =item C<STRING* Parrot_str_change_encoding(PARROT_INTERP, const STRING *src, 2887 INTVAL encoding_nr)> 2888 2888 2889 2889 Converts C<src> to the given charset or encoding and returns the result as a 2890 2890 new string. … … 2897 2897 PARROT_WARN_UNUSED_RESULT 2898 2898 PARROT_CAN_RETURN_NULL 2899 2899 STRING* 2900 Parrot_str_change_encoding(PARROT_INTERP, ARG MOD_NULLOK(STRING *src),2900 Parrot_str_change_encoding(PARROT_INTERP, ARGIN_NULLOK(const STRING *src), 2901 2901 INTVAL encoding_nr) 2902 2902 { 2903 2903 ASSERT_ARGS(Parrot_str_change_encoding) … … 2913 2913 "encoding #%d not found", (int) encoding_nr); 2914 2914 2915 2915 if (new_encoding == src->encoding) 2916 return src;2916 return (STRING *)src; 2917 2917 2918 2918 return new_encoding->to_encoding(interp, src); 2919 2919 } … … 3070 3070 3071 3071 /* 3072 3072 3073 =item C<PMC* Parrot_str_split(PARROT_INTERP, const STRING *delim, STRING *str)> 3073 =item C<PMC* Parrot_str_split(PARROT_INTERP, const STRING *delim, const STRING 3074 *str)> 3074 3075 3075 3076 Splits the string C<str> at the delimiter C<delim>, returning a 3076 3077 C<ResizableStringArray>, or his mapped type in the current HLL, of results. … … 3085 3086 PARROT_CAN_RETURN_NULL 3086 3087 PMC* 3087 3088 Parrot_str_split(PARROT_INTERP, 3088 ARGIN_NULLOK(const STRING *delim), ARGIN_NULLOK( STRING *str))3089 ARGIN_NULLOK(const STRING *delim), ARGIN_NULLOK(const STRING *str)) 3089 3090 { 3090 3091 ASSERT_ARGS(Parrot_str_split) 3091 3092 PMC *res; -
include/parrot/string_funcs.h
66 66 PARROT_WARN_UNUSED_RESULT 67 67 PARROT_CAN_RETURN_NULL 68 68 STRING* Parrot_str_change_charset(PARROT_INTERP, 69 ARG MOD_NULLOK(STRING *src),69 ARGIN_NULLOK(const STRING *src), 70 70 INTVAL charset_nr) 71 71 __attribute__nonnull__(1) 72 72 FUNC_MODIFIES(*src); … … 75 75 PARROT_WARN_UNUSED_RESULT 76 76 PARROT_CAN_RETURN_NULL 77 77 STRING* Parrot_str_change_encoding(PARROT_INTERP, 78 ARG MOD_NULLOK(STRING *src),78 ARGIN_NULLOK(const STRING *src), 79 79 INTVAL encoding_nr) 80 80 __attribute__nonnull__(1) 81 81 FUNC_MODIFIES(*src); … … 322 322 PARROT_CAN_RETURN_NULL 323 323 PMC* Parrot_str_split(PARROT_INTERP, 324 324 ARGIN_NULLOK(const STRING *delim), 325 ARGIN_NULLOK( STRING *str))325 ARGIN_NULLOK(const STRING *str)) 326 326 __attribute__nonnull__(1); 327 327 328 328 PARROT_EXPORT