Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[str] Switch to STRING_equal macro

Move the whole 'str_equal' logic into the string vtable functions

git-svn-id: https://svn.parrot.org/parrot/trunk@49416 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
commit 91161252e461284a1077c6022e56a207d192188d 1 parent 02984a9
@nwellnhof nwellnhof authored
Showing with 257 additions and 255 deletions.
  1. +2 −2 compilers/pirc/src/bcgen.c
  2. +35 −28 src/dynext.c
  3. +2 −2 src/dynpmc/os.pmc
  4. +2 −2 src/embed.c
  5. +2 −2 src/exceptions.c
  6. +2 −2 src/hash.c
  7. +1 −1  src/hll.c
  8. +1 −1  src/io/filehandle.c
  9. +5 −5 src/library.c
  10. +4 −4 src/multidispatch.c
  11. +1 −1  src/oo.c
  12. +6 −6 src/ops/cmp.ops
  13. +16 −16 src/ops/core_ops.c
  14. +9 −9 src/packfile.c
  15. +1 −1  src/packout.c
  16. +15 −15 src/pmc/callcontext.pmc
  17. +12 −12 src/pmc/class.pmc
  18. +2 −2 src/pmc/codestring.pmc
  19. +4 −4 src/pmc/complex.pmc
  20. +6 −6 src/pmc/default.pmc
  21. +3 −3 src/pmc/eventhandler.pmc
  22. +14 −14 src/pmc/exception.pmc
  23. +3 −3 src/pmc/filehandle.pmc
  24. +1 −1  src/pmc/fixedbooleanarray.pmc
  25. +1 −1  src/pmc/fixedstringarray.pmc
  26. +1 −1  src/pmc/lexinfo.pmc
  27. +5 −5 src/pmc/namespace.pmc
  28. +1 −1  src/pmc/object.pmc
  29. +11 −11 src/pmc/packfile.pmc
  30. +1 −1  src/pmc/packfileconstanttable.pmc
  31. +8 −8 src/pmc/parrotinterpreter.pmc
  32. +5 −5 src/pmc/pmcproxy.pmc
  33. +6 −6 src/pmc/role.pmc
  34. +1 −1  src/pmc/scalar.pmc
  35. +4 −4 src/pmc/scheduler.pmc
  36. +2 −2 src/pmc/string.pmc
  37. +2 −2 src/pmc/stringbuilder.pmc
  38. +4 −4 src/pmc/stringhandle.pmc
  39. +6 −6 src/pmc/sub.pmc
  40. +14 −14 src/pmc/task.pmc
  41. +2 −2 src/runcore/main.c
  42. +4 −4 src/runcore/profiling.c
  43. +9 −9 src/scheduler.c
  44. +17 −22 src/string/api.c
  45. +3 −3 src/string/encoding.c
  46. +1 −1  src/sub.c
