# New Ticket Created by Mark Glines # Please include the string: [perl #43241] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=43241 >
include/parrot/string.h contains 2 typedefs for the same thing: STRING and String. STRING is used everywhere; String is used occasionally. they are interchangeable. This confused me at first, because I thought String was the String PMC, not the STRING C structure. Here's a patch to consolidate that, and standardize on STRING (based on the fact that it's used *much* more often than String is). Mark
Index: src/string.c =================================================================== --- src/string.c (revision 19084) +++ src/string.c (working copy) @@ -104,9 +104,9 @@ */ static void -copy_string_header(String *dest /*NN*/, const String *src /*NN*/) +copy_string_header(STRING *dest /*NN*/, const STRING *src /*NN*/) { - memcpy(dest, src, sizeof (String)); + memcpy(dest, src, sizeof (STRING)); } /* Index: src/encodings/utf16.c =================================================================== --- src/encodings/utf16.c (revision 19084) +++ src/encodings/utf16.c (working copy) @@ -29,7 +29,7 @@ #define UNIMPL internal_exception(UNIMPLEMENTED, "unimpl utf16") -static void iter_init(Interp *, const String *src, String_iter *iter); +static void iter_init(Interp *, const STRING *src, String_iter *iter); /* @@ -322,7 +322,7 @@ #endif static void -iter_init(Interp *interp, const String *src, String_iter *iter) +iter_init(Interp *interp, const STRING *src, String_iter *iter) { iter->str = src; iter->bytepos = iter->charpos = 0; Index: src/encodings/fixed_8.c =================================================================== --- src/encodings/fixed_8.c (revision 19084) +++ src/encodings/fixed_8.c (working copy) @@ -200,7 +200,7 @@ static void -iter_init(Interp *interp, const String *src, String_iter *iter) +iter_init(Interp *interp, const STRING *src, String_iter *iter) { iter->str = src; iter->bytepos = iter->charpos = 0; Index: src/encodings/utf8.c =================================================================== --- src/encodings/utf8.c (revision 19084) +++ src/encodings/utf8.c (working copy) @@ -45,7 +45,7 @@ typedef unsigned char utf8_t; #endif -static void iter_init(Interp *, const String *src, String_iter *iter); +static void iter_init(Interp *, const STRING *src, String_iter *iter); /* @@ -499,7 +499,7 @@ } static void -iter_init(Interp *interp, const String *src, String_iter *iter) +iter_init(Interp *interp, const STRING *src, String_iter *iter) { iter->str = src; iter->bytepos = iter->charpos = 0; Index: src/encodings/ucs2.c =================================================================== --- src/encodings/ucs2.c (revision 19084) +++ src/encodings/ucs2.c (working copy) @@ -28,7 +28,7 @@ #define UNIMPL internal_exception(UNIMPLEMENTED, "unimpl ucs2") -static void iter_init(Interp *, const String *src, String_iter *iter); +static void iter_init(Interp *, const STRING *src, String_iter *iter); static STRING * @@ -215,7 +215,7 @@ #endif static void -iter_init(Interp *interp, const String *src, String_iter *iter) +iter_init(Interp *interp, const STRING *src, String_iter *iter) { iter->str = src; iter->bytepos = iter->charpos = 0; Index: src/inter_misc.c =================================================================== --- src/inter_misc.c (revision 19084) +++ src/inter_misc.c (working copy) @@ -149,7 +149,7 @@ =item C<PMC * Parrot_compile_string(Parrot_Interp interp, STRING *type, - char *code, String **error)> + char *code, STRING **error)> Compile code string. @@ -179,7 +179,7 @@ =item C<void Parrot_compile_file(Parrot_Interp interp, const char *fullname, - String **error)> + STRING **error)> Compile code file. @@ -189,7 +189,7 @@ void * Parrot_compile_file(Parrot_Interp interp, char *fullname, - String **error) + STRING **error) { return IMCC_compile_file_s(interp, fullname, error); } Index: src/jit/i386/jit_emit.h =================================================================== --- src/jit/i386/jit_emit.h (revision 19084) +++ src/jit/i386/jit_emit.h (working copy) @@ -3705,7 +3705,7 @@ */ void * Parrot_jit_build_call_func(Interp *interp, PMC *pmc_nci, - String *signature) + STRING *signature) { Parrot_jit_info_t jit_info; char *sig, *pc; Index: src/stacks.c =================================================================== --- src/stacks.c (revision 19084) +++ src/stacks.c (working copy) @@ -248,7 +248,7 @@ UVal_pmc(entry->entry) = (PMC *)thing; break; case STACK_ENTRY_STRING: - UVal_str(entry->entry) = (String *)thing; + UVal_str(entry->entry) = (STRING *)thing; break; case STACK_ENTRY_POINTER: case STACK_ENTRY_DESTINATION: @@ -305,7 +305,7 @@ *(PMC **)where = UVal_pmc(entry->entry); break; case STACK_ENTRY_STRING: - *(String **)where = UVal_str(entry->entry); + *(STRING **)where = UVal_str(entry->entry); break; case STACK_ENTRY_POINTER: case STACK_ENTRY_DESTINATION: Index: src/jit.h =================================================================== --- src/jit.h (revision 19084) +++ src/jit.h (working copy) @@ -318,7 +318,7 @@ /* * NCI interface */ -void *Parrot_jit_build_call_func(Interp *, PMC *, String *); +void *Parrot_jit_build_call_func(Interp *, PMC *, STRING *); #endif /* PARROT_JIT_H_GUARD */ Index: include/parrot/string.h =================================================================== --- include/parrot/string.h (revision 19084) +++ include/parrot/string.h (working copy) @@ -22,7 +22,7 @@ #include "parrot/parrot.h" -typedef struct parrot_string_t String; +typedef struct parrot_string_t STRING; typedef enum Forward_flag { Buffer_moved_FLAG = 1 << 0 @@ -30,7 +30,7 @@ /* String iterator */ typedef struct string_iterator_t { - const String *str; + const STRING *str; UINTVAL bytepos; UINTVAL charpos; UINTVAL (*get_and_advance)(Interp *, struct string_iterator_t *i); @@ -38,7 +38,7 @@ void (*set_position)(Interp *, struct string_iterator_t *i, UINTVAL pos); } String_iter; -void string_iter_init(Interp *, const String *str, String_iter *); +void string_iter_init(Interp *, const STRING *str, String_iter *); /* stringinfo parameters */ @@ -52,7 +52,6 @@ #define STRINGINFO_STRLEN 6 /* &end_gen */ -typedef struct parrot_string_t STRING; #endif /* PARROT_IN_CORE */ #endif /* PARROT_STRING_H_GUARD */ Index: include/parrot/interpreter.h =================================================================== --- include/parrot/interpreter.h (revision 19084) +++ include/parrot/interpreter.h (working copy) @@ -530,7 +530,7 @@ PARROT_API PMC *Parrot_compile_string(Parrot_Interp interp, STRING *type, char *code, STRING **error); PARROT_API void *Parrot_compile_file(Parrot_Interp interp, - char *fullname, String **error); + char *fullname, STRING **error); INTVAL sysinfo_i(Interp *interp, INTVAL info_wanted); STRING *sysinfo_s(Interp *interp, INTVAL info_wanted); Index: include/parrot/nci.h =================================================================== --- include/parrot/nci.h (revision 19084) +++ include/parrot/nci.h (working copy) @@ -15,7 +15,7 @@ #include "parrot/parrot.h" -void *build_call_func(Interp *, PMC *, String *); +void *build_call_func(Interp *, PMC *, STRING *); #endif /* PARROT_NCI_H_GUARD */