View
4 compilers/pirc/src/bcgen.c
@@ -271,7 +271,7 @@ add_string_const(ARGIN(bytecode * const bc), ARGIN(char const * const str),
while (index < count) {
constant = bc->interp->code->const_table->constants[index];
if (constant->type == PFC_STRING) {
- if (Parrot_str_equal(bc->interp, constant->u.string, parrotstr)) {
+ if (STRING_equal(bc->interp, constant->u.string, parrotstr)) {
#if DEBUGBC
fprintf(stderr, "found string %s at index %d\n", str, index);
#endif
@@ -351,7 +351,7 @@ add_key_const(ARGIN(bytecode * const bc), ARGIN(PMC *key))
if (constant->type == PFC_KEY) {
STRING *s2 = key_set_to_string(bc->interp, constant->u.key);
- if (Parrot_str_equal(bc->interp, s1, s2)) {
+ if (STRING_equal(bc->interp, s1, s2)) {
#if DEBUGBC
fprintf(stderr, "found equal key (%d)\n", index);
#endif
View
63 src/dynext.c
@@ -51,14 +51,16 @@ static void * dlopen_string(PARROT_INTERP,
PARROT_WARN_UNUSED_RESULT
PARROT_CAN_RETURN_NULL
static STRING * get_path(PARROT_INTERP,
- ARGMOD_NULLOK(STRING *lib),
+ ARGMOD(STRING *lib),
Parrot_dlopen_flags flags,
ARGOUT(void **handle),
ARGIN(STRING *wo_ext),
- ARGIN_NULLOK(STRING *ext))
+ ARGIN(STRING *ext))
__attribute__nonnull__(1)
+ __attribute__nonnull__(2)
__attribute__nonnull__(4)
__attribute__nonnull__(5)
+ __attribute__nonnull__(6)
FUNC_MODIFIES(*lib)
FUNC_MODIFIES(*handle);
@@ -77,10 +79,11 @@ static PMC * make_string_pmc(PARROT_INTERP, ARGIN(STRING *string))
PARROT_CANNOT_RETURN_NULL
static PMC * run_init_lib(PARROT_INTERP,
ARGIN(void *handle),
- ARGIN_NULLOK(STRING *lib_name),
+ ARGIN(STRING *lib_name),
ARGIN(STRING *wo_ext))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
+ __attribute__nonnull__(3)
__attribute__nonnull__(4);
static void set_cstring_prop(PARROT_INTERP,
@@ -97,11 +100,12 @@ static void store_lib_pmc(PARROT_INTERP,
ARGIN(PMC *lib_pmc),
ARGIN(STRING *path),
ARGIN(STRING *type),
- ARGIN_NULLOK(STRING *lib_name))
+ ARGIN(STRING *lib_name))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
- __attribute__nonnull__(4);
+ __attribute__nonnull__(4)
+ __attribute__nonnull__(5);
#define ASSERT_ARGS_clone_string_into __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(d) \
@@ -112,8 +116,10 @@ static void store_lib_pmc(PARROT_INTERP,
, PARROT_ASSERT_ARG(path))
#define ASSERT_ARGS_get_path __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(lib) \
, PARROT_ASSERT_ARG(handle) \
- , PARROT_ASSERT_ARG(wo_ext))
+ , PARROT_ASSERT_ARG(wo_ext) \
+ , PARROT_ASSERT_ARG(ext))
#define ASSERT_ARGS_is_loaded __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(path))
@@ -123,6 +129,7 @@ static void store_lib_pmc(PARROT_INTERP,
#define ASSERT_ARGS_run_init_lib __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle) \
+ , PARROT_ASSERT_ARG(lib_name) \
, PARROT_ASSERT_ARG(wo_ext))
#define ASSERT_ARGS_set_cstring_prop __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
@@ -133,7 +140,8 @@ static void store_lib_pmc(PARROT_INTERP,
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(lib_pmc) \
, PARROT_ASSERT_ARG(path) \
- , PARROT_ASSERT_ARG(type))
+ , PARROT_ASSERT_ARG(type) \
+ , PARROT_ASSERT_ARG(lib_name))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
@@ -177,7 +185,7 @@ Stores a C<ParrotLibrary> PMC in the interpreter's C<iglobals>.
static void
store_lib_pmc(PARROT_INTERP, ARGIN(PMC *lib_pmc), ARGIN(STRING *path),
- ARGIN(STRING *type), ARGIN_NULLOK(STRING *lib_name))
+ ARGIN(STRING *type), ARGIN(STRING *lib_name))
{
ASSERT_ARGS(store_lib_pmc)
PMC * const iglobals = interp->iglobals;
@@ -188,7 +196,7 @@ store_lib_pmc(PARROT_INTERP, ARGIN(PMC *lib_pmc), ARGIN(STRING *path),
set_cstring_prop(interp, lib_pmc, "_filename", path);
set_cstring_prop(interp, lib_pmc, "_type", type);
- if (lib_name)
+ if (!STRING_IS_NULL(lib_name))
set_cstring_prop(interp, lib_pmc, "_lib_name", lib_name);
VTABLE_set_pmc_keyed_str(interp, dyn_libs, path, lib_pmc);
@@ -260,9 +268,8 @@ Returns path and handle of a dynamic lib, setting lib_name to just the filestem
PARROT_WARN_UNUSED_RESULT
PARROT_CAN_RETURN_NULL
static STRING *
-get_path(PARROT_INTERP, ARGMOD_NULLOK(STRING *lib), Parrot_dlopen_flags flags,
- ARGOUT(void **handle), ARGIN(STRING *wo_ext),
- ARGIN_NULLOK(STRING *ext))
+get_path(PARROT_INTERP, ARGMOD(STRING *lib), Parrot_dlopen_flags flags,
+ ARGOUT(void **handle), ARGIN(STRING *wo_ext), ARGIN(STRING *ext))
{
ASSERT_ARGS(get_path)
PMC * const iglobals = interp->iglobals;
@@ -273,7 +280,7 @@ get_path(PARROT_INTERP, ARGMOD_NULLOK(STRING *lib), Parrot_dlopen_flags flags,
STRING *path, *full_name;
- if (! lib) {
+ if (STRING_IS_NULL(lib)) {
*handle = Parrot_dlopen((char *)NULL, flags);
if (*handle)
return CONST_STRING(interp, "");
@@ -284,12 +291,12 @@ get_path(PARROT_INTERP, ARGMOD_NULLOK(STRING *lib), Parrot_dlopen_flags flags,
err ? err : "unknown reason");
/* clear the error memory */
(void)Parrot_dlerror();
- return NULL;
+ return STRINGNULL;
}
}
/* first, try to add an extension to the file if it has none */
- if (! ext) {
+ if (STRING_IS_NULL(ext)) {
const INTVAL n = VTABLE_elements(interp, share_ext);
INTVAL i;
@@ -299,7 +306,7 @@ get_path(PARROT_INTERP, ARGMOD_NULLOK(STRING *lib), Parrot_dlopen_flags flags,
path = Parrot_locate_runtime_file_str(interp, full_name,
PARROT_RUNTIME_FT_DYNEXT);
- if (path) {
+ if (!STRING_IS_NULL(path)) {
*handle = dlopen_string(interp, flags, path);
if (*handle)
@@ -311,7 +318,7 @@ get_path(PARROT_INTERP, ARGMOD_NULLOK(STRING *lib), Parrot_dlopen_flags flags,
full_name, err ? err : "unknown reason");
/* clear the error memory */
(void)Parrot_dlerror();
- return NULL;
+ return STRINGNULL;
}
}
@@ -332,7 +339,7 @@ get_path(PARROT_INTERP, ARGMOD_NULLOK(STRING *lib), Parrot_dlopen_flags flags,
full_name = Parrot_locate_runtime_file_str(interp, lib,
PARROT_RUNTIME_FT_DYNEXT);
- if (full_name) {
+ if (!STRING_IS_NULL(full_name)) {
*handle = dlopen_string(interp, flags, full_name);
if (*handle)
@@ -344,7 +351,7 @@ get_path(PARROT_INTERP, ARGMOD_NULLOK(STRING *lib), Parrot_dlopen_flags flags,
* [shouldn't this happen in Parrot_locate_runtime_file instead?]
*/
#ifdef WIN32
- if (!STRING_IS_EMPTY(lib) && memcmp(lib->strstart, "lib", 3) == 0) {
+ if (STRING_length(lib) >= 3 && memcmp(lib->strstart, "lib", 3) == 0) {
*handle = Parrot_dlopen((char *)lib->strstart + 3, 0);
if (*handle)
@@ -354,7 +361,7 @@ get_path(PARROT_INTERP, ARGMOD_NULLOK(STRING *lib), Parrot_dlopen_flags flags,
/* And on cygwin replace a leading "lib" by "cyg". */
#ifdef __CYGWIN__
- if (!STRING_IS_EMPTY(lib) && memcmp(lib->strstart, "lib", 3) == 0) {
+ if (!STRING_length(lib) >= 3 && memcmp(lib->strstart, "lib", 3) == 0) {
path = Parrot_str_concat(interp, CONST_STRING(interp, "cyg"),
Parrot_str_substr(interp, lib, 3, lib->strlen - 3));
@@ -365,7 +372,7 @@ get_path(PARROT_INTERP, ARGMOD_NULLOK(STRING *lib), Parrot_dlopen_flags flags,
}
#endif
- if (STRING_IS_EMPTY(lib)) {
+ if (!STRING_length(lib)) {
*handle = dlopen_string(interp, flags, lib);
if (*handle)
return lib;
@@ -379,7 +386,7 @@ get_path(PARROT_INTERP, ARGMOD_NULLOK(STRING *lib), Parrot_dlopen_flags flags,
/* clear the error memory */
(void)Parrot_dlerror();
- return NULL;
+ return STRINGNULL;
}
}
@@ -469,7 +476,7 @@ necessary initialization routines, if any.
PARROT_CANNOT_RETURN_NULL
static PMC *
run_init_lib(PARROT_INTERP, ARGIN(void *handle),
- ARGIN_NULLOK(STRING *lib_name), ARGIN(STRING *wo_ext))
+ ARGIN(STRING *lib_name), ARGIN(STRING *wo_ext))
{
ASSERT_ARGS(run_init_lib)
STRING *type;
@@ -484,7 +491,7 @@ run_init_lib(PARROT_INTERP, ARGIN(void *handle),
Parrot_pcc_set_namespace(interp, context,
Parrot_get_HLL_namespace(interp, parrot_hll_id));
- if (lib_name) {
+ if (!STRING_IS_NULL(lib_name)) {
STRING * const load_name = Parrot_sprintf_c(interp,
"Parrot_lib_%Ss_load", lib_name);
STRING * const init_func_name = Parrot_sprintf_c(interp,
@@ -606,7 +613,7 @@ Parrot_clone_lib_into(ARGMOD(Interp *d), ARGMOD(Interp *s), ARGIN(PMC *lib_pmc))
STRING * const type =
VTABLE_get_string(s, VTABLE_getprop(s, lib_pmc, type_str));
- if (Parrot_str_equal(s, type, ops)) {
+ if (STRING_equal(s, type, ops)) {
/* we can't clone oplibs in the normal way, since they're actually
* shared between interpreters dynop_register modifies the (statically
* allocated) op_lib_t structure from core_ops.c, for example.
@@ -690,12 +697,12 @@ Parrot_load_lib(PARROT_INTERP, ARGIN_NULLOK(STRING *lib), ARGIN_NULLOK(PMC *para
*
* LOCK()
*/
- if (lib)
+ if (!STRING_IS_NULL(lib))
lib_name = parrot_split_path_ext(interp, lib, &wo_ext, &ext);
else {
wo_ext = CONST_STRING(interp, "");
- lib_name = NULL;
- ext = NULL;
+ lib_name = STRINGNULL;
+ ext = STRINGNULL;
}
lib_pmc = is_loaded(interp, wo_ext);
View
4 src/dynpmc/os.pmc
@@ -508,9 +508,9 @@ reads entries from a directory.
/* Add \* to the directory name and start search. */
STRING *last_char = Parrot_str_substr(INTERP, path,
Parrot_str_length(INTERP, path) - 1, 1, NULL, 0);
- int trailing_slash = Parrot_str_equal(INTERP, last_char, string_from_literal(INTERP, "\\"))
+ int trailing_slash = STRING_equal(INTERP, last_char, string_from_literal(INTERP, "\\"))
||
- Parrot_str_equal(INTERP, last_char, string_from_literal(INTERP, "/"));
+ STRING_equal(INTERP, last_char, string_from_literal(INTERP, "/"));
cpath = Parrot_str_to_cstring(INTERP, Parrot_str_concat(INTERP,
path, string_from_literal(INTERP, trailing_slash ? "*" : "\\*"), 0));
hFind = FindFirstFile(cpath, &file_find_data);
View
4 src/embed.c
@@ -1118,10 +1118,10 @@ Parrot_compile_string(PARROT_INTERP, Parrot_String type, ARGIN(const char *code)
PARROT_ASSERT(interp->initial_pf);
}
- if (Parrot_str_compare(interp, CONST_STRING(interp, "PIR"), type) == 0)
+ if (STRING_equal(interp, CONST_STRING(interp, "PIR"), type))
return IMCC_compile_pir_s(interp, code, error);
- if (Parrot_str_compare(interp, CONST_STRING(interp, "PASM"), type) == 0)
+ if (STRING_equal(interp, CONST_STRING(interp, "PASM"), type))
return IMCC_compile_pasm_s(interp, code, error);
*error = Parrot_str_new(interp, "Invalid interpreter type", 0);
View
4 src/exceptions.c
@@ -131,7 +131,7 @@ die_from_exception(PARROT_INTERP, ARGIN(PMC *exception))
}
}
- if (Parrot_str_not_equal(interp, message, CONST_STRING(interp, ""))) {
+ if (STRING_length(message)) {
if (use_perr)
Parrot_io_eprintf(interp, "%S\n", message);
else {
@@ -234,7 +234,7 @@ Parrot_ex_throw_from_op(PARROT_INTERP, ARGIN(PMC *exception), ARGIN_NULLOK(void
const INTVAL severity = VTABLE_get_integer_keyed_str(interp, exception, CONST_STRING(interp, "severity"));
if (severity < EXCEPT_error) {
PMC * const resume = VTABLE_get_attr_str(interp, exception, CONST_STRING(interp, "resume"));
- if (Parrot_str_not_equal(interp, message, CONST_STRING(interp, ""))) {
+ if (STRING_length(message)) {
Parrot_io_eprintf(interp, "%S\n", message);
}
else {
View
4 src/hash.c
@@ -316,7 +316,7 @@ hash_compare_string(PARROT_INTERP, ARGIN(const void *search_key),
STRING const *s1 = (STRING const *)search_key;
STRING const *s2 = (STRING const *)bucket_key;
- return Parrot_str_equal(interp, s1, s2) == 0;
+ return !STRING_equal(interp, s1, s2);
}
@@ -1499,7 +1499,7 @@ parrot_hash_get_bucket_string(PARROT_INTERP, ARGIN(const Hash *hash),
if ((STRING_byte_length(s) == STRING_byte_length(s2))
&& (memcmp(s->strstart, s2->strstart, STRING_byte_length(s)) == 0))
break;
- } else if (Parrot_str_equal(interp, s, s2))
+ } else if (STRING_equal(interp, s, s2))
break;
}
bucket = bucket->next;
View
2  src/hll.c
@@ -209,7 +209,7 @@ Parrot_register_HLL_lib(PARROT_INTERP, ARGIN(STRING *hll_lib))
if (!PMC_IS_NULL(lib_name)) {
const STRING * const lib_name_str = VTABLE_get_string(interp, lib_name);
- if (Parrot_str_equal(interp, lib_name_str, hll_lib))
+ if (STRING_equal(interp, lib_name_str, hll_lib))
break;
}
}
View
2  src/io/filehandle.c
@@ -674,7 +674,7 @@ Parrot_io_is_encoding(PARROT_INTERP, ARGIN(const PMC *filehandle), ARGIN(STRING
if (STRING_IS_NULL(handle_struct->encoding))
return 0;
- if (Parrot_str_equal(interp, value, handle_struct->encoding))
+ if (STRING_equal(interp, value, handle_struct->encoding))
return 1;
return 0;
View
10 src/library.c
@@ -575,7 +575,7 @@ try_bytecode_extensions(PARROT_INTERP, ARGMOD(STRING* path))
if (Parrot_str_byte_length(interp, test_path) > 4) {
STRING *orig_ext = Parrot_str_substr(interp, test_path, -4, 4);
/* First try substituting .pbc for the .pir extension */
- if (Parrot_str_equal(interp, orig_ext, pir_extension)) {
+ if (STRING_equal(interp, orig_ext, pir_extension)) {
STRING * const without_ext = Parrot_str_chopn(interp, test_path, 4);
test_path = Parrot_str_concat(interp, without_ext, bytecode_extension);
result = try_load_path(interp, test_path);
@@ -583,7 +583,7 @@ try_bytecode_extensions(PARROT_INTERP, ARGMOD(STRING* path))
return result;
}
/* Next try substituting .pir, then .pasm for the .pbc extension */
- else if (Parrot_str_equal(interp, orig_ext, bytecode_extension)) {
+ else if (STRING_equal(interp, orig_ext, bytecode_extension)) {
STRING * const without_ext = Parrot_str_chopn(interp, test_path, 4);
test_path = Parrot_str_concat(interp, without_ext, pir_extension);
result = try_load_path(interp, test_path);
@@ -601,7 +601,7 @@ try_bytecode_extensions(PARROT_INTERP, ARGMOD(STRING* path))
/* Finally, try substituting .pbc for the .pasm extension. */
if (Parrot_str_byte_length(interp, test_path) > 5) {
STRING * const orig_ext = Parrot_str_substr(interp, test_path, -5, 5);
- if (Parrot_str_equal(interp, orig_ext, pasm_extension)) {
+ if (STRING_equal(interp, orig_ext, pasm_extension)) {
STRING * const without_ext = Parrot_str_chopn(interp, test_path, 5);
test_path = Parrot_str_concat(interp, without_ext, bytecode_extension);
result = try_load_path(interp, test_path);
@@ -878,12 +878,12 @@ parrot_split_path_ext(PARROT_INTERP, ARGMOD(STRING *in),
else if (pos_sl) {
stem = Parrot_str_substr(interp, in, pos_sl, len - pos_sl);
*wo_ext = in;
- *ext = NULL;
+ *ext = STRINGNULL;
}
else {
stem = in;
*wo_ext = stem;
- *ext = NULL;
+ *ext = STRINGNULL;
}
return stem;
}
View
8 src/multidispatch.c
@@ -401,13 +401,13 @@ mmd_build_type_tuple_from_type_list(PARROT_INTERP, ARGIN(PMC *type_list))
STRING *type_name = VTABLE_get_string_keyed_int(interp, type_list, i);
INTVAL type;
- if (Parrot_str_equal(interp, type_name, CONST_STRING(interp, "DEFAULT")))
+ if (STRING_equal(interp, type_name, CONST_STRING(interp, "DEFAULT")))
type = enum_type_PMC;
- else if (Parrot_str_equal(interp, type_name, CONST_STRING(interp, "STRING")))
+ else if (STRING_equal(interp, type_name, CONST_STRING(interp, "STRING")))
type = enum_type_STRING;
- else if (Parrot_str_equal(interp, type_name, CONST_STRING(interp, "INTVAL")))
+ else if (STRING_equal(interp, type_name, CONST_STRING(interp, "INTVAL")))
type = enum_type_INTVAL;
- else if (Parrot_str_equal(interp, type_name, CONST_STRING(interp, "FLOATVAL")))
+ else if (STRING_equal(interp, type_name, CONST_STRING(interp, "FLOATVAL")))
type = enum_type_FLOATVAL;
else
type = Parrot_pmc_get_type_str(interp, type_name);
View
2  src/oo.c
@@ -1274,7 +1274,7 @@ Parrot_ComposeRole(PARROT_INTERP, ARGIN(PMC *role),
const STRING * const check =
VTABLE_get_string_keyed_int(interp, exclude, i);
- if (Parrot_str_equal(interp, check, method_name)) {
+ if (STRING_equal(interp, check, method_name)) {
excluded = 1;
break;
}
View
12 src/ops/cmp.ops
@@ -78,7 +78,7 @@ inline op eq(in NUM, in NUM, inconst LABEL) :base_core {
}
op eq(in STR, in STR, inconst LABEL) :base_core {
- if (Parrot_str_equal(interp, $1, $2)) {
+ if (STRING_equal(interp, $1, $2)) {
goto OFFSET($3);
}
}
@@ -114,7 +114,7 @@ op eq(invar PMC, in NUM, inconst LABEL) :base_core {
}
op eq(invar PMC, in STR, inconst LABEL) :base_core {
- if (Parrot_str_equal(interp, VTABLE_get_string(interp, $1), $2)) {
+ if (STRING_equal(interp, VTABLE_get_string(interp, $1), $2)) {
goto OFFSET($3);
}
}
@@ -184,7 +184,7 @@ inline op ne(in NUM, in NUM, inconst LABEL) :base_core {
}
op ne(in STR, in STR, inconst LABEL) :base_core {
- if (Parrot_str_not_equal(interp, $1, $2)) {
+ if (!STRING_equal(interp, $1, $2)) {
goto OFFSET($3);
}
}
@@ -214,7 +214,7 @@ op ne(invar PMC, in NUM, inconst LABEL) :base_core {
}
op ne(invar PMC, in STR, inconst LABEL) :base_core {
- if (Parrot_str_not_equal(interp, VTABLE_get_string(interp, $1), $2)) {
+ if (!STRING_equal(interp, VTABLE_get_string(interp, $1), $2)) {
goto OFFSET($3);
}
}
@@ -857,7 +857,7 @@ inline op iseq(out INT, in NUM, in NUM) {
}
inline op iseq(out INT, in STR, in STR) {
- $1 = (Parrot_str_equal(interp, $2, $3) ? 1 : 0);
+ $1 = STRING_equal(interp, $2, $3);
}
inline op iseq(out INT, invar PMC, invar PMC) {
@@ -888,7 +888,7 @@ inline op isne(out INT, in NUM, in NUM) {
}
inline op isne(out INT, in STR, in STR) {
- $1 = (Parrot_str_not_equal(interp, $2, $3) ? 1 : 0);
+ $1 = !STRING_equal(interp, $2, $3);
}
inline op isne(out INT, invar PMC, invar PMC) {
View
32 src/ops/core_ops.c
@@ -16748,7 +16748,7 @@ return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_eq_s_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_equal(interp, SREG(1), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_equal(interp, SREG(1), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16756,7 +16756,7 @@ return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_eq_sc_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_equal(interp, SCONST(1), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_equal(interp, SCONST(1), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16764,7 +16764,7 @@ return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_eq_s_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_equal(interp, SREG(1), SCONST(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_equal(interp, SREG(1), SCONST(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16836,7 +16836,7 @@ return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_eq_p_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_equal(interp, VTABLE_get_string(interp, PREG(1)), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_equal(interp, VTABLE_get_string(interp, PREG(1)), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16844,7 +16844,7 @@ return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_eq_p_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_equal(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (STRING_equal(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16956,7 +16956,7 @@ return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_ne_s_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_not_equal(interp, SREG(1), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (!STRING_equal(interp, SREG(1), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16964,7 +16964,7 @@ return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_ne_sc_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_not_equal(interp, SCONST(1), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (!STRING_equal(interp, SCONST(1), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16972,7 +16972,7 @@ return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_ne_s_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_not_equal(interp, SREG(1), SCONST(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (!STRING_equal(interp, SREG(1), SCONST(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17032,7 +17032,7 @@ return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_ne_p_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_not_equal(interp, VTABLE_get_string(interp, PREG(1)), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (!STRING_equal(interp, VTABLE_get_string(interp, PREG(1)), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17040,7 +17040,7 @@ return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_ne_p_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_not_equal(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2))) {return (opcode_t *)cur_opcode + ICONST(3);
+ if (!STRING_equal(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -18089,21 +18089,21 @@ return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_iseq_i_s_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (Parrot_str_equal(interp, SREG(2), SREG(3)) ? 1 : 0);
+ IREG(1) = STRING_equal(interp, SREG(2), SREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_iseq_i_sc_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (Parrot_str_equal(interp, SCONST(2), SREG(3)) ? 1 : 0);
+ IREG(1) = STRING_equal(interp, SCONST(2), SREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_iseq_i_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (Parrot_str_equal(interp, SREG(2), SCONST(3)) ? 1 : 0);
+ IREG(1) = STRING_equal(interp, SREG(2), SCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -18162,21 +18162,21 @@ return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_isne_i_s_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (Parrot_str_not_equal(interp, SREG(2), SREG(3)) ? 1 : 0);
+ IREG(1) = !STRING_equal(interp, SREG(2), SREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_isne_i_sc_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (Parrot_str_not_equal(interp, SCONST(2), SREG(3)) ? 1 : 0);
+ IREG(1) = !STRING_equal(interp, SCONST(2), SREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_isne_i_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (Parrot_str_not_equal(interp, SREG(2), SCONST(3)) ? 1 : 0);
+ IREG(1) = !STRING_equal(interp, SREG(2), SCONST(3));
return (opcode_t *)cur_opcode + 4;}
View
18 src/packfile.c
@@ -1181,7 +1181,7 @@ PackFile_find_segment(PARROT_INTERP, ARGIN_NULLOK(PackFile_Directory *dir),
PackFile_Segment *seg = dir->segments[i];
if (seg) {
- if (Parrot_str_equal(interp, seg->name, name))
+ if (STRING_equal(interp, seg->name, name))
return seg;
if (sub_dir && seg->type == PF_DIR_SEG) {
@@ -1223,7 +1223,7 @@ PackFile_remove_segment_by_name(PARROT_INTERP, ARGMOD(PackFile_Directory *dir),
for (i = 0; i < dir->num_segments; ++i) {
PackFile_Segment * const seg = dir->segments[i];
- if (Parrot_str_equal(interp, seg->name, name)) {
+ if (STRING_equal(interp, seg->name, name)) {
dir->num_segments--;
if (i != dir->num_segments) {
@@ -3031,7 +3031,7 @@ Parrot_debug_add_mapping(PARROT_INTERP, ARGMOD(PackFile_Debug *debug),
prev_filename_n = debug->mappings[debug->num_mappings-1].filename;
filename_pstr = Parrot_str_new(interp, filename, 0);
if (ct->str.constants[prev_filename_n] &&
- Parrot_str_equal(interp, filename_pstr,
+ STRING_equal(interp, filename_pstr,
ct->str.constants[prev_filename_n])) {
return;
}
@@ -3073,7 +3073,7 @@ Parrot_debug_add_mapping(PARROT_INTERP, ARGMOD(PackFile_Debug *debug),
/* Check if there is already a constant with this filename */
for (i= 0; i < count; ++i) {
- if (Parrot_str_equal(interp, namestr, ct->str.constants[i]))
+ if (STRING_equal(interp, namestr, ct->str.constants[i]))
break;
}
if (i < count) {
@@ -3931,7 +3931,7 @@ PackFile_Annotations_add_entry(PARROT_INTERP, ARGMOD(PackFile_Annotations *self)
for (i = 0; i < self->num_keys; ++i) {
STRING * const test_key = self->code->const_table->str.constants[self->keys[i].name];
- if (Parrot_str_equal(interp, test_key, key_name)) {
+ if (STRING_equal(interp, test_key, key_name)) {
key_id = i;
break;
}
@@ -4048,7 +4048,7 @@ PackFile_Annotations_lookup(PARROT_INTERP, ARGIN(PackFile_Annotations *self),
if (!STRING_IS_NULL(key)) {
for (i = 0; i < self->num_keys; ++i) {
STRING * const test_key = self->code->const_table->str.constants[self->keys[i].name];
- if (Parrot_str_equal(interp, test_key, key)) {
+ if (STRING_equal(interp, test_key, key)) {
key_id = i;
break;
}
@@ -4249,7 +4249,7 @@ Parrot_load_language(PARROT_INTERP, ARGIN_NULLOK(STRING *lang_name))
/* Check if the file found was actually a bytecode file (.pbc extension) or
* a source file (.pir or .pasm extension. */
- if (Parrot_str_equal(interp, found_ext, pbc))
+ if (STRING_equal(interp, found_ext, pbc))
file_type = PARROT_RUNTIME_FT_PBC;
else
file_type = PARROT_RUNTIME_FT_SOURCE;
@@ -4330,7 +4330,7 @@ Parrot_load_bytecode(PARROT_INTERP, ARGIN_NULLOK(Parrot_String file_str))
pbc = CONST_STRING(interp, "pbc");
- if (Parrot_str_equal(interp, ext, pbc))
+ if (STRING_equal(interp, ext, pbc))
file_type = PARROT_RUNTIME_FT_PBC;
else
file_type = PARROT_RUNTIME_FT_SOURCE;
@@ -4348,7 +4348,7 @@ Parrot_load_bytecode(PARROT_INTERP, ARGIN_NULLOK(Parrot_String file_str))
/* Check if the file found was actually a bytecode file (.pbc
* extension) or a source file (.pir or .pasm extension). */
- if (Parrot_str_equal(interp, found_ext, pbc))
+ if (STRING_equal(interp, found_ext, pbc))
file_type = PARROT_RUNTIME_FT_PBC;
else
file_type = PARROT_RUNTIME_FT_SOURCE;
View
2  src/packout.c
@@ -273,7 +273,7 @@ PackFile_ConstTable_rlookup_str(PARROT_INTERP,
for (i = 0; i < ct->str.const_count; i++) {
STRING *sc = ct->str.constants[i];
- if (Parrot_str_equal(interp, s, sc)
+ if (STRING_equal(interp, s, sc)
&& s->encoding == sc->encoding) {
return i;
}
View
30 src/pmc/callcontext.pmc
@@ -886,10 +886,10 @@ of integers.
VTABLE void set_attr_str(STRING *key, PMC *value) {
- if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "arg_flags"))) {
+ if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "arg_flags"))) {
SET_ATTR_arg_flags(INTERP, SELF, value);
}
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "return_flags"))) {
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "return_flags"))) {
SET_ATTR_return_flags(INTERP, SELF, value);
}
else
@@ -965,34 +965,34 @@ return current Namespace
PMC *value = PMCNULL;
INTVAL hll;
- if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "named")))
+ if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "named")))
value = get_named_names(INTERP, SELF);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "arg_flags")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "arg_flags")))
GET_ATTR_arg_flags(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "return_flags")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "return_flags")))
GET_ATTR_return_flags(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "caller_ctx")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "caller_ctx")))
GET_ATTR_caller_ctx(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "lex_pad")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "lex_pad")))
GET_ATTR_lex_pad(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "outer_ctx")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "outer_ctx")))
GET_ATTR_outer_ctx(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_sub")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "current_sub")))
GET_ATTR_current_sub(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_cont")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "current_cont")))
GET_ATTR_current_cont(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_object")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "current_object")))
GET_ATTR_current_object(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_namespace")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "current_namespace")))
GET_ATTR_current_namespace(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "handlers")))
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "handlers")))
GET_ATTR_handlers(INTERP, SELF, value);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_HLL"))) {
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "current_HLL"))) {
GET_ATTR_current_HLL(INTERP, SELF, hll);
value = Parrot_pmc_new(interp, Parrot_get_ctx_HLL_type(interp, enum_class_Integer));
VTABLE_set_integer_native(interp, value, hll);
}
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_hll"))) {
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "current_hll"))) {
GET_ATTR_current_HLL(INTERP, SELF, hll);
value = Parrot_pmc_new(interp, Parrot_get_ctx_HLL_type(interp, enum_class_String));
VTABLE_set_string_native(interp, value, Parrot_get_HLL_name(INTERP, hll));
View
24 src/pmc/class.pmc
@@ -1112,39 +1112,39 @@ Array of Class PMCs representing the direct parents of this class.
/* What should we return? */
PMC *found;
- if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "attributes"))) {
+ if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "attributes"))) {
found = _class->attrib_metadata;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "parents"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "parents"))) {
found = _class->parents;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "name"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "name"))) {
found = Parrot_pmc_new(INTERP, enum_class_String);
VTABLE_set_string_native(INTERP, found, _class->name);
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "id"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "id"))) {
found = Parrot_pmc_new_init_int(INTERP, enum_class_Integer, _class->id);
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "namespace"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "namespace"))) {
/* Should not clone this. */
return _class->_namespace;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "attrib_index"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "attrib_index"))) {
found = _class->attrib_index;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "methods"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "methods"))) {
found = _class->methods;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "vtable_overrides"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "vtable_overrides"))) {
found = _class->vtable_overrides;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "all_parents"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "all_parents"))) {
found = _class->all_parents;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "roles"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "roles"))) {
found = _class->roles;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "flags"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "flags"))) {
found = Parrot_pmc_new_init_int(INTERP, enum_class_Integer,
(INTVAL)PObj_get_FLAGS(SELF));
}
@@ -1479,7 +1479,7 @@ Returns whether the class is or inherits from C<*classname>.
PMC *want_class;
/* hard-code this one exception right away */
- if (Parrot_str_equal(INTERP, classname, CONST_STRING(INTERP, "Class")))
+ if (STRING_equal(INTERP, classname, CONST_STRING(INTERP, "Class")))
return 1;
want_class = Parrot_oo_get_class_str(INTERP, classname);
View
4 src/pmc/codestring.pmc
@@ -128,10 +128,10 @@ A newline is automatically added to the end of the fmt.
const INTVAL I0 = Parrot_str_to_int(INTERP, key);
repl = VTABLE_get_string_keyed_int(INTERP, args, I0);
}
- else if (Parrot_str_equal(INTERP, key, comma)) {
+ else if (STRING_equal(INTERP, key, comma)) {
repl = Parrot_str_join(INTERP, comma_space, args);
}
- else if (Parrot_str_equal(INTERP, key, percent)) {
+ else if (STRING_equal(INTERP, key, percent)) {
repl = percent;
}
else {
View
8 src/pmc/complex.pmc
@@ -501,10 +501,10 @@ Returns the requested number (real part for C<real> and imaginary for C<imag>).
VTABLE FLOATVAL get_number_keyed_str(STRING *key) {
FLOATVAL value;
- if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "real"))) {
+ if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "real"))) {
GET_ATTR_re(INTERP, SELF, value);
}
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "imag"))) {
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "imag"))) {
GET_ATTR_im(INTERP, SELF, value);
}
else
@@ -687,10 +687,10 @@ to C<value>.
}
VTABLE void set_number_keyed_str(STRING *key, FLOATVAL value) {
- if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "real"))) {
+ if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "real"))) {
SET_ATTR_re(INTERP, SELF, value);
}
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "imag"))) {
+ else if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "imag"))) {
SET_ATTR_im(INTERP, SELF, value);
}
else
View
12 src/pmc/default.pmc
@@ -197,9 +197,9 @@ check_set_std_props(PARROT_INTERP, ARGMOD(PMC *pmc), ARGIN(const STRING *key), A
ASSERT_ARGS(check_set_std_props)
/*
- * s2 in Parrot_str_equal is freed here
+ * s2 in STRING_equal is freed here
*/
- if (Parrot_str_equal(interp, key, CONST_STRING(interp, "_ro"))) {
+ if (STRING_equal(interp, key, CONST_STRING(interp, "_ro"))) {
/* pmc should set/clear readonly */
const INTVAL on = VTABLE_get_bool(interp, value);
@@ -286,7 +286,7 @@ check_get_std_props(PARROT_INTERP, ARGIN(const PMC *self), ARGIN(const STRING *k
ASSERT_ARGS(check_get_std_props)
if ((self->vtable->flags & (VTABLE_IS_CONST_FLAG | VTABLE_IS_READONLY_FLAG))
- && Parrot_str_equal(interp, key, CONST_STRING(interp, "_ro"))) {
+ && STRING_equal(interp, key, CONST_STRING(interp, "_ro"))) {
PMC * const ret_val = Parrot_pmc_new_init_int(interp,
enum_class_Integer, 1);
return ret_val;
@@ -1003,7 +1003,7 @@ true (1) is returned; otherwise, false (0) is returned.
else {
const Hash * const isa_hash = SELF->vtable->isa_hash;
if (!isa_hash)
- return Parrot_str_equal(INTERP, SELF->vtable->whoami, _class);
+ return STRING_equal(INTERP, SELF->vtable->whoami, _class);
return parrot_hash_exists(INTERP, isa_hash, (void *)_class);
}
@@ -1020,12 +1020,12 @@ Provides introspection of a specific piece of information about the PMC.
*/
VTABLE PMC *inspect_str(STRING *name) {
- if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "flags"))) {
+ if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "flags"))) {
PMC *found = Parrot_pmc_new_init_int(INTERP, enum_class_Integer,
(INTVAL)PObj_get_FLAGS(SELF));
return found;
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "mro"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "mro"))) {
return VTABLE_clone(INTERP, SELF->vtable->mro);
}
else
View
6 src/pmc/eventhandler.pmc
@@ -217,7 +217,7 @@ handle the registered events.
Parrot_EventHandler_attributes * const e = PARROT_EVENTHANDLER(SELF);
PMC *value = PMCNULL;
- if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "code"))) {
+ if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "code"))) {
value = e->code;
}
@@ -277,12 +277,12 @@ Report whether the event handler can handle a particular type of event.
PMC * const type = VTABLE_get_attr_str(INTERP, event, CONST_STRING(INTERP, "type"));
STRING * const type_str = VTABLE_get_string(INTERP, type);
- if (Parrot_str_equal(INTERP, type_str, CONST_STRING(INTERP, "event"))) {
+ if (STRING_equal(INTERP, type_str, CONST_STRING(INTERP, "event"))) {
Parrot_EventHandler_attributes * const handler_struct = PARROT_EVENTHANDLER(SELF);
PMC * const subtype = VTABLE_get_attr_str(INTERP, event, CONST_STRING(INTERP, "subtype"));
STRING * const subtype_str = VTABLE_get_string(INTERP, subtype);
- if (Parrot_str_equal(INTERP, subtype_str, handler_struct->type)) {
+ if (STRING_equal(INTERP, subtype_str, handler_struct->type)) {
RETURN(INTVAL 1);
}
}
View
28 src/pmc/exception.pmc
@@ -287,7 +287,7 @@ C<key> is "message".
STRING * const name = VTABLE_get_string(INTERP, key);
STRING *message;
- if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "message"))) {
+ if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "message"))) {
message = SELF.get_string();
}
else {
@@ -421,7 +421,7 @@ Sets the Parrot string value for C<*key>.
VTABLE void set_string_keyed(PMC *key, STRING *value) {
STRING * const name = VTABLE_get_string(INTERP, key);
- if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "message"))) {
+ if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "message"))) {
SELF.set_string_native(value);
}
else {
@@ -844,29 +844,29 @@ getAttrEnum(PARROT_INTERP, ARGIN(const STRING *name))
ASSERT_ARGS(getAttrEnum)
AttrEnum r;
- if (Parrot_str_equal(interp, name, CONST_STRING(interp, "birthtime")))
+ if (STRING_equal(interp, name, CONST_STRING(interp, "birthtime")))
r = attr_birthtime;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "message")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "message")))
r = attr_message;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "payload")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "payload")))
r = attr_payload;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "resume")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "resume")))
r = attr_resume;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "severity")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "severity")))
r = attr_severity;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "type")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "type")))
r = attr_type;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "exit_code")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "exit_code")))
r = attr_exit_code;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "backtrace")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "backtrace")))
r = attr_backtrace;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "handled")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "handled")))
r = attr_handled;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "handler_iter")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "handler_iter")))
r = attr_handler_iter;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "handler_ctx")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "handler_ctx")))
r = attr_handler_ctx;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "thrower")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "thrower")))
r = attr_thrower;
else
r = attr_NONE;
View
6 src/pmc/filehandle.pmc
@@ -584,11 +584,11 @@ Full buffering, bytes are sent when the buffer is full.
INTVAL flags;
if (got_type) {
- if (Parrot_str_equal(INTERP, new_type, nobuffer_string))
+ if (STRING_equal(INTERP, new_type, nobuffer_string))
Parrot_io_setbuf(INTERP, SELF, PIOCTL_NONBUF);
- else if (Parrot_str_equal(INTERP, new_type, linebuffer_string))
+ else if (STRING_equal(INTERP, new_type, linebuffer_string))
Parrot_io_setlinebuf(INTERP, SELF);
- else if (Parrot_str_equal(INTERP, new_type, fullbuffer_string))
+ else if (STRING_equal(INTERP, new_type, fullbuffer_string))
Parrot_io_setbuf(INTERP, SELF, PIO_UNBOUND);
}
View
2  src/pmc/fixedbooleanarray.pmc
@@ -274,7 +274,7 @@ Returns the Parrot string representation of the array.
VTABLE STRING *get_string() {
STRING *zero, *one;
- STRING *str = NULL;
+ STRING *str = STRINGNULL;
UINTVAL i;
UINTVAL elems = SELF.elements();
View
2  src/pmc/fixedstringarray.pmc
@@ -571,7 +571,7 @@ The C<==> operation. Compares two array to hold equal elements.
if (STRING_IS_NULL(item1) || STRING_IS_NULL(item2))
return 0;
- if (!Parrot_str_equal(INTERP, item1, item2))
+ if (!STRING_equal(INTERP, item1, item2))
return 0;
}
View
2  src/pmc/lexinfo.pmc
@@ -95,7 +95,7 @@ C<symbols>, which gets an array of the names of the symbols in this lexpad.
*/
VTABLE PMC *inspect_str(STRING *what) {
- if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "symbols"))) {
+ if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "symbols"))) {
PMC * const result = Parrot_pmc_new(INTERP, enum_class_ResizableStringArray);
const Hash *hash = (Hash *)SELF.get_pointer();
View
10 src/pmc/namespace.pmc
@@ -182,7 +182,7 @@ ns_insert_sub_keyed_str(PARROT_INTERP, ARGIN(PMC *self), ARGIN(STRING *key),
if (sub->comp_flags & SUB_COMP_FLAG_METHOD) {
STRING *method_name = key;
- if (Parrot_str_equal(interp, sub->method_name, CONST_STRING(interp, ""))) {
+ if (STRING_equal(interp, sub->method_name, CONST_STRING(interp, ""))) {
if (sub->vtable_index != -1 && !STRING_IS_NULL(vtable_key)) {
method_name = vtable_key;
}
@@ -287,7 +287,7 @@ add_multi_to_namespace(PARROT_INTERP, ARGIN(PMC *SELF), ARGIN(STRING *key),
STRING *method_name = key;
Hash *hash;
- if (Parrot_str_not_equal(interp, sub->method_name, empty_str))
+ if (!STRING_equal(interp, sub->method_name, empty_str))
method_name = sub->method_name;
add_to_class(interp, nsinfo, classobj, method_name, value);
@@ -731,13 +731,13 @@ Includes vtable overrides composed in from roles.
const Parrot_NameSpace_attributes * const nsinfo = PARROT_NAMESPACE(SELF);
PMC *found;
- if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "methods"))) {
+ if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "methods"))) {
found = nsinfo->methods;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "vtable_overrides"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "vtable_overrides"))) {
found = nsinfo->vtable;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "class"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "class"))) {
found = nsinfo->_class;
}
else
View
2  src/pmc/object.pmc
@@ -678,7 +678,7 @@ Returns whether the class is or inherits from C<*classname>.
VTABLE INTVAL isa(STRING *classname) {
if (SELF->vtable->whoami == classname
- || Parrot_str_equal(INTERP, SELF->vtable->whoami, classname))
+ || STRING_equal(INTERP, SELF->vtable->whoami, classname))
return 1;
else {
PMC *_class = PARROT_OBJECT(SELF)->_class;
View
22 src/pmc/packfile.pmc
@@ -316,7 +316,7 @@ Fetch a string keyed value from the packfile object. Valid keys are:
*/
VTABLE STRING *get_string_keyed_str(STRING *key) {
- if (!Parrot_str_compare(INTERP, key, CONST_STRING(INTERP, "uuid")))
+ if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "uuid")))
return PARROT_PACKFILE(SELF)->uuid;
Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_KEY_NOT_FOUND,
@@ -431,7 +431,7 @@ keys are:
*/
VTABLE void set_string_keyed_str(STRING *key, STRING *value) {
- if (!Parrot_str_compare(INTERP, key, CONST_STRING(INTERP, "uuid"))) {
+ if (STRING_equal(INTERP, key, CONST_STRING(INTERP, "uuid"))) {
PARROT_PACKFILE(SELF)->uuid = value;
return;
}
@@ -532,23 +532,23 @@ getAttrEnum(PARROT_INTERP, ARGIN(const STRING *name))
ASSERT_ARGS(getAttrEnum)
AttrEnumPackfile r;
- if (Parrot_str_equal(interp, name, CONST_STRING(interp, "wordsize")))
+ if (STRING_equal(interp, name, CONST_STRING(interp, "wordsize")))
r = attr_wordsize;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "byteorder")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "byteorder")))
r = attr_byteorder;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "fptype")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "fptype")))
r = attr_fptype;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "version_major")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "version_major")))
r = attr_version_major;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "version_minor")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "version_minor")))
r = attr_version_minor;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "version_patch")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "version_patch")))
r = attr_version_patch;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "bytecode_major")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "bytecode_major")))
r = attr_bytecode_major;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "bytecode_minor")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "bytecode_minor")))
r = attr_bytecode_minor;
- else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "uuid_type")))
+ else if (STRING_equal(interp, name, CONST_STRING(interp, "uuid_type")))
r = attr_uuid_type;
else
r = attr_NONE;
View
2  src/pmc/packfileconstanttable.pmc
@@ -318,7 +318,7 @@ Get or create constant for passed value.
for (i=0; i < num; ++i) {
STRING * const str = VTABLE_get_string_keyed_int(INTERP, attrs->str_constants, i);
- if (Parrot_str_equal(INTERP, value, str))
+ if (STRING_equal(INTERP, value, str))
return i;
}
View
16 src/pmc/parrotinterpreter.pmc
@@ -465,12 +465,12 @@ Introspection interface. C<key> can be:
PMC *ctx;
- if (Parrot_str_equal(INTERP, item, name))
+ if (STRING_equal(INTERP, item, name))
return INTERP->root_namespace;
name = CONST_STRING(INTERP, "outer");
- if (Parrot_str_equal(INTERP, item, name)) {
+ if (STRING_equal(INTERP, item, name)) {
outer = item;
nextkey = key_next(INTERP, key);
@@ -522,32 +522,32 @@ Introspection interface. C<key> can be:
name = CONST_STRING(INTERP, "context");
- if (Parrot_str_equal(INTERP, item, name))
+ if (STRING_equal(INTERP, item, name))
return ctx;
name = CONST_STRING(INTERP, "sub");
- if (Parrot_str_equal(INTERP, item, name))
+ if (STRING_equal(INTERP, item, name))
return Parrot_pcc_get_sub(INTERP, ctx);
name = CONST_STRING(INTERP, "lexpad");
- if (Parrot_str_equal(INTERP, item, name))
+ if (STRING_equal(INTERP, item, name))
return Parrot_pcc_get_lex_pad(INTERP, ctx);
name = CONST_STRING(INTERP, "namespace");
- if (Parrot_str_equal(INTERP, item, name))
+ if (STRING_equal(INTERP, item, name))
return Parrot_pcc_get_namespace(INTERP, ctx);
name = CONST_STRING(INTERP, "continuation");
- if (Parrot_str_equal(INTERP, item, name))
+ if (STRING_equal(INTERP, item, name))
return VTABLE_clone(INTERP, Parrot_pcc_get_continuation(INTERP, ctx));
name = CONST_STRING(INTERP, "annotations");
- if (Parrot_str_equal(INTERP, item, name)) {
+ if (STRING_equal(INTERP, item, name)) {
PMC *sub_pmc = Parrot_pcc_get_sub(INTERP, ctx);
if (ctx == CURRENT_CONTEXT(INTERP)) {
/* We can't know the current program counter for the currently
View
10 src/pmc/pmcproxy.pmc
@@ -119,7 +119,7 @@ Initializes a PMCProxy PMC.
PMC *pclass = VTABLE_get_pmc_keyed_int(INTERP, INTERP->vtables[type_num]->mro, i);
PMC *cns = pclass->vtable->_namespace;
STRING *cname = pclass->vtable->whoami;
- if (Parrot_str_not_equal(INTERP, cname, CONST_STRING(INTERP, "scalar"))) {
+ if (!STRING_equal(INTERP, cname, CONST_STRING(INTERP, "scalar"))) {
PMC *pproxy = Parrot_oo_get_class(INTERP, cns);
VTABLE_push_pmc(INTERP, proxy_info->all_parents, pproxy);
}
@@ -217,7 +217,7 @@ Returns whether the class is or inherits from C<*classname>.
classname = VTABLE_get_string(INTERP, classobj);
/* Check if the passed name is the same as the stored short name. */
- if (Parrot_str_equal(INTERP, classname, _proxy->name))
+ if (STRING_equal(INTERP, classname, _proxy->name))
return 1;
/* Check if the class object is the same as self's class object */
@@ -225,7 +225,7 @@ Returns whether the class is or inherits from C<*classname>.
return 1;
/* Check if the passed name is the same as the fully qualified name. */
- if (Parrot_str_equal(INTERP, classname, VTABLE_get_string(INTERP, SELF)))
+ if (STRING_equal(INTERP, classname, VTABLE_get_string(INTERP, SELF)))
return 1;
/* Look in the isa hash. */
@@ -265,7 +265,7 @@ Returns whether the class is or inherits from C<*classname>.
Parrot_Class_attributes * const _proxy = PARROT_CLASS(SELF);
const STRING * const pmc_proxy = CONST_STRING(INTERP, "PMCProxy");
- if (Parrot_str_equal(INTERP, classname, pmc_proxy))
+ if (STRING_equal(INTERP, classname, pmc_proxy))
return 1;
if (SUPER(classname))
@@ -275,7 +275,7 @@ Returns whether the class is or inherits from C<*classname>.
if (INTERP->vtables[_proxy->id]) {
Hash *isa_hash = INTERP->vtables[_proxy->id]->isa_hash;
- if (!isa_hash && Parrot_str_equal(INTERP,
+ if (!isa_hash && STRING_equal(INTERP,
INTERP->vtables[_proxy->id]->whoami, classname)) {
return 1;
}
View
12 src/pmc/role.pmc
@@ -416,21 +416,21 @@ composed into this role.
/* What should we return? */
PMC *found;
- if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "name"))) {
+ if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "name"))) {
found = Parrot_pmc_new(INTERP, enum_class_String);
VTABLE_set_string_native(INTERP, found, role->name);
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "namespace"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "namespace"))) {
/* Don't clone the namespace, as it's not part of our state. */
return role->_namespace;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "attributes"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "attributes"))) {
found = role->attrib_metadata;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "methods"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "methods"))) {
found = role->methods;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "roles"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "roles"))) {
found = role->roles;
}
else {
@@ -541,7 +541,7 @@ Returns whether the class does the role with the given C<*rolename>.
Parrot_Role_attributes * const role = PARROT_ROLE(SELF);
INTVAL i, count;
- if (Parrot_str_equal(INTERP, role->name, role_name))
+ if (STRING_equal(INTERP, role->name, role_name))
return 1;
count = VTABLE_elements(INTERP, role->roles);
View
2  src/pmc/scalar.pmc
@@ -800,7 +800,7 @@ Returns whether the PMC has string equality with C<*value>.
*/
MULTI INTVAL is_equal_string(PMC *value) {
- return (0 != Parrot_str_equal(INTERP, VTABLE_get_string(INTERP, SELF),
+ return (0 != STRING_equal(INTERP, VTABLE_get_string(INTERP, SELF),
VTABLE_get_string(INTERP, value)));
}
View
8 src/pmc/scheduler.pmc
@@ -420,12 +420,12 @@ Deletes a handler from the scheduler.
for (index = 0; index < elements; ++index) {
const PMC * const handler = VTABLE_get_pmc_keyed_int(INTERP, handlers, index);
if (!PMC_IS_NULL(handler)) {
- if (Parrot_str_equal(INTERP, type, except_str)
+ if (STRING_equal(INTERP, type, except_str)
&& handler->vtable->base_type == enum_class_ExceptionHandler) {
VTABLE_set_pmc_keyed_int(INTERP, handlers, index, PMCNULL);
RETURN(void);
}
- else if (Parrot_str_equal(INTERP, type, event_str)
+ else if (STRING_equal(INTERP, type, event_str)
&& handler->vtable->base_type == enum_class_EventHandler) {
VTABLE_set_pmc_keyed_int(INTERP, handlers, index, PMCNULL);
RETURN(void);
@@ -520,9 +520,9 @@ If no type argument is passed, counts all handlers.
STRING * const event = CONST_STRING(INTERP, "event");
if (!PMC_IS_NULL(handler)) {
- if ((Parrot_str_equal(INTERP, type, exception)
+ if ((STRING_equal(INTERP, type, exception)
&& handler->vtable->base_type == enum_class_ExceptionHandler)
- || (Parrot_str_equal(INTERP, type, event)
+ || (STRING_equal(INTERP, type, event)
&& handler->vtable->base_type == enum_class_EventHandler))
++count;
}
View
4 src/pmc/string.pmc
@@ -243,7 +243,7 @@ they match.
STRING *str_val;
STRING * const v = VTABLE_get_string(INTERP, value);
GET_ATTR_str_val(INTERP, SELF, str_val);
- return (INTVAL)(Parrot_str_equal(INTERP, str_val, v));
+ return (INTVAL)(STRING_equal(INTERP, str_val, v));
}
MULTI INTVAL is_equal(PMC *value) {
@@ -286,7 +286,7 @@ Compares the string with C<value>; returns FALSE if they match.
STRING *str_val;
STRING * const v = VTABLE_get_string(INTERP, value);
GET_ATTR_str_val(INTERP, SELF, str_val);
- return Parrot_str_equal(INTERP, str_val, v);
+ return STRING_equal(INTERP, str_val, v);
}
/*
View
4 src/pmc/stringbuilder.pmc
@@ -394,7 +394,7 @@ key receives the value of the hash element.
VTABLE_get_string_keyed_int(INTERP, args,
Parrot_str_to_int(INTERP, key)));
}
- else if (Parrot_str_equal(INTERP, key, comma)) {
+ else if (STRING_equal(INTERP, key, comma)) {
INTVAL num_args = VTABLE_elements(INTERP, args);
INTVAL pos_args;
@@ -405,7 +405,7 @@ key receives the value of the hash element.
VTABLE_get_string_keyed_int(INTERP, args, pos_args));
}
}
- else if (Parrot_str_equal(INTERP, key, percent)) {
+ else if (STRING_equal(INTERP, key, percent)) {
VTABLE_push_string(INTERP, stringbuilder, percent);
}
else {
View
8 src/pmc/stringhandle.pmc
@@ -55,7 +55,7 @@ encoding_is_utf8(PARROT_INTERP, ARGIN_NULLOK(const STRING *s))
if (STRING_IS_NULL(s))
return 0;
else
- return Parrot_str_equal(interp, s, CONST_STRING(interp, "utf8"));
+ return STRING_equal(interp, s, CONST_STRING(interp, "utf8"));
}
pmclass StringHandle extends Handle auto_attrs {
@@ -391,15 +391,15 @@ ignored, but stored for mocking.
GET_ATTR_flags(INTERP, SELF, flags);
if (got_type) {
- if (Parrot_str_equal(INTERP, new_type, nobuffer_string)) {
+ if (STRING_equal(INTERP, new_type, nobuffer_string)) {
flags &= ~ PIO_F_LINEBUF;
flags &= ~ PIO_F_BLKBUF;
}
- else if (Parrot_str_equal(INTERP, new_type, linebuffer_string)) {
+ else if (STRING_equal(INTERP, new_type, linebuffer_string)) {
flags |= PIO_F_LINEBUF;
flags &= ~ PIO_F_BLKBUF;
}
- else if (Parrot_str_equal(INTERP, new_type, fullbuffer_string)) {
+ else if (STRING_equal(INTERP, new_type, fullbuffer_string)) {
flags &= ~ PIO_F_LINEBUF;
flags |= PIO_F_BLKBUF;
}
View
12 src/pmc/sub.pmc
@@ -908,22 +908,22 @@ The number of optional named arguments
}
/* Return the requested argument information */
- if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "pos_required"))) {
+ if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "pos_required"))) {
count_found = (INTVAL)sub->arg_info->pos_required;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "pos_optional"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "pos_optional"))) {
count_found = (INTVAL)sub->arg_info->pos_optional;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "pos_slurpy"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "pos_slurpy"))) {
count_found = (INTVAL)sub->arg_info->pos_slurpy;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "named_required"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "named_required"))) {
count_found = (INTVAL)sub->arg_info->named_required;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "named_optional"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "named_optional"))) {
count_found = (INTVAL)sub->arg_info->named_optional;
}
- else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "named_slurpy"))) {
+ else if (STRING_equal(INTERP, what, CONST_STRING(INTERP, "named_slurpy"))) {
count_found = (INTVAL)sub->arg_info->named_slurpy;
}
else
View
28 src/pmc/task.pmc
@@ -209,27 +209,27 @@ Gets the value of an attribute for this task.
Parrot_Task_attributes * const core_struct = PARROT_TASK(SELF);
PMC *value;
- if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "id"))) {
+ if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "id"))) {
value = Parrot_pmc_new_init_int(INTERP, enum_class_Integer,
core_struct->id);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "type"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "type"))) {
value = Parrot_pmc_new(INTERP, enum_class_String);
VTABLE_set_string_native(INTERP, value, core_struct->type);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "subtype"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "subtype"))) {
value = Parrot_pmc_new(INTERP, enum_class_String);
VTABLE_set_string_native(INTERP, value, core_struct->subtype);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "priority"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "priority"))) {
value = Parrot_pmc_new_init_int(INTERP, enum_class_Integer,
core_struct->priority);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "status"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "status"))) {
value = Parrot_pmc_new(INTERP, enum_class_String);
VTABLE_set_string_native(INTERP, value, core_struct->status);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "birthtime"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "birthtime"))) {
value = Parrot_pmc_new(INTERP, enum_class_Float);
VTABLE_set_number_native(INTERP, value, core_struct->birthtime);
}
@@ -252,28 +252,28 @@ Sets the value of an attribute for this task.
VTABLE void set_attr_str(STRING *name, PMC *value) {
Parrot_Task_attributes * const core_struct = PARROT_TASK(SELF);
- if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "id"))) {
+ if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "id"))) {
core_struct->id = VTABLE_get_integer(INTERP, value);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "type"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "type"))) {
core_struct->type = VTABLE_get_string(INTERP, value);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "subtype"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "subtype"))) {
core_struct->subtype = VTABLE_get_string(INTERP, value);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "priority"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "priority"))) {
core_struct->priority = VTABLE_get_integer(INTERP, value);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "status"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "status"))) {
core_struct->status = VTABLE_get_string(INTERP, value);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "birthtime"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "birthtime"))) {
core_struct->birthtime = VTABLE_get_number(INTERP, value);
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "code"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "code"))) {
core_struct->codeblock = value;
}
- else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "data"))) {
+ else if (STRING_equal(INTERP, name, CONST_STRING(INTERP, "data"))) {
core_struct->data = value;
}
}
View
4 src/runcore/main.c
@@ -127,11 +127,11 @@ Parrot_runcore_switch(PARROT_INTERP, ARGIN(STRING *name))
size_t i;
if (interp->run_core
- && Parrot_str_equal(interp, name, interp->run_core->name))
+ && STRING_equal(interp, name, interp->run_core->name))
return;
for (i = 0; i < num_cores; ++i) {
- if (Parrot_str_equal(interp, name, interp->cores[i]->name)) {
+ if (STRING_equal(interp, name, interp->cores[i]->name)) {
interp->run_core = interp->cores[i];
return;
}
View
8 src/runcore/profiling.c
@@ -169,10 +169,10 @@ init_profiling_core(PARROT_INTERP, ARGIN(Parrot_profiling_runcore_t *runcore), A
if (output_cstr) {
STRING *profile_format_str = Parrot_str_new(interp, output_cstr, 0);
- if (Parrot_str_equal(interp, profile_format_str, CONST_STRING(interp, "pprof"))) {
+ if (STRING_equal(interp, profile_format_str, CONST_STRING(interp, "pprof"))) {
runcore->output_fn = record_values_ascii_pprof;
}
- else if (Parrot_str_equal(interp, profile_format_str, CONST_STRING(interp, "none"))) {
+ else if (STRING_equal(interp, profile_format_str, CONST_STRING(interp, "none"))) {
runcore->output_fn = record_values_none;
}
else {
@@ -197,11 +197,11 @@ init_profiling_core(PARROT_INTERP, ARGIN(Parrot_profiling_runcore_t *runcore), A
profile_filename = Parrot_str_to_cstring(interp, runcore->profile_filename);
lc_filename = Parrot_str_downcase(interp, runcore->profile_filename);
- if (Parrot_str_equal(interp, lc_filename, CONST_STRING(interp, "stderr"))) {
+ if (STRING_equal(interp, lc_filename, CONST_STRING(interp, "stderr"))) {
runcore->profile_fd = stderr;
runcore->profile_filename = lc_filename;
}
- else if (Parrot_str_equal(interp, lc_filename, CONST_STRING(interp, "stdout"))) {
+ else if (STRING_equal(interp, lc_filename, CONST_STRING(interp, "stdout"))) {
runcore->profile_fd = stdout;
runcore->profile_filename = lc_filename;
}
View
18 src/scheduler.c
@@ -137,13 +137,13 @@ Parrot_cx_handle_tasks(PARROT_INTERP, ARGMOD(PMC *scheduler))
PMC * const type_pmc = VTABLE_get_attr_str(interp, task, CONST_STRING(interp, "type"));
STRING * const type = VTABLE_get_string(interp, type_pmc);
- if (Parrot_str_equal(interp, type, CONST_STRING(interp, "callback"))) {
+ if (STRING_equal(interp, type, CONST_STRING(interp, "callback"))) {
Parrot_cx_invoke_callback(interp, task);
}
- else if (Parrot_str_equal(interp, type, CONST_STRING(interp, "timer"))) {
+ else if (STRING_equal(interp, type, CONST_STRING(interp, "timer"))) {
Parrot_cx_timer_invoke(interp, task);
}
- else if (Parrot_str_equal(interp, type, CONST_STRING(interp, "event"))) {
+ else if (STRING_equal(interp, type, CONST_STRING(interp, "event"))) {
PMC * const handler = Parrot_cx_find_handler_for_task(interp, task);
if (!PMC_IS_NULL(handler)) {
PMC * const handler_sub = VTABLE_get_attr_str(interp, handler, CONST_STRING(interp, "code"));
@@ -455,7 +455,7 @@ Parrot_cx_delete_suspend_for_gc(PARROT_INTERP)
for (index = 0; index < num_tasks; ++index) {
PMC *message = VTABLE_get_pmc_keyed_int(interp, sched_struct->messages, index);
if (!PMC_IS_NULL(message)
- && Parrot_str_equal(interp, VTABLE_get_string(interp, message),
+ && STRING_equal(interp, VTABLE_get_string(interp, message),
suspend_str)) {
VTABLE_delete_keyed_int(interp, sched_struct->messages, index);
UNLOCK(sched_struct->msg_lock);
@@ -533,9 +533,9 @@ Parrot_cx_delete_handler_local(PARROT_INTERP, ARGIN(STRING *handler_type))
typedef enum { Hunknown, Hexception, Hevent } Htype;
const Htype htype =
- Parrot_str_equal(interp, handler_type, exception_str) ?
+ STRING_equal(interp, handler_type, exception_str) ?
Hexception :
- Parrot_str_equal(interp, handler_type, event_str) ?
+ STRING_equal(interp, handler_type, event_str) ?
Hevent :
Hunknown;
STRING * const handler_name = (htype == Hexception) ? handler_str : (STRING *)NULL;
@@ -606,9 +606,9 @@ Parrot_cx_count_handlers_local(PARROT_INTERP, ARGIN(STRING *handler_type))
typedef enum { Hunknown, Hexception, Hevent } Htype;
const Htype htype =
- (Parrot_str_equal(interp, handler_type, exception_str)) ?
+ (STRING_equal(interp, handler_type, exception_str)) ?
Hexception :
- (Parrot_str_equal(interp, handler_type, event_str)) ?
+ (STRING_equal(interp, handler_type, event_str)) ?
Hevent :
Hunknown;
STRING * const handler_name = (htype == Hexception) ? handler_str : (STRING *)NULL;
@@ -1132,7 +1132,7 @@ scheduler_process_messages(PARROT_INTERP, ARGMOD(PMC *scheduler))
#endif
UNLOCK(sched_struct->msg_lock);
if (!PMC_IS_NULL(message)
- && Parrot_str_equal(interp, VTABLE_get_string(interp, message),
+ && STRING_equal(interp, VTABLE_get_string(interp, message),
suspend_str)) {
#if CX_DEBUG
fprintf(stderr, "found a suspend, suspending [interp=%p]\n", interp);
View
39 src/string/api.c
@@ -569,7 +569,7 @@ Parrot_str_new_from_buffer(PARROT_INTERP, ARGMOD(Buffer *buffer), const UINTVAL
result->strstart = (char *)Buffer_bufstart(result);
result->bufused = len;
result->strlen = len;
- result->encoding = Parrot_binary_encoding_ptr;
+ result->encoding = Parrot_binary_encoding_ptr;
Buffer_buflen(buffer) = 0;
Buffer_bufstart(buffer) = NULL;
@@ -1315,7 +1315,11 @@ INTVAL
Parrot_str_not_equal(PARROT_INTERP, ARGIN_NULLOK(const STRING *s1), ARGIN_NULLOK(const STRING *s2))
{
ASSERT_ARGS(Parrot_str_not_equal)
- return !Parrot_str_equal(interp, s1, s2);
+
+ if (s1 == NULL)
+ s1 = STRINGNULL;
+
+ return !STRING_equal(interp, s1, s2);
}
@@ -1325,10 +1329,12 @@ Parrot_str_not_equal(PARROT_INTERP, ARGIN_NULLOK(const STRING *s1), ARGIN_NULLOK
*s2)>
Compares two Parrot strings, performing type and encoding conversions if
-necessary.
+necessary. The null string is considered equal to the empty string.
Returns 1 if the strings are equal, and 0 otherwise.
+Identical to the STRING_equal macro.
+
=cut
*/
@@ -1339,22 +1345,11 @@ INTVAL
Parrot_str_equal(PARROT_INTERP, ARGIN_NULLOK(const STRING *s1), ARGIN_NULLOK(const STRING *s2))
{
ASSERT_ARGS(Parrot_str_equal)
- UINTVAL len1 = STRING_length(s1);
- UINTVAL len2 = STRING_length(s2);
- if (len1 == 0)
- return len2 == 0;
- else if (len2 == 0)
- return 0;
-
- if (s1 == s2)
- return 1;
-
- if (s1->strlen != s2->strlen
- || (s1->hashval && s2->hashval && s1->hashval != s2->hashval))
- return 0;
+ if (s1 == NULL)
+ s1 = STRINGNULL;
- return STRING_compare(interp, s1, s2) == 0;
+ return STRING_equal(interp, s1, s2);
}
@@ -2004,13 +1999,13 @@ Parrot_str_to_num(PARROT_INTERP, ARGIN(const STRING *s))
/* charpos <= 2 because for "-i" iter already advanced to next char */
if (check_nan && (iter.charpos <= 2)) {
STRING *t = Parrot_str_upcase(interp, s);
- if (Parrot_str_equal(interp, t, CONST_STRING(interp, "NAN")))
+ if (STRING_equal(interp, t, CONST_STRING(interp, "NAN")))
return PARROT_FLOATVAL_NAN_QUIET;
- else if (Parrot_str_equal(interp, t, CONST_STRING(interp, "INF"))
- || Parrot_str_equal(interp, t, CONST_STRING(interp, "INFINITY")))
+ else if (STRING_equal(interp, t, CONST_STRING(interp, "INF"))
+ || STRING_equal(interp, t, CONST_STRING(interp, "INFINITY")))
return PARROT_FLOATVAL_INF_POSITIVE;
- else if (Parrot_str_equal(interp, t, CONST_STRING(interp, "-INF"))
- || Parrot_str_equal(interp, t, CONST_STRING(interp, "-INFINITY")))
+ else if (STRING_equal(interp, t, CONST_STRING(interp, "-INF"))
+ || STRING_equal(interp, t, CONST_STRING(interp, "-INFINITY")))
return PARROT_FLOATVAL_INF_NEGATIVE;
}
View
6 src/string/encoding.c
@@ -163,18 +163,18 @@ Parrot_encoding_number(PARROT_INTERP, ARGIN(const STRING *encodingname))
int i;
for (i = 0; i < n; ++i) {
- if (Parrot_str_equal(interp, encodings[i]->name_str, encodingname))
+ if (STRING_equal(interp, encodings[i]->name_str, encodingname))
return i;
}
/* backwards compatibility */
- if (Parrot_str_equal(interp, encodingname, unicode_str)) {
+ if (STRING_equal(interp, encodingname, unicode_str)) {
for (i = 0; i < n; ++i) {
if (STREQ(encodings[i]->name, "utf8"))
return i;
}
}
- else if (Parrot_str_equal(interp, encodingname, fixed_8_str)) {
+ else if (STRING_equal(interp, encodingname, fixed_8_str)) {
for (i = 0; i < n; ++i) {
if (STREQ(encodings[i]->name, "ascii"))
return i;
View
2  src/sub.c
@@ -422,7 +422,7 @@ Parrot_capture_lex(PARROT_INTERP, ARGMOD(PMC *sub_pmc))
if (!PMC_IS_NULL(child_sub->outer_sub)) {
PMC_get_sub(interp, child_sub->outer_sub, child_outer_sub);
- if (Parrot_str_equal(interp, current_sub->subid,
+ if (STRING_equal(interp, current_sub->subid,
child_outer_sub->subid)) {
child_sub->outer_ctx = ctx;
}
Please sign in to comment.
Something went wrong with that request. Please try again.