From 2ac7698fdf51500d3897e3dd9b1a9537dc40cd33 Mon Sep 17 00:00:00 2001 From: Jay Krell Date: Wed, 14 Aug 2019 03:24:50 -0700 Subject: [PATCH] Completely replace mono_error_ok with is_ok and make first external_only. (mono/mono#16217) Commit migrated from https://github.com/mono/mono/commit/136205ab45ca3fe01c49a321103e1563885c8da1 --- src/mono/mono/dis/dump.c | 8 +++--- src/mono/mono/dis/get.c | 8 +++--- src/mono/mono/dis/main.c | 4 +-- src/mono/mono/metadata/appdomain.c | 26 ++++++++++---------- src/mono/mono/metadata/class-init.c | 32 ++++++++++++------------ src/mono/mono/metadata/class.c | 38 ++++++++++++++--------------- src/mono/mono/metadata/cominterop.c | 2 +- src/mono/mono/metadata/custom-attrs.c | 2 +- src/mono/mono/metadata/exception.c | 2 +- src/mono/mono/metadata/loader.c | 30 +++++++++++------------ src/mono/mono/metadata/marshal-ilgen.c | 6 ++--- src/mono/mono/metadata/marshal.c | 32 ++++++++++++------------ src/mono/mono/metadata/metadata-verify.c | 4 +-- src/mono/mono/metadata/metadata.c | 2 +- src/mono/mono/metadata/mono-basic-block.c | 4 +-- src/mono/mono/metadata/object.c | 24 +++++++++--------- src/mono/mono/metadata/reflection.c | 4 +-- src/mono/mono/metadata/security-core-clr.c | 2 +- src/mono/mono/metadata/sre-encode.c | 2 +- src/mono/mono/metadata/sre-save.c | 6 ++--- src/mono/mono/metadata/sre.c | 8 +++--- src/mono/mono/metadata/threadpool.c | 2 +- src/mono/mono/metadata/threads.c | 2 +- src/mono/mono/metadata/verify.c | 18 +++++++------- src/mono/mono/mini/aot-compiler.c | 20 +++++++-------- src/mono/mono/mini/aot-runtime.c | 12 ++++----- src/mono/mono/mini/debugger-agent.c | 22 ++++++++--------- src/mono/mono/mini/debugger-engine.c | 2 +- src/mono/mono/mini/driver.c | 4 +-- src/mono/mono/mini/dwarfwriter.c | 4 +-- src/mono/mono/mini/interp/transform.c | 2 +- src/mono/mono/mini/jit-icalls.c | 18 +++++++------- src/mono/mono/mini/llvmonly-runtime.c | 2 +- src/mono/mono/mini/method-to-ir.c | 4 +-- src/mono/mono/mini/mini-exceptions.c | 8 +++--- src/mono/mono/mini/mini-generic-sharing.c | 10 ++++---- src/mono/mono/mini/mini-runtime.c | 28 ++++++++++----------- src/mono/mono/mini/mini-trampolines.c | 20 +++++++-------- src/mono/mono/mini/mini-wasm-debugger.c | 2 +- src/mono/mono/mini/mini.c | 8 +++--- src/mono/mono/profiler/aot.c | 2 +- src/mono/mono/unit-tests/test-mono-string.c | 2 +- src/mono/mono/utils/mono-error.c | 12 ++++----- src/mono/mono/utils/mono-error.h | 2 +- 44 files changed, 226 insertions(+), 226 deletions(-) diff --git a/src/mono/mono/dis/dump.c b/src/mono/mono/dis/dump.c index 5bfc806..6a0f91c 100755 --- a/src/mono/mono/dis/dump.c +++ b/src/mono/mono/dis/dump.c @@ -581,26 +581,26 @@ dump_table_method (MonoImage *m) type_container = mono_metadata_load_generic_params (m, MONO_TOKEN_TYPE_DEF | (current_type - 1), NULL, NULL); if (type_container) { mono_metadata_load_generic_param_constraints_checked (m, MONO_TOKEN_TYPE_DEF | (current_type - 1), type_container, error); - g_assert (mono_error_ok (error)); /*FIXME don't swallow the error message*/ + g_assert (is_ok (error)); /*FIXME don't swallow the error message*/ } } method_container = mono_metadata_load_generic_params (m, MONO_TOKEN_METHOD_DEF | i, type_container, NULL); if (method_container) { mono_metadata_load_generic_param_constraints_checked (m, MONO_TOKEN_METHOD_DEF | i, method_container, error); - g_assert (mono_error_ok (error)); /*FIXME don't swallow the error message*/ + g_assert (is_ok (error)); /*FIXME don't swallow the error message*/ } mono_metadata_decode_table_row (m, MONO_TABLE_METHOD, i - 1, cols, MONO_METHOD_SIZE); sigblob = mono_metadata_blob_heap (m, cols [MONO_METHOD_SIGNATURE]); mono_metadata_decode_blob_size (sigblob, &sigblob); method = mono_metadata_parse_method_signature_full (m, method_container ? method_container : type_container, i, sigblob, &sigblob, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { fprintf (output,"%d: failed to parse due to %s\n", i, mono_error_get_message (error)); mono_error_cleanup (error); continue; } - g_assert (mono_error_ok (error)); /*FIXME don't swallow the error message*/ + g_assert (is_ok (error)); /*FIXME don't swallow the error message*/ sig = dis_stringify_method_signature (m, method, i, method_container ? method_container : type_container, FALSE); impl_flags = get_method_impl_flags (cols [MONO_METHOD_IMPLFLAGS]); fprintf (output, "%d: %s (param: %d impl_flags: %s)\n", i, sig, cols [MONO_METHOD_PARAMLIST], impl_flags); diff --git a/src/mono/mono/dis/get.c b/src/mono/mono/dis/get.c index 3be34fe..bef286e 100755 --- a/src/mono/mono/dis/get.c +++ b/src/mono/mono/dis/get.c @@ -223,7 +223,7 @@ get_typespec (MonoImage *m, guint32 idx, gboolean is_def, MonoGenericContainer * case MONO_TYPE_FNPTR: { ERROR_DECL (error); sig = mono_metadata_parse_method_signature_full (m, container, 0, ptr, &ptr, error); - g_assert (mono_error_ok (error)); /*FIXME don't swallow the error message*/ + g_assert (is_ok (error)); /*FIXME don't swallow the error message*/ s = dis_stringify_function_ptr (m, sig); g_string_append (res, "method "); g_string_append (res, s); @@ -905,12 +905,12 @@ dis_stringify_method_signature_full (MonoImage *m, MonoMethodSignature *method, container = mono_metadata_load_generic_params (m, MONO_TOKEN_METHOD_DEF | methoddef_row, container, NULL); if (container) { mono_metadata_load_generic_param_constraints_checked (m, MONO_TOKEN_METHOD_DEF | methoddef_row, container, error); - g_assert (mono_error_ok (error)); /*FIXME don't swallow the error message*/ + g_assert (is_ok (error)); /*FIXME don't swallow the error message*/ } mono_metadata_decode_blob_size (sig, &sig); method = mono_metadata_parse_method_signature_full (m, container, methoddef_row, sig, &sig, error); - g_assert (mono_error_ok (error)); /*FIXME don't swallow the error message*/ + g_assert (is_ok (error)); /*FIXME don't swallow the error message*/ free_method = 1; } @@ -3146,7 +3146,7 @@ get_method_override (MonoImage *m, guint32 token, MonoGenericContainer *containe g_free (meth_str); return ret; } else { - if (!mono_error_ok (error)) { + if (!is_ok (error)) { char *meth_str = get_method_core (m, decl, FALSE, container); char *ret = g_strdup_printf ("Could not decode method override %s due to %s", meth_str, mono_error_get_message (error)); diff --git a/src/mono/mono/dis/main.c b/src/mono/mono/dis/main.c index 17162f0..9d8674b 100644 --- a/src/mono/mono/dis/main.c +++ b/src/mono/mono/dis/main.c @@ -863,7 +863,7 @@ dis_method_list (const char *klass_name, MonoImage *m, guint32 start, guint32 en if (container) { ERROR_DECL (error); mono_metadata_load_generic_param_constraints_checked (m, MONO_TOKEN_METHOD_DEF | (i + 1), container, error); - g_assert (mono_error_ok (error)); /*FIXME don't swallow the error message*/ + g_assert (is_ok (error)); /*FIXME don't swallow the error message*/ } else { container = type_container; } @@ -1206,7 +1206,7 @@ dis_type (MonoImage *m, int n, int is_nested, int forward) if (container) { ERROR_DECL (error); mono_metadata_load_generic_param_constraints_checked (m, MONO_TOKEN_TYPE_DEF | (n + 1), container, error); - g_assert (mono_error_ok (error)); /*FIXME don't swallow the error message*/ + g_assert (is_ok (error)); /*FIXME don't swallow the error message*/ } esname = get_escaped_name (name); diff --git a/src/mono/mono/metadata/appdomain.c b/src/mono/mono/metadata/appdomain.c index be9270f..da83ee1 100644 --- a/src/mono/mono/metadata/appdomain.c +++ b/src/mono/mono/metadata/appdomain.c @@ -756,7 +756,7 @@ mono_domain_create_appdomain_internal (char *friendly_name, MonoAppDomainSetupHa goto_if_nok (error, leave); data->setup = MONO_HANDLE_RAW (copy_app_domain_setup (data, setup, error)); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { g_free (data->friendly_name); goto leave; } @@ -768,7 +768,7 @@ mono_domain_create_appdomain_internal (char *friendly_name, MonoAppDomainSetupHa /*FIXME, guard this for when the debugger is not running */ char *shadow_location; shadow_location = get_shadow_assembly_location_base (data, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { g_free (data->friendly_name); goto leave; } @@ -1226,7 +1226,7 @@ mono_domain_set_options_from_config (MonoDomain *domain) return; config_file_name = mono_string_to_utf8_checked_internal (domain->setup->configuration_file, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_cleanup (error); goto free_and_out; } @@ -1600,7 +1600,7 @@ set_domain_search_path (MonoDomain *domain) if (MONO_HANDLE_GET_BOOL (setup, private_bin_path)) { search_path = mono_string_handle_to_utf8 (MONO_HANDLE_NEW_GET (MonoString, setup, private_bin_path), error); - if (!mono_error_ok (error)) { /*FIXME maybe we should bubble up the error.*/ + if (!is_ok (error)) { /*FIXME maybe we should bubble up the error.*/ g_warning ("Could not decode AppDomain search path since it contains invalid characters"); goto exit; } @@ -1642,7 +1642,7 @@ set_domain_search_path (MonoDomain *domain) tmp [npaths] = NULL; *tmp = mono_string_handle_to_utf8 (MONO_HANDLE_NEW_GET (MonoString, setup, application_base), error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { g_free (tmp); goto exit; } @@ -1852,7 +1852,7 @@ get_shadow_assembly_location_base (MonoDomain *domain, MonoError *error) #endif appname = mono_string_to_utf8_checked_internal (setup->application_name, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { g_free (cache_path); return NULL; } @@ -1886,7 +1886,7 @@ get_shadow_assembly_location (const char *filename, MonoError *error) g_snprintf (name_hash, sizeof (name_hash), "%08x", hash); g_snprintf (path_hash, sizeof (path_hash), "%08x_%08x_%08x", hash ^ hash2, hash2, domain->shadow_serial); tmploc = get_shadow_assembly_location_base (domain, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { g_free (bname); g_free (dirname); return NULL; @@ -1994,7 +1994,7 @@ mono_is_shadow_copy_enabled (MonoDomain *domain, const gchar *dir_name) goto exit; shadow_status_string = mono_string_to_utf8_checked_internal (setup->shadow_copy_files, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) goto exit; shadow_enabled = !g_ascii_strncasecmp (shadow_status_string, "true", 4); @@ -2009,7 +2009,7 @@ mono_is_shadow_copy_enabled (MonoDomain *domain, const gchar *dir_name) /* Is dir_name a shadow_copy destination already? */ base_dir = get_shadow_assembly_location_base (domain, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) goto exit; found = !!strstr (dir_name, base_dir); @@ -2017,7 +2017,7 @@ mono_is_shadow_copy_enabled (MonoDomain *domain, const gchar *dir_name) goto exit; all_dirs = mono_string_to_utf8_checked_internal (setup->shadow_copy_directories, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) goto exit; directories = g_strsplit (all_dirs, G_SEARCHPATH_SEPARATOR_S, 1000); @@ -2068,7 +2068,7 @@ mono_make_shadow_copy (const char *filename, MonoError *oerror) /* Is dir_name a shadow_copy destination already? */ shadow_dir = get_shadow_assembly_location_base (domain, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_cleanup (error); g_free (dir_name); mono_error_set_execution_engine (oerror, "Failed to create shadow copy (invalid characters in shadow directory name)."); @@ -2084,7 +2084,7 @@ mono_make_shadow_copy (const char *filename, MonoError *oerror) g_free (dir_name); shadow = get_shadow_assembly_location (filename, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_cleanup (error); mono_error_set_execution_engine (oerror, "Failed to create shadow copy (invalid characters in file name)."); return NULL; @@ -3235,7 +3235,7 @@ mono_domain_try_unload (MonoDomain *domain, MonoObject **exc) mono_runtime_try_invoke (method, domain->domain, NULL, exc, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { if (*exc) mono_error_cleanup (error); else diff --git a/src/mono/mono/metadata/class-init.c b/src/mono/mono/metadata/class-init.c index 3e41755..248be0b 100644 --- a/src/mono/mono/metadata/class-init.c +++ b/src/mono/mono/metadata/class-init.c @@ -306,7 +306,7 @@ mono_class_setup_fields (MonoClass *klass) if (!field->type) { mono_field_resolve_type (field, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { /*mono_field_resolve_type already failed class*/ mono_error_cleanup (error); break; @@ -519,7 +519,7 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token, MonoError */ if ((nesting_tokeen = mono_metadata_nested_in_typedef (image, type_token))) { klass->nested_in = mono_class_create_from_typedef (image, nesting_tokeen, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { /*FIXME implement a mono_class_set_failure_from_mono_error */ mono_class_set_type_load_failure (klass, "%s", mono_error_get_message (error)); mono_loader_unlock (); @@ -694,7 +694,7 @@ mono_generic_class_setup_parent (MonoClass *klass, MonoClass *gtd) MonoGenericClass *gclass = mono_class_get_generic_class (klass); klass->parent = mono_class_inflate_generic_class_checked (gtd->parent, mono_generic_class_get_context (gclass), error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { /*Set parent to something safe as the runtime doesn't handle well this kind of failure.*/ klass->parent = mono_defaults.object_class; mono_class_set_type_load_failure (klass, "Parent is a generic type instantiation that failed due to: %s", mono_error_get_message (error)); @@ -1512,7 +1512,7 @@ print_implemented_interfaces (MonoClass *klass) while (klass != NULL) { printf ("[LEVEL %d] Implemented interfaces by class %s:\n", ancestor_level, klass->name); ifaces = mono_class_get_implemented_interfaces (klass, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { printf (" Type failed due to %s\n", mono_error_get_message (error)); mono_error_cleanup (error); } else if (ifaces) { @@ -1791,7 +1791,7 @@ setup_interface_offsets (MonoClass *klass, int cur_slot, gboolean overwrite) max_iid = ic->interface_id; } ifaces = mono_class_get_implemented_interfaces (k, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { char *name = mono_type_get_full_name (k); mono_class_set_type_load_failure (klass, "Error getting the interfaces of %s due to %s", name, mono_error_get_message (error)); g_free (name); @@ -2858,7 +2858,7 @@ mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int o return; ifaces = mono_class_get_implemented_interfaces (klass, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { char *name = mono_type_get_full_name (klass); mono_class_set_type_load_failure (klass, "Could not resolve %s interfaces due to %s", name, mono_error_get_message (error)); g_free (name); @@ -4921,7 +4921,7 @@ mono_class_setup_methods (MonoClass *klass) for (i = 0; i < count; i++) { methods [i] = mono_class_inflate_generic_method_full_checked ( gklass->methods [i], klass, mono_class_get_context (klass), error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { char *method = mono_method_full_name (gklass->methods [i], TRUE); mono_class_set_type_load_failure (klass, "Could not inflate method %s due to %s", method, mono_error_get_message (error)); @@ -4941,7 +4941,7 @@ mono_class_setup_methods (MonoClass *klass) count = 3 + (klass->rank > 1? 2: 1); mono_class_setup_interfaces (klass, error); - g_assert (mono_error_ok (error)); /*FIXME can this fail for array types?*/ + g_assert (is_ok (error)); /*FIXME can this fail for array types?*/ if (klass->rank == 1 && klass->element_class->rank) { jagged_ctor = TRUE; @@ -5116,7 +5116,7 @@ mono_class_setup_properties (MonoClass *klass) prop->set = mono_class_inflate_generic_method_full_checked ( prop->set, klass, mono_class_get_context (klass), error); - g_assert (mono_error_ok (error)); /*FIXME proper error handling*/ + g_assert (is_ok (error)); /*FIXME proper error handling*/ prop->parent = klass; } @@ -5193,7 +5193,7 @@ inflate_method_listz (MonoMethod **methods, MonoClass *klass, MonoGenericContext for (om = methods, count = 0; *om; ++om, ++count) { ERROR_DECL (error); retval [count] = mono_class_inflate_generic_method_full_checked (*om, klass, context, error); - g_assert (mono_error_ok (error)); /*FIXME proper error handling*/ + g_assert (is_ok (error)); /*FIXME proper error handling*/ } return retval; @@ -5241,11 +5241,11 @@ mono_class_setup_events (MonoClass *klass) event->parent = klass; event->name = gevent->name; event->add = gevent->add ? mono_class_inflate_generic_method_full_checked (gevent->add, klass, context, error) : NULL; - g_assert (mono_error_ok (error)); /*FIXME proper error handling*/ + g_assert (is_ok (error)); /*FIXME proper error handling*/ event->remove = gevent->remove ? mono_class_inflate_generic_method_full_checked (gevent->remove, klass, context, error) : NULL; - g_assert (mono_error_ok (error)); /*FIXME proper error handling*/ + g_assert (is_ok (error)); /*FIXME proper error handling*/ event->raise = gevent->raise ? mono_class_inflate_generic_method_full_checked (gevent->raise, klass, context, error) : NULL; - g_assert (mono_error_ok (error)); /*FIXME proper error handling*/ + g_assert (is_ok (error)); /*FIXME proper error handling*/ #ifndef MONO_SMALL_CONFIG event->other = gevent->other ? inflate_method_listz (gevent->other, klass, context) : NULL; @@ -5390,7 +5390,7 @@ mono_class_setup_interfaces (MonoClass *klass, MonoError *error) MonoClass *gklass = mono_class_get_generic_class (klass)->container_class; mono_class_setup_interfaces (gklass, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_class_set_type_load_failure (klass, "Could not setup the interfaces"); return; } @@ -5399,7 +5399,7 @@ mono_class_setup_interfaces (MonoClass *klass, MonoError *error) interfaces = mono_class_new0 (klass, MonoClass *, interface_count); for (i = 0; i < interface_count; i++) { interfaces [i] = mono_class_inflate_generic_class_checked (gklass->interfaces [i], mono_generic_class_get_context (mono_class_get_generic_class (klass)), error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_class_set_type_load_failure (klass, "Could not setup the interfaces"); return; } @@ -5567,7 +5567,7 @@ mono_class_setup_nested_types (MonoClass *klass) guint32 cols [MONO_NESTED_CLASS_SIZE]; mono_metadata_decode_row (&klass->image->tables [MONO_TABLE_NESTEDCLASS], i - 1, cols, MONO_NESTED_CLASS_SIZE); nclass = mono_class_create_from_typedef (klass->image, MONO_TOKEN_TYPE_DEF | cols [MONO_NESTED_CLASS_NESTED], error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { /*FIXME don't swallow the error message*/ mono_error_cleanup (error); diff --git a/src/mono/mono/metadata/class.c b/src/mono/mono/metadata/class.c index 1252e71..b5a89fa 100644 --- a/src/mono/mono/metadata/class.c +++ b/src/mono/mono/metadata/class.c @@ -93,7 +93,7 @@ mono_class_from_typeref (MonoImage *image, guint32 type_token) { ERROR_DECL (error); MonoClass *klass = mono_class_from_typeref_checked (image, type_token, error); - g_assert (mono_error_ok (error)); /*FIXME proper error handling*/ + g_assert (is_ok (error)); /*FIXME proper error handling*/ return klass; } @@ -219,7 +219,7 @@ mono_class_from_typeref_checked (MonoImage *image, guint32 type_token, MonoError done: /* Generic case, should be avoided for when a better error is possible. */ - if (!res && mono_error_ok (error)) { + if (!res && is_ok (error)) { char *name = mono_class_name_from_token (image, type_token); char *assembly = mono_assembly_name_from_token (image, type_token); mono_error_set_type_load_name (error, name, assembly, "Could not resolve type with token %08x from typeref (expected class '%s' in assembly '%s')", type_token, name, assembly); @@ -743,7 +743,7 @@ inflate_generic_type (MonoImage *image, MonoType *type, MonoGenericContext *cont case MONO_TYPE_SZARRAY: { MonoClass *eclass = type->data.klass; MonoType *nt, *inflated = inflate_generic_type (NULL, m_class_get_byval_arg (eclass), context, error); - if ((!inflated && !changed) || !mono_error_ok (error)) + if ((!inflated && !changed) || !is_ok (error)) return NULL; if (!inflated) return type; @@ -755,7 +755,7 @@ inflate_generic_type (MonoImage *image, MonoType *type, MonoGenericContext *cont case MONO_TYPE_ARRAY: { MonoClass *eclass = type->data.array->eklass; MonoType *nt, *inflated = inflate_generic_type (NULL, m_class_get_byval_arg (eclass), context, error); - if ((!inflated && !changed) || !mono_error_ok (error)) + if ((!inflated && !changed) || !is_ok (error)) return NULL; if (!inflated) return type; @@ -827,7 +827,7 @@ inflate_generic_type (MonoImage *image, MonoType *type, MonoGenericContext *cont } case MONO_TYPE_PTR: { MonoType *nt, *inflated = inflate_generic_type (image, type->data.type, context, error); - if ((!inflated && !changed) || !mono_error_ok (error)) + if ((!inflated && !changed) || !is_ok (error)) return NULL; if (!inflated && changed) return type; @@ -1053,13 +1053,13 @@ inflate_generic_context (MonoGenericContext *context, MonoGenericContext *inflat if (context->class_inst) { class_inst = mono_metadata_inflate_generic_inst (context->class_inst, inflate_with, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) goto fail; } if (context->method_inst) { method_inst = mono_metadata_inflate_generic_inst (context->method_inst, inflate_with, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) goto fail; } @@ -1232,7 +1232,7 @@ mono_class_inflate_generic_method_full_checked (MonoMethod *method, MonoClass *k if (!result->klass) { MonoType *inflated = inflate_generic_type (NULL, m_class_get_byval_arg (method->klass), context, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) goto fail; result->klass = inflated ? mono_class_from_mono_type_internal (inflated) : method->klass; @@ -1416,7 +1416,7 @@ mono_class_find_enum_basetype (MonoClass *klass, MonoError *error) if (mono_class_is_ginst (klass)) { //FIXME do we leak here? ftype = mono_class_inflate_generic_type_checked (ftype, mono_class_get_context (klass), error); - if (!mono_error_ok (error)) + if (!is_ok (error)) goto fail; ftype->attrs = cols [MONO_FIELD_FLAGS]; } @@ -1548,7 +1548,7 @@ mono_class_get_method_by_index (MonoClass *klass, int index) m = mono_class_inflate_generic_method_full_checked ( m_class_get_methods (gklass->container_class) [index], klass, mono_class_get_context (klass), error); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + g_assert (is_ok (error)); /* FIXME don't swallow the error */ /* * If setup_methods () is called later for this class, no duplicates are created, * since inflate_generic_method guarantees that only one instance of a method @@ -1643,7 +1643,7 @@ mono_class_get_vtable_entry (MonoClass *klass, int offset) m = m_class_get_vtable (gklass) [offset]; m = mono_class_inflate_generic_method_full_checked (m, klass, mono_class_get_context (klass), error); - g_assert (mono_error_ok (error)); /* FIXME don't swallow this error */ + g_assert (is_ok (error)); /* FIXME don't swallow this error */ } else { mono_class_setup_vtable (klass); if (mono_class_has_failure (klass)) @@ -1712,7 +1712,7 @@ mono_class_get_implemented_interfaces (MonoClass *klass, MonoError *error) collect_implemented_interfaces_aux (klass, &res, &ifaces, error); if (ifaces) g_hash_table_destroy (ifaces); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { if (res) g_ptr_array_free (res, TRUE); return NULL; @@ -2081,7 +2081,7 @@ mono_type_retrieve_from_typespec (MonoImage *image, guint32 type_spec, MonoGener if (context && (context->class_inst || context->method_inst)) { MonoType *inflated = inflate_generic_type (NULL, t, context, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { return NULL; } @@ -2724,7 +2724,7 @@ mono_class_get_checked (MonoImage *image, guint32 type_token, MonoError *error) done: /* Generic case, should be avoided for when a better error is possible. */ - if (!klass && mono_error_ok (error)) { + if (!klass && is_ok (error)) { char *name = mono_class_name_from_token (image, type_token); char *assembly = mono_assembly_name_from_token (image, type_token); mono_error_set_type_load_name (error, name, assembly, "Could not resolve type with token %08x (expected class '%s' in assembly '%s')", type_token, name, assembly); @@ -3963,7 +3963,7 @@ mono_class_implement_interface_slow (MonoClass *target, MonoClass *candidate) A possible way to fix this would be to move that to setup_interfaces from setup_interface_offsets. */ mono_class_setup_interfaces (candidate, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_cleanup (error); return FALSE; } @@ -4880,7 +4880,7 @@ mono_class_get_interfaces (MonoClass* klass, gpointer *iter) mono_class_init_internal (klass); if (!m_class_is_interfaces_inited (klass)) { mono_class_setup_interfaces (klass, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_cleanup (error); return NULL; } @@ -5032,7 +5032,7 @@ mono_field_get_type_internal (MonoClassField *field) ERROR_DECL (error); type = mono_field_get_type_checked (field, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_trace_warning (MONO_TRACE_TYPE, "Could not load field's type due to %s", mono_error_get_message (error)); mono_error_cleanup (error); } @@ -6063,14 +6063,14 @@ mono_field_resolve_type (MonoClassField *field, MonoError *error) if (gtd) { MonoClassField *gfield = &m_class_get_fields (gtd) [field_idx]; MonoType *gtype = mono_field_get_type_checked (gfield, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { char *full_name = mono_type_get_full_name (gtd); mono_class_set_type_load_failure (klass, "Could not load generic type of field '%s:%s' (%d) due to: %s", full_name, gfield->name, field_idx, mono_error_get_message (error)); g_free (full_name); } ftype = mono_class_inflate_generic_type_no_copy (image, gtype, mono_class_get_context (klass), error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { char *full_name = mono_type_get_full_name (klass); mono_class_set_type_load_failure (klass, "Could not load instantiated type of field '%s:%s' (%d) due to: %s", full_name, field->name, field_idx, mono_error_get_message (error)); g_free (full_name); diff --git a/src/mono/mono/metadata/cominterop.c b/src/mono/mono/metadata/cominterop.c index daf4d5b..d88fc9a 100644 --- a/src/mono/mono/metadata/cominterop.c +++ b/src/mono/mono/metadata/cominterop.c @@ -594,7 +594,7 @@ cominterop_get_interface_checked (MonoComObjectHandle obj, MonoClass* ic, MonoEr if (hr < 0) { g_assert (!itf); cominterop_set_hr_error (error, hr); - g_assert (!mono_error_ok (error)); + g_assert (!is_ok (error)); return NULL; } diff --git a/src/mono/mono/metadata/custom-attrs.c b/src/mono/mono/metadata/custom-attrs.c index 8e61307..a0db2cd 100644 --- a/src/mono/mono/metadata/custom-attrs.c +++ b/src/mono/mono/metadata/custom-attrs.c @@ -1402,7 +1402,7 @@ reflection_resolve_custom_attribute_data (MonoReflectionMethod *ref_method, Mono leave: g_free (arginfo); - return mono_error_ok (error); + return is_ok (error); } void diff --git a/src/mono/mono/metadata/exception.c b/src/mono/mono/metadata/exception.c index 38fb928..48f96bf 100644 --- a/src/mono/mono/metadata/exception.c +++ b/src/mono/mono/metadata/exception.c @@ -1506,6 +1506,6 @@ mono_error_convert_to_exception_handle (MonoError *error) { //FIXMEcoop mono_error_convert_to_exception is raw pointer // The "optimization" here is important to significantly reduce handle usage. - return mono_error_ok (error) ? MONO_HANDLE_CAST (MonoException, NULL_HANDLE) + return is_ok (error) ? MONO_HANDLE_CAST (MonoException, NULL_HANDLE) : MONO_HANDLE_NEW (MonoException, mono_error_convert_to_exception (error)); } diff --git a/src/mono/mono/metadata/loader.c b/src/mono/mono/metadata/loader.c index 90cbc16..c8d20fa 100644 --- a/src/mono/mono/metadata/loader.c +++ b/src/mono/mono/metadata/loader.c @@ -405,11 +405,11 @@ find_method_in_class (MonoClass *klass, const char *name, const char *qname, con continue; method = mono_get_method_checked (klass_image, MONO_TOKEN_METHOD_DEF | (first_idx + i + 1), klass, NULL, error); - if (!mono_error_ok (error)) //bail out if we hit a loader error + if (!is_ok (error)) //bail out if we hit a loader error return NULL; if (method) { other_sig = mono_method_signature_checked (method, error); - if (!mono_error_ok (error)) //bail out if we hit a loader error + if (!is_ok (error)) //bail out if we hit a loader error return NULL; if (other_sig && (sig->call_convention != MONO_CALL_VARARG) && mono_metadata_signature_equal (sig, other_sig)) return method; @@ -445,7 +445,7 @@ find_method_in_class (MonoClass *klass, const char *name, const char *qname, con (name && !strcmp (m->name, name)))) continue; msig = mono_method_signature_checked (m, error); - if (!mono_error_ok (error)) //bail out if we hit a loader error + if (!is_ok (error)) //bail out if we hit a loader error return NULL; if (!msig) @@ -492,7 +492,7 @@ find_method (MonoClass *in_class, MonoClass *ic, const char* name, MonoMethodSig while (in_class) { g_assert (from_class); result = find_method_in_class (in_class, name, qname, fqname, sig, from_class, error); - if (result || !mono_error_ok (error)) + if (result || !is_ok (error)) goto out; if (name [0] == '.' && (!strcmp (name, ".ctor") || !strcmp (name, ".cctor"))) @@ -528,7 +528,7 @@ find_method (MonoClass *in_class, MonoClass *ic, const char* name, MonoMethodSig g_free (ic_class_name); g_free (ic_fqname); g_free (ic_qname); - if (result || !mono_error_ok (error)) + if (result || !is_ok (error)) goto out; } @@ -541,7 +541,7 @@ find_method (MonoClass *in_class, MonoClass *ic, const char* name, MonoMethodSig result = find_method_in_class (mono_defaults.object_class, name, qname, fqname, sig, mono_defaults.object_class, error); //we did not find the method - if (!result && mono_error_ok (error)) + if (!result && is_ok (error)) mono_error_set_method_missing (error, initial_class, name, sig, NULL); out: @@ -566,12 +566,12 @@ inflate_generic_signature_checked (MonoImage *image, MonoMethodSignature *sig, M res->param_count = sig->param_count; res->sentinelpos = -1; res->ret = mono_class_inflate_generic_type_checked (sig->ret, context, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) goto fail; is_open = mono_class_is_open_constructed_type (res->ret); for (i = 0; i < sig->param_count; ++i) { res->params [i] = mono_class_inflate_generic_type_checked (sig->params [i], context, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) goto fail; if (!is_open) @@ -609,7 +609,7 @@ mono_inflate_generic_signature (MonoMethodSignature *sig, MonoGenericContext *co MonoMethodSignature *res, *cached; res = inflate_generic_signature_checked (NULL, sig, context, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) return NULL; cached = mono_metadata_get_inflated_signature (res, context); if (cached != res) @@ -738,7 +738,7 @@ mono_method_get_signature_checked (MonoMethod *method, MonoImage *image, guint32 /* This signature is not owned by a MonoMethod, so need to cache */ sig = inflate_generic_signature_checked (image, sig, context, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) return NULL; cached = mono_metadata_get_inflated_signature (sig, context); @@ -749,7 +749,7 @@ mono_method_get_signature_checked (MonoMethod *method, MonoImage *image, guint32 sig = cached; } - g_assert (mono_error_ok (error)); + g_assert (is_ok (error)); return sig; } @@ -893,13 +893,13 @@ method_from_memberref (MonoImage *image, guint32 idx, MonoGenericContext *typesp goto fail; } - if (!method && mono_error_ok (error)) + if (!method && is_ok (error)) mono_error_set_method_missing (error, klass, mname, sig, "Failed to load due to unknown reasons"); return method; fail: - g_assert (!mono_error_ok (error)); + g_assert (!is_ok (error)); return NULL; } @@ -936,7 +936,7 @@ method_from_methodspec (MonoImage *image, MonoGenericContext *context, guint32 i if (context && inst->is_open) { inst = mono_metadata_inflate_generic_inst (inst, context, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) return NULL; } @@ -2696,7 +2696,7 @@ mono_method_signature_checked (MonoMethod *m, MonoError *error) /* the lock is recursive */ signature = mono_method_signature_internal (imethod->declaring); signature = inflate_generic_signature_checked (m_class_get_image (imethod->declaring->klass), signature, mono_method_get_context (m), error); - if (!mono_error_ok (error)) + if (!is_ok (error)) return NULL; mono_atomic_fetch_add_i32 (&inflated_signatures_size, mono_metadata_signature_size (signature)); diff --git a/src/mono/mono/metadata/marshal-ilgen.c b/src/mono/mono/metadata/marshal-ilgen.c index 468a690..ef14b70 100644 --- a/src/mono/mono/metadata/marshal-ilgen.c +++ b/src/mono/mono/metadata/marshal-ilgen.c @@ -4010,7 +4010,7 @@ emit_delegate_invoke_internal_ilgen (MonoMethodBuilder *mb, MonoMethodSignature } else { ERROR_DECL (error); mono_mb_emit_op (mb, CEE_CALLVIRT, mono_class_inflate_generic_method_checked (method, &container->context, error)); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + g_assert (is_ok (error)); /* FIXME don't swallow the error */ } if (!void_ret) mono_mb_emit_stloc (mb, local_res); @@ -4105,7 +4105,7 @@ emit_synchronized_wrapper_ilgen (MonoMethodBuilder *mb, MonoMethod *method, Mono if (ctx) { ERROR_DECL (error); mono_mb_emit_managed_call (mb, mono_class_inflate_generic_method_checked (method, &container->context, error), NULL); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + g_assert (is_ok (error)); /* FIXME don't swallow the error */ } else { mono_mb_emit_managed_call (mb, method, NULL); } @@ -4163,7 +4163,7 @@ emit_array_accessor_wrapper_ilgen (MonoMethodBuilder *mb, MonoMethod *method, Mo if (ctx) { ERROR_DECL (error); mono_mb_emit_managed_call (mb, mono_class_inflate_generic_method_checked (method, &container->context, error), NULL); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + g_assert (is_ok (error)); /* FIXME don't swallow the error */ } else { mono_mb_emit_managed_call (mb, method, NULL); } diff --git a/src/mono/mono/metadata/marshal.c b/src/mono/mono/metadata/marshal.c index f2ea549..ae80fff 100644 --- a/src/mono/mono/metadata/marshal.c +++ b/src/mono/mono/metadata/marshal.c @@ -431,7 +431,7 @@ parse_unmanaged_function_pointer_attr (MonoClass *klass, MonoMethodPInvoke *piin * construct it. */ cinfo = mono_custom_attrs_from_class_checked (klass, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { g_warning ("Could not load UnmanagedFunctionPointerAttribute due to %s", mono_error_get_message (error)); mono_error_cleanup (error); } @@ -440,7 +440,7 @@ parse_unmanaged_function_pointer_attr (MonoClass *klass, MonoMethodPInvoke *piin if (attr) { piinfo->piflags = (attr->call_conv << 8) | (attr->charset ? (attr->charset - 1) * 2 : 1) | attr->set_last_error; } else { - if (!mono_error_ok (error)) { + if (!is_ok (error)) { g_warning ("Could not load UnmanagedFunctionPointerAttribute due to %s", mono_error_get_message (error)); mono_error_cleanup (error); } @@ -1219,7 +1219,7 @@ mono_delegate_begin_invoke (MonoDelegate *delegate, gpointer *params) exc = NULL; mono_remoting_invoke ((MonoObject *)tp->rp, msg, &exc, &out_args, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_set_pending_exception (error); return NULL; } @@ -1551,7 +1551,7 @@ mono_marshal_method_from_wrapper (MonoMethod *wrapper) * contains an uninflated method. */ result = mono_class_inflate_generic_method_checked (m, mono_method_get_context (wrapper), error); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + g_assert (is_ok (error)); /* FIXME don't swallow the error */ return result; } return m; @@ -1561,7 +1561,7 @@ mono_marshal_method_from_wrapper (MonoMethod *wrapper) ERROR_DECL (error); MonoMethod *result; result = mono_class_inflate_generic_method_checked (m, mono_method_get_context (wrapper), error); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + g_assert (is_ok (error)); /* FIXME don't swallow the error */ return result; } return m; @@ -1656,7 +1656,7 @@ get_wrapper_target_class (MonoImage *image) klass = ((MonoDynamicImage*)image)->wrappers_type; } else { klass = mono_class_get_checked (image, mono_metadata_make_token (MONO_TABLE_TYPEDEF, 1), error); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + g_assert (is_ok (error)); /* FIXME don't swallow the error */ } g_assert (klass); @@ -1699,7 +1699,7 @@ check_generic_wrapper_cache (GHashTable *cache, MonoMethod *orig_method, gpointe if (def) { ERROR_DECL (error); inst = mono_class_inflate_generic_method_checked (def, ctx, error); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + g_assert (is_ok (error)); /* FIXME don't swallow the error */ /* Cache it */ mono_memory_barrier (); mono_marshal_lock (); @@ -1724,7 +1724,7 @@ cache_generic_wrapper (GHashTable *cache, MonoMethod *orig_method, MonoMethod *d * We use the same cache for the generic definition and the instances. */ inst = mono_class_inflate_generic_method_checked (def, ctx, error); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + g_assert (is_ok (error)); /* FIXME don't swallow the error */ mono_memory_barrier (); mono_marshal_lock (); res = (MonoMethod *)g_hash_table_lookup (cache, key); @@ -1756,7 +1756,7 @@ check_generic_delegate_wrapper_cache (GHashTable *cache, MonoMethod *orig_method def = mono_marshal_find_in_cache (cache, def_method->klass); if (def) { inst = mono_class_inflate_generic_method_checked (def, ctx, error); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + g_assert (is_ok (error)); /* FIXME don't swallow the error */ /* Cache it */ mono_memory_barrier (); @@ -1783,7 +1783,7 @@ cache_generic_delegate_wrapper (GHashTable *cache, MonoMethod *orig_method, Mono * We use the same cache for the generic definition and the instances. */ inst = mono_class_inflate_generic_method_checked (def, ctx, error); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + g_assert (is_ok (error)); /* FIXME don't swallow the error */ ginfo = mono_marshal_get_wrapper_info (def); if (ginfo) { @@ -1902,7 +1902,7 @@ mono_delegate_end_invoke (MonoDelegate *delegate, gpointer *params) if (!delegate->method_info) { g_assert (delegate->method); MonoReflectionMethod *rm = mono_method_get_object_checked (domain, delegate->method, NULL, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_set_pending_exception (error); return NULL; } @@ -1942,7 +1942,7 @@ mono_delegate_end_invoke (MonoDelegate *delegate, gpointer *params) if (delegate->target && mono_object_is_transparent_proxy (delegate->target)) { MonoTransparentProxy* tp = (MonoTransparentProxy *)delegate->target; msg = (MonoMethodMessage *)mono_object_new_checked (domain, mono_defaults.mono_method_message_class, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_set_pending_exception (error); return NULL; } @@ -1952,7 +1952,7 @@ mono_delegate_end_invoke (MonoDelegate *delegate, gpointer *params) msg->call_type = CallType_EndInvoke; MONO_OBJECT_SETREF_INTERNAL (msg, async_result, ares); res = mono_remoting_invoke ((MonoObject *)tp->rp, msg, &exc, &out_args, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_set_pending_exception (error); return NULL; } @@ -3879,7 +3879,7 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass, mono_reflection_create_custom_attr_data_args_noalloc (mono_defaults.corlib, attr->ctor, attr->data, attr->data_size, &typed_args, &named_args, &num_named_args, &arginfo, error); - g_assert (mono_error_ok (error)); + g_assert (is_ok (error)); /* typed args */ call_conv = *(gint32*)typed_args [0]; @@ -4297,7 +4297,7 @@ mono_marshal_get_synchronized_inner_wrapper (MonoMethod *method) if (ctx) { ERROR_DECL (error); res = mono_class_inflate_generic_method_checked (res, ctx, error); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + g_assert (is_ok (error)); /* FIXME don't swallow the error */ } return res; } @@ -6122,7 +6122,7 @@ mono_marshal_free_asany_impl (MonoObjectHandle o, gpointer ptr, MonoMarshalNativ pa [1] = MONO_HANDLE_RAW (o); mono_runtime_invoke_checked (method, NULL, pa, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) return; } diff --git a/src/mono/mono/metadata/metadata-verify.c b/src/mono/mono/metadata/metadata-verify.c index 33fd435..eaa22e1 100644 --- a/src/mono/mono/metadata/metadata-verify.c +++ b/src/mono/mono/metadata/metadata-verify.c @@ -310,7 +310,7 @@ dword_align (const char *ptr) static void add_from_mono_error (VerifyContext *ctx, MonoError *error) { - if (mono_error_ok (error)) + if (is_ok (error)) return; ADD_ERROR (ctx, g_strdup (mono_error_get_message (error))); @@ -1975,7 +1975,7 @@ is_valid_cattr_content (VerifyContext *ctx, MonoMethod *ctor, const char *ptr, g FAIL (ctx, g_strdup ("CustomAttribute: Invalid constructor")); sig = mono_method_signature_checked (ctor, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { ADD_ERROR_NO_RETURN (ctx, g_strdup_printf ("CustomAttribute: Invalid constructor signature %s", mono_error_get_message (error))); mono_error_cleanup (error); return FALSE; diff --git a/src/mono/mono/metadata/metadata.c b/src/mono/mono/metadata/metadata.c index 9f0c689..f5edea7 100644 --- a/src/mono/mono/metadata/metadata.c +++ b/src/mono/mono/metadata/metadata.c @@ -3550,7 +3550,7 @@ mono_metadata_inflate_generic_inst (MonoGenericInst *ginst, MonoGenericContext * for (i = 0; i < ginst->type_argc; i++) { type_argv [i] = mono_class_inflate_generic_type_checked (ginst->type_argv [i], context, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) goto cleanup; ++count; } diff --git a/src/mono/mono/metadata/mono-basic-block.c b/src/mono/mono/metadata/mono-basic-block.c index a19d445..6dd0a67 100644 --- a/src/mono/mono/metadata/mono-basic-block.c +++ b/src/mono/mono/metadata/mono-basic-block.c @@ -543,11 +543,11 @@ mono_basic_block_split (MonoMethod *method, MonoError *error, MonoMethodHeader * root = bb; bb_formation_il_pass (start, end, bb, &root, method, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) goto fail; bb_formation_eh_pass (header, bb, &root, method, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) goto fail; bb_liveness (bb); diff --git a/src/mono/mono/metadata/object.c b/src/mono/mono/metadata/object.c index d29c0ed..846a955 100644 --- a/src/mono/mono/metadata/object.c +++ b/src/mono/mono/metadata/object.c @@ -547,7 +547,7 @@ mono_runtime_class_init_full (MonoVTable *vtable, MonoError *error) mono_threads_end_abort_protected_block (); //exception extracted, error will be set to the right value later - if (exc == NULL && !mono_error_ok (error))//invoking failed but exc was not set + if (exc == NULL && !is_ok (error))//invoking failed but exc was not set exc = mono_error_convert_to_exception (error); else mono_error_cleanup (error); @@ -3018,7 +3018,7 @@ do_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObject **ex MONO_PROFILER_RAISE (method_end_invoke, (method)); - if (!mono_error_ok (error)) + if (!is_ok (error)) return NULL; return result; @@ -3064,7 +3064,7 @@ mono_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObject ** ERROR_DECL (error); if (exc) { res = mono_runtime_try_invoke (method, obj, params, exc, error); - if (*exc == NULL && !mono_error_ok(error)) { + if (*exc == NULL && !is_ok(error)) { *exc = (MonoObject*) mono_error_convert_to_exception (error); } else mono_error_cleanup (error); @@ -3907,7 +3907,7 @@ mono_property_set_value (MonoProperty *prop, void *obj, void **params, MonoObjec ERROR_DECL (error); do_runtime_invoke (prop->set, obj, params, exc, error); - if (exc && *exc == NULL && !mono_error_ok (error)) { + if (exc && *exc == NULL && !is_ok (error)) { *exc = (MonoObject*) mono_error_convert_to_exception (error); } else { mono_error_cleanup (error); @@ -3964,7 +3964,7 @@ mono_property_get_value (MonoProperty *prop, void *obj, void **params, MonoObjec ERROR_DECL (error); val = do_runtime_invoke (prop->get, obj, params, exc, error); - if (exc && *exc == NULL && !mono_error_ok (error)) { + if (exc && *exc == NULL && !is_ok (error)) { *exc = (MonoObject*) mono_error_convert_to_exception (error); } else { mono_error_cleanup (error); /* FIXME don't raise here */ @@ -5152,7 +5152,7 @@ do_try_exec_main (MonoMethod *method, MonoArray *args, MonoObject **exc) ERROR_DECL (inner_error); MonoObject *res; res = mono_runtime_try_invoke (method, NULL, pa, exc, inner_error); - if (*exc == NULL && !mono_error_ok (inner_error)) + if (*exc == NULL && !is_ok (inner_error)) *exc = (MonoObject*) mono_error_convert_to_exception (inner_error); else mono_error_cleanup (inner_error); @@ -5166,7 +5166,7 @@ do_try_exec_main (MonoMethod *method, MonoArray *args, MonoObject **exc) } else { ERROR_DECL (inner_error); mono_runtime_try_invoke (method, NULL, pa, exc, inner_error); - if (*exc == NULL && !mono_error_ok (inner_error)) + if (*exc == NULL && !is_ok (inner_error)) *exc = (MonoObject*) mono_error_convert_to_exception (inner_error); else mono_error_cleanup (inner_error); @@ -5841,11 +5841,11 @@ mono_object_new_specific_checked (MonoVTable *vtable, MonoError *error) } pa [0] = mono_type_get_object_checked (mono_domain_get (), m_class_get_byval_arg (vtable->klass), error); - if (!mono_error_ok (error)) + if (!is_ok (error)) return NULL; o = mono_runtime_invoke_checked (im, NULL, pa, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) return NULL; if (o != NULL) @@ -7952,7 +7952,7 @@ mono_string_to_utf8_internal (MonoMemPool *mp, MonoImage *image, MonoString *s, int len; r = mono_string_to_utf8_checked_internal (s, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) return NULL; if (!mp && !image) @@ -8472,7 +8472,7 @@ mono_object_to_string (MonoObject *obj, MonoObject **exc) MonoMethod *method = prepare_to_string_method (obj, &target); if (exc) { s = (MonoString *) mono_runtime_try_invoke (method, target, NULL, exc, error); - if (*exc == NULL && !mono_error_ok (error)) + if (*exc == NULL && !is_ok (error)) *exc = (MonoObject*) mono_error_convert_to_exception (error); else mono_error_cleanup (error); @@ -8559,7 +8559,7 @@ mono_print_unhandled_exception_internal (MonoObject *exc) free_message = TRUE; } else if (str) { message = mono_string_to_utf8_checked_internal (str, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_cleanup (error); message = (char *) ""; } else { diff --git a/src/mono/mono/metadata/reflection.c b/src/mono/mono/metadata/reflection.c index 1b3955a..f44f0d6 100644 --- a/src/mono/mono/metadata/reflection.c +++ b/src/mono/mono/metadata/reflection.c @@ -520,7 +520,7 @@ mono_type_get_object_checked (MonoDomain *domain, MonoType *type, MonoError *err norm_type = mono_type_normalize (type); if (norm_type != type) { res = mono_type_get_object_checked (domain, norm_type, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_domain_unlock (domain); mono_loader_unlock (); return NULL; @@ -561,7 +561,7 @@ mono_type_get_object_checked (MonoDomain *domain, MonoType *type, MonoError *err } /* This is stored in vtables/JITted code so it has to be pinned */ res = (MonoReflectionType *)mono_object_new_pinned (domain, mono_defaults.runtimetype_class, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_domain_unlock (domain); mono_loader_unlock (); return NULL; diff --git a/src/mono/mono/metadata/security-core-clr.c b/src/mono/mono/metadata/security-core-clr.c index 3993880..582a3fc 100644 --- a/src/mono/mono/metadata/security-core-clr.c +++ b/src/mono/mono/metadata/security-core-clr.c @@ -523,7 +523,7 @@ check_field_access (MonoMethod *caller, MonoClassField *field) /* this check can occur before the field's type is resolved (and that can fail) */ mono_field_get_type_checked (field, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_cleanup (error); return FALSE; } diff --git a/src/mono/mono/metadata/sre-encode.c b/src/mono/mono/metadata/sre-encode.c index 97868a4..86e2c29 100644 --- a/src/mono/mono/metadata/sre-encode.c +++ b/src/mono/mono/metadata/sre-encode.c @@ -695,7 +695,7 @@ mono_dynimage_encode_fieldref_signature (MonoDynamicImage *assembly, MonoImage * if (field_image) { ERROR_DECL (error); MonoClass *klass = mono_class_get_checked (field_image, cmods->modifiers [i].token, error); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + g_assert (is_ok (error)); /* FIXME don't swallow the error */ token = mono_image_typedef_or_ref (assembly, m_class_get_byval_arg (klass)); } else { diff --git a/src/mono/mono/metadata/sre-save.c b/src/mono/mono/metadata/sre-save.c index 1da61c6..f2371b5 100644 --- a/src/mono/mono/metadata/sre-save.c +++ b/src/mono/mono/metadata/sre-save.c @@ -232,7 +232,7 @@ mono_image_add_cattrs (MonoDynamicImage *assembly, guint32 idx, guint32 type, Mo token = mono_image_get_methodref_token (assembly, method, FALSE); } else { token = image_create_token_raw (assembly, (MonoObject*)cattr->ctor, FALSE, FALSE, error); /* FIXME use handles */ - if (!mono_error_ok (error)) goto fail; + if (!is_ok (error)) goto fail; } type = mono_metadata_token_index (token); type <<= MONO_CUSTOM_ATTR_TYPE_BITS; @@ -1305,7 +1305,7 @@ mono_image_fill_export_table_from_module (MonoDomain *domain, MonoReflectionModu for (i = 0; i < t->rows; ++i) { ERROR_DECL (error); MonoClass *klass = mono_class_get_checked (image, mono_metadata_make_token (MONO_TABLE_TYPEDEF, i + 1), error); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + g_assert (is_ok (error)); /* FIXME don't swallow the error */ if (mono_class_is_public (klass)) mono_image_fill_export_table_from_class (domain, klass, module_index, 0, assembly); @@ -2480,7 +2480,7 @@ leave_types: mono_ptr_array_destroy (types); leave: - return mono_error_ok (error); + return is_ok (error); } #else /* DISABLE_REFLECTION_EMIT_SAVE */ diff --git a/src/mono/mono/metadata/sre.c b/src/mono/mono/metadata/sre.c index 0604674..46e07db 100644 --- a/src/mono/mono/metadata/sre.c +++ b/src/mono/mono/metadata/sre.c @@ -1120,7 +1120,7 @@ mono_image_create_method_token (MonoDynamicImage *assembly, MonoObjectHandle obj mono_dynamic_image_register_token (assembly, token, obj, MONO_DYN_IMAGE_TOK_NEW); return token; fail: - g_assert (!mono_error_ok (error)); + g_assert (!is_ok (error)); return 0; } @@ -3300,7 +3300,7 @@ fix_partial_generic_class (MonoClass *klass, MonoError *error) if (klass->parent != gklass->parent) { MonoType *parent_type = mono_class_inflate_generic_type_checked (m_class_get_byval_arg (m_class_get_parent (gklass)), &mono_class_get_generic_class (klass)->context, error); - if (mono_error_ok (error)) { + if (is_ok (error)) { MonoClass *parent = mono_class_from_mono_type_internal (parent_type); mono_metadata_free_type (parent_type); if (parent != klass->parent) { @@ -3728,7 +3728,7 @@ typebuilder_setup_properties (MonoClass *klass, MonoError *error) properties [i].parent = klass; properties [i].attrs = pb->attrs; properties [i].name = string_to_utf8_image_raw (image, pb->name, error); /* FIXME use handles */ - if (!mono_error_ok (error)) + if (!is_ok (error)) return; if (pb->get_method) properties [i].get = pb->get_method->mhandle; @@ -3779,7 +3779,7 @@ typebuilder_setup_events (MonoClass *klass, MonoError *error) events [i].parent = klass; events [i].attrs = eb->attrs; events [i].name = string_to_utf8_image_raw (image, eb->name, error); /* FIXME use handles */ - if (!mono_error_ok (error)) + if (!is_ok (error)) return; if (eb->add_method) events [i].add = eb->add_method->mhandle; diff --git a/src/mono/mono/metadata/threadpool.c b/src/mono/mono/metadata/threadpool.c index 1a24a64..acbd6ce 100644 --- a/src/mono/mono/metadata/threadpool.c +++ b/src/mono/mono/metadata/threadpool.c @@ -366,7 +366,7 @@ worker_callback (void) MonoObject *exc = NULL, *res; res = try_invoke_perform_wait_callback (&exc, error); - if (exc || !mono_error_ok(error)) { + if (exc || !is_ok(error)) { if (exc == NULL) exc = (MonoObject *) mono_error_convert_to_exception (error); else diff --git a/src/mono/mono/metadata/threads.c b/src/mono/mono/metadata/threads.c index aa616d7..dc0233b 100644 --- a/src/mono/mono/metadata/threads.c +++ b/src/mono/mono/metadata/threads.c @@ -1242,7 +1242,7 @@ start_wrapper_internal (StartInfo *start_info, gsize *stack_ptr) mono_runtime_delegate_invoke_checked (start_delegate, args, error); #endif - if (!mono_error_ok (error)) { + if (!is_ok (error)) { MonoException *ex = mono_error_convert_to_exception (error); g_assert (ex != NULL); diff --git a/src/mono/mono/metadata/verify.c b/src/mono/mono/metadata/verify.c index 4e5bbc8..c000f4d 100644 --- a/src/mono/mono/metadata/verify.c +++ b/src/mono/mono/metadata/verify.c @@ -163,7 +163,7 @@ is_valid_generic_instantiation (MonoGenericContainer *gc, MonoGenericContext *co MonoType *inflated; inflated = mono_class_inflate_generic_type_checked (m_class_get_byval_arg (ctr), context, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_cleanup (error); return FALSE; } @@ -650,7 +650,7 @@ verifier_inflate_type (VerifyContext *ctx, MonoType *type, MonoGenericContext *c MonoType *result; result = mono_class_inflate_generic_type_checked (type, context, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_cleanup (error); return NULL; } @@ -2105,7 +2105,7 @@ init_stack_with_value_at_exception_boundary (VerifyContext *ctx, ILCodeDesc *cod ERROR_DECL (error); MonoType *type = mono_class_inflate_generic_type_checked (m_class_get_byval_arg (klass), ctx->generic_context, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { char *name = mono_type_get_full_name (klass); ADD_VERIFY_ERROR (ctx, g_strdup_printf ("Invalid class %s used for exception", name)); g_free (name); @@ -2208,7 +2208,7 @@ verifier_class_is_assignable_from (MonoClass *target, MonoClass *candidate) int i; while (candidate && candidate != mono_defaults.object_class) { mono_class_setup_interfaces (candidate, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_cleanup (error); return FALSE; } @@ -4743,13 +4743,13 @@ merge_stacks (VerifyContext *ctx, ILCodeDesc *from, ILCodeDesc *to, gboolean sta } mono_class_setup_interfaces (old_class, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("Cannot merge stacks due to a TypeLoadException %s at 0x%04x", mono_error_get_message (error), ctx->ip_offset)); mono_error_cleanup (error); goto end_verify; } mono_class_setup_interfaces (new_class, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("Cannot merge stacks due to a TypeLoadException %s at 0x%04x", mono_error_get_message (error), ctx->ip_offset)); mono_error_cleanup (error); goto end_verify; @@ -5027,7 +5027,7 @@ mono_method_verify (MonoMethod *method, int level) for (i = 0; i < ctx.num_locals; ++i) { MonoType *uninflated = ctx.locals [i]; ctx.locals [i] = mono_class_inflate_generic_type_checked (ctx.locals [i], ctx.generic_context, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { char *name = mono_type_full_name (ctx.locals [i] ? ctx.locals [i] : uninflated); ADD_VERIFY_ERROR (&ctx, g_strdup_printf ("Invalid local %d of type %s", i, name)); g_free (name); @@ -5041,7 +5041,7 @@ mono_method_verify (MonoMethod *method, int level) for (i = 0; i < ctx.max_args; ++i) { MonoType *uninflated = ctx.params [i]; ctx.params [i] = mono_class_inflate_generic_type_checked (ctx.params [i], ctx.generic_context, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { char *name = mono_type_full_name (ctx.params [i] ? ctx.params [i] : uninflated); ADD_VERIFY_ERROR (&ctx, g_strdup_printf ("Invalid parameter %d of type %s", i, name)); g_free (name); @@ -5139,7 +5139,7 @@ mono_method_verify (MonoMethod *method, int level) goto cleanup; original_bb = bb = mono_basic_block_split (method, error, ctx.header); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { ADD_VERIFY_ERROR (&ctx, g_strdup_printf ("Invalid branch target: %s", mono_error_get_message (error))); mono_error_cleanup (error); goto cleanup; diff --git a/src/mono/mono/mini/aot-compiler.c b/src/mono/mono/mini/aot-compiler.c index 0fe5b44..c4bdb6b 100644 --- a/src/mono/mono/mini/aot-compiler.c +++ b/src/mono/mono/mini/aot-compiler.c @@ -497,7 +497,7 @@ report_loader_error (MonoAotCompile *acfg, MonoError *error, gboolean fatal, con FILE *output; va_list args; - if (mono_error_ok (error)) + if (is_ok (error)) return; if (acfg->logfile) @@ -4616,7 +4616,7 @@ add_wrappers (MonoAotCompile *acfg) token = MONO_TOKEN_METHOD_DEF | (i + 1); method = mono_get_method_checked (acfg->image, token, NULL, NULL, error); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + g_assert (is_ok (error)); /* FIXME don't swallow the error */ sig = mono_method_signature_internal (method); @@ -4700,7 +4700,7 @@ add_wrappers (MonoAotCompile *acfg) create_gsharedvt_inst (acfg, method, &ctx); inst = mono_class_inflate_generic_method_checked (method, &ctx, error); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + g_assert (is_ok (error)); /* FIXME don't swallow the error */ m = mono_marshal_get_delegate_invoke (inst, NULL); g_assert (m->is_inflated); @@ -4716,7 +4716,7 @@ add_wrappers (MonoAotCompile *acfg) create_gsharedvt_inst (acfg, method, &ctx); inst = mono_class_inflate_generic_method_checked (method, &ctx, error); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + g_assert (is_ok (error)); /* FIXME don't swallow the error */ m = mono_marshal_get_delegate_begin_invoke (inst); g_assert (m->is_inflated); @@ -4733,7 +4733,7 @@ add_wrappers (MonoAotCompile *acfg) create_gsharedvt_inst (acfg, method, &ctx); inst = mono_class_inflate_generic_method_checked (method, &ctx, error); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + g_assert (is_ok (error)); /* FIXME don't swallow the error */ m = mono_marshal_get_delegate_end_invoke (inst); g_assert (m->is_inflated); @@ -4800,7 +4800,7 @@ add_wrappers (MonoAotCompile *acfg) */ create_gsharedvt_inst (acfg, method, &ctx); inst = mono_class_inflate_generic_method_checked (method, &ctx, error); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + g_assert (is_ok (error)); /* FIXME don't swallow the error */ m = mono_marshal_get_synchronized_wrapper (inst); g_assert (m->is_inflated); gshared = mini_get_shared_method_full (m, SHARE_MODE_GSHAREDVT, error); @@ -5507,7 +5507,7 @@ add_generic_instances (MonoAotCompile *acfg) declaring_method = mono_method_get_declaring_generic_method (method); method = mono_class_inflate_generic_method_checked (declaring_method, &shared_context, error); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + g_assert (is_ok (error)); /* FIXME don't swallow the error */ } /* @@ -5664,7 +5664,7 @@ add_generic_instances (MonoAotCompile *acfg) args [0] = object_type; ctx.method_inst = mono_metadata_get_generic_inst (1, args); add_extra_method (acfg, mono_marshal_get_native_wrapper (mono_class_inflate_generic_method_checked (m, &ctx, error), TRUE, TRUE)); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + g_assert (is_ok (error)); /* FIXME don't swallow the error */ } } } @@ -5704,7 +5704,7 @@ decode_direct_icall_symbol_name_attribute (MonoMethod *method) char *symbol_name = NULL; MonoCustomAttrInfo *cattr = mono_custom_attrs_from_method_checked (method, error); - if (mono_error_ok(error) && cattr) { + if (is_ok(error) && cattr) { for (j = 0; j < cattr->num_attrs; j++) if (cattr->attrs [j].ctor && !strcmp (m_class_get_name (cattr->attrs [j].ctor->klass), "MonoDirectICallSymbolNameAttribute")) break; @@ -10210,7 +10210,7 @@ mono_aot_get_array_helper_from_wrapper (MonoMethod *method) args [0] = m_class_get_byval_arg (m_class_get_element_class (method->klass)); ctx.method_inst = mono_metadata_get_generic_inst (1, args); m = mono_class_inflate_generic_method_checked (m, &ctx, error); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + g_assert (is_ok (error)); /* FIXME don't swallow the error */ } return m; diff --git a/src/mono/mono/mini/aot-runtime.c b/src/mono/mono/mini/aot-runtime.c index a76b5de..7c2bf4e 100644 --- a/src/mono/mono/mini/aot-runtime.c +++ b/src/mono/mono/mini/aot-runtime.c @@ -1295,7 +1295,7 @@ decode_method_ref_with_target (MonoAotModule *module, MethodRef *ref, MonoMethod if (!klass) return FALSE; ref->method = mono_marshal_get_managed_wrapper (m, klass, 0, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) return FALSE; break; } @@ -2728,7 +2728,7 @@ mono_aot_get_class_from_name (MonoImage *image, const char *name_space, const ch ERROR_DECL (error); amodule_unlock (amodule); *klass = mono_class_get_checked (image, token, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) mono_error_cleanup (error); /* FIXME don't swallow the error */ /* Add to cache */ @@ -4583,7 +4583,7 @@ init_method (MonoAotModule *amodule, guint32 method_index, MonoMethod *method, M if (mono_llvm_only && ji->type == MONO_PATCH_INFO_METHOD && mono_method_check_context_used (ji->data.method)) { g_assert (context); ji->data.method = mono_class_inflate_generic_method_checked (ji->data.method, context, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { g_free (got_slots); mono_mempool_destroy (mp); return FALSE; @@ -4597,7 +4597,7 @@ init_method (MonoAotModule *amodule, guint32 method_index, MonoMethod *method, M ji->data.target = jinfo; } addr = mono_resolve_patch_target (method, domain, code, ji, TRUE, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { g_free (got_slots); mono_mempool_destroy (mp); return FALSE; @@ -5099,14 +5099,14 @@ mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code if (mono_aot_only && ji.type == MONO_PATCH_INFO_METHOD && !ji.data.method->is_generic && !mono_method_check_context_used (ji.data.method) && !(ji.data.method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED) && !mono_method_needs_static_rgctx_invoke (ji.data.method, FALSE) && !using_gsharedvt) { target = (guint8 *)mono_jit_compile_method (ji.data.method, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_mempool_destroy (mp); return NULL; } no_ftnptr = TRUE; } else { target = (guint8 *)mono_resolve_patch_target (NULL, mono_domain_get (), NULL, &ji, TRUE, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_mempool_destroy (mp); return NULL; } diff --git a/src/mono/mono/mini/debugger-agent.c b/src/mono/mono/mini/debugger-agent.c index 47bcde4..4c62823 100644 --- a/src/mono/mono/mini/debugger-agent.c +++ b/src/mono/mono/mini/debugger-agent.c @@ -6449,7 +6449,7 @@ do_invoke_method (DebuggerTlsData *tls, Buffer *buf, InvokeData *invoke, guint8 mono_stopwatch_start (&watch); res = mono_runtime_try_invoke (m, m_class_is_valuetype (m->klass) ? (gpointer) this_buf : (gpointer) this_arg, args, &exc, error); - if (!mono_error_ok (error) && exc == NULL) { + if (!is_ok (error) && exc == NULL) { exc = (MonoObject*) mono_error_convert_to_exception (error); } else { mono_error_cleanup (error); /* FIXME report error */ @@ -7289,7 +7289,7 @@ event_commands (int command, guint8 *p, guint8 *end, Buffer *buf) g_assert (method); req->info = mono_de_set_breakpoint (method, location, req, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { g_free (req); DEBUG_PRINTF (1, "[dbg] Failed to set breakpoint: %s\n", mono_error_get_message (error)); mono_error_cleanup (error); @@ -7807,7 +7807,7 @@ buffer_add_cattrs (Buffer *buf, MonoDomain *domain, MonoImage *image, MonoClass ERROR_DECL (error); mono_reflection_create_custom_attr_data_args (image, attr->ctor, attr->data, attr->data_size, &typed_args, &named_args, &arginfo, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { DEBUG_PRINTF (2, "[dbg] mono_reflection_create_custom_attr_data_args () failed with: '%s'\n", mono_error_get_message (error)); mono_error_cleanup (error); return ERR_LOADER_ERROR; @@ -7866,7 +7866,7 @@ collect_interfaces (MonoClass *klass, GHashTable *ifaces, MonoError *error) MonoClass *ic; mono_class_setup_interfaces (klass, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) return; int klass_interface_count = m_class_get_interface_count (klass); @@ -7876,7 +7876,7 @@ collect_interfaces (MonoClass *klass, GHashTable *ifaces, MonoError *error) g_hash_table_insert (ifaces, ic, ic); collect_interfaces (ic, ifaces, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) return; } } @@ -8208,7 +8208,7 @@ type_commands_internal (int command, MonoClass *klass, MonoDomain *domain, guint } case CMD_TYPE_GET_OBJECT: { MonoObject *o = (MonoObject*)mono_type_get_object_checked (domain, m_class_get_byval_arg (klass), error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_cleanup (error); return ERR_INVALID_OBJECT; } @@ -8286,10 +8286,10 @@ type_commands_internal (int command, MonoClass *klass, MonoDomain *domain, guint for (parent = tclass; parent; parent = m_class_get_parent (parent)) { mono_class_setup_interfaces (parent, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) return ERR_LOADER_ERROR; collect_interfaces (parent, iface_hash, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) return ERR_LOADER_ERROR; } @@ -8607,7 +8607,7 @@ method_commands_internal (int command, MonoMethod *method, MonoDomain *domain, g if (mono_class_get_context (klass)) { ERROR_DECL (error); result = mono_class_inflate_generic_method_full_checked (result, klass, mono_class_get_context (klass), error); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + g_assert (is_ok (error)); /* FIXME don't swallow the error */ } } } @@ -8808,7 +8808,7 @@ method_commands_internal (int command, MonoMethod *method, MonoDomain *domain, g tmp_context.method_inst = ginst; inflated = mono_class_inflate_generic_method_checked (method, &tmp_context, error); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + g_assert (is_ok (error)); /* FIXME don't swallow the error */ if (!mono_verifier_is_method_valid_generic_instantiation (inflated)) return ERR_INVALID_ARGUMENT; buffer_add_methodid (buf, domain, inflated); @@ -9339,7 +9339,7 @@ string_commands (int command, guint8 *p, guint8 *end, Buffer *buf) } else { ERROR_DECL (error); s = mono_string_to_utf8_checked_internal (str, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { if (s) g_free (s); diff --git a/src/mono/mono/mini/debugger-engine.c b/src/mono/mono/mini/debugger-engine.c index 26b9be9..ae5ed98 100644 --- a/src/mono/mono/mini/debugger-engine.c +++ b/src/mono/mono/mini/debugger-engine.c @@ -466,7 +466,7 @@ mono_de_set_breakpoint (MonoMethod *method, long il_offset, EventRequest *req, M g_ptr_array_free (method_domains, TRUE); g_ptr_array_free (method_seq_points, TRUE); - if (error && !mono_error_ok (error)) { + if (error && !is_ok (error)) { mono_de_clear_breakpoint (bp); return NULL; } diff --git a/src/mono/mono/mini/driver.c b/src/mono/mono/mini/driver.c index be595c3..c70c2f2 100644 --- a/src/mono/mono/mini/driver.c +++ b/src/mono/mono/mini/driver.c @@ -721,7 +721,7 @@ interp_regression_step (MonoImage *image, int verbose, int *total_run, int *tota } result_obj = mini_get_interp_callbacks ()->runtime_invoke (method, NULL, NULL, &exc, interp_error); - if (!mono_error_ok (interp_error)) { + if (!is_ok (interp_error)) { cfailed++; g_print ("Test '%s' execution failed.\n", method->name); } else if (exc != NULL) { @@ -1203,7 +1203,7 @@ compile_all_methods_thread_main_inner (CompileAllThreadArgs *args) if (mono_use_interpreter) { mini_get_interp_callbacks ()->create_method_pointer (method, TRUE, error); // FIXME There are a few failures due to DllNotFoundException related to System.Native - if (verbose && !mono_error_ok (error)) + if (verbose && !is_ok (error)) g_print ("Compilation of %s failed\n", mono_method_full_name (method, TRUE)); } else { cfg = mini_method_compile (method, mono_get_optimizations_for_method (method, args->opts), mono_get_root_domain (), (JitFlags)JIT_FLAG_DISCARD_RESULTS, 0, -1); diff --git a/src/mono/mono/mini/dwarfwriter.c b/src/mono/mono/mini/dwarfwriter.c index 4f16fa0..bdd311a 100644 --- a/src/mono/mono/mini/dwarfwriter.c +++ b/src/mono/mono/mini/dwarfwriter.c @@ -1318,7 +1318,7 @@ token_handler (MonoDisHelper *dh, MonoMethod *method, guint32 token) klass = (MonoClass *)data; } else { klass = mono_class_get_checked (m_class_get_image (method->klass), token, error); - g_assert (mono_error_ok (error)); /* FIXME error handling */ + g_assert (is_ok (error)); /* FIXME error handling */ } res = g_strdup_printf ("<%s>", m_class_get_name (klass)); break; @@ -1354,7 +1354,7 @@ token_handler (MonoDisHelper *dh, MonoMethod *method, guint32 token) field = (MonoClassField *)data; } else { field = mono_field_from_token_checked (m_class_get_image (method->klass), token, &klass, NULL, error); - g_assert (mono_error_ok (error)); /* FIXME error handling */ + g_assert (is_ok (error)); /* FIXME error handling */ } desc = mono_field_full_name (field); res = g_strdup_printf ("<%s>", desc); diff --git a/src/mono/mono/mini/interp/transform.c b/src/mono/mono/mini/interp/transform.c index 932efe6..39ecfd0 100644 --- a/src/mono/mono/mini/interp/transform.c +++ b/src/mono/mono/mini/interp/transform.c @@ -857,7 +857,7 @@ jit_call_supported (MonoMethod *method, MonoMethodSignature *sig) if (mono_aot_only && m_class_get_image (method->klass)->aot_module && !(method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED)) { ERROR_DECL (error); gpointer addr = mono_jit_compile_method_jit_only (method, error); - if (addr && mono_error_ok (error)) + if (addr && is_ok (error)) return TRUE; } diff --git a/src/mono/mono/mini/jit-icalls.c b/src/mono/mono/mini/jit-icalls.c index 17a3c29..c866acf 100644 --- a/src/mono/mono/mini/jit-icalls.c +++ b/src/mono/mono/mini/jit-icalls.c @@ -54,7 +54,7 @@ mono_ldftn (MonoMethod *method) } addr = mono_create_jump_trampoline (mono_domain_get (), method, FALSE, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_set_pending_exception (error); return NULL; } @@ -85,7 +85,7 @@ ldvirtfn_internal (MonoObject *obj, MonoMethod *method, gboolean gshared) context.method_inst = mono_method_get_context (method)->method_inst; res = mono_class_inflate_generic_method_checked (res, &context, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_set_pending_exception (error); return NULL; } @@ -823,7 +823,7 @@ mono_ldtoken_wrapper (MonoImage *image, int token, MonoGenericContext *context) gpointer res; res = mono_ldtoken_checked (image, token, &handle_class, context, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_set_pending_exception (error); return NULL; } @@ -1141,13 +1141,13 @@ mono_helper_newobj_mscorlib (guint32 idx) ERROR_DECL (error); MonoClass *klass = mono_class_get_checked (mono_defaults.corlib, MONO_TOKEN_TYPE_DEF | idx, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_set_pending_exception (error); return NULL; } MonoObject *obj = mono_object_new_checked (mono_domain_get (), klass, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) mono_error_set_pending_exception (error); return obj; } @@ -1406,7 +1406,7 @@ mono_gsharedvt_constrained_call (gpointer mp, MonoMethod *cmethod, MonoClass *kl gpointer new_args [16]; m = constrained_gsharedvt_call_setup (mp, cmethod, klass, &this_arg, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_set_pending_exception (error); return NULL; } @@ -1425,7 +1425,7 @@ mono_gsharedvt_constrained_call (gpointer mp, MonoMethod *cmethod, MonoClass *kl } o = mono_runtime_invoke_checked (m, this_arg, args, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_set_pending_exception (error); return NULL; } @@ -1508,7 +1508,7 @@ mono_fill_class_rgctx (MonoVTable *vtable, int index) gpointer res; res = mono_class_fill_runtime_generic_context (vtable, index, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_set_pending_exception (error); return NULL; } @@ -1522,7 +1522,7 @@ mono_fill_method_rgctx (MonoMethodRuntimeGenericContext *mrgctx, int index) gpointer res; res = mono_method_fill_runtime_generic_context (mrgctx, index, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_set_pending_exception (error); return NULL; } diff --git a/src/mono/mono/mini/llvmonly-runtime.c b/src/mono/mono/mini/llvmonly-runtime.c index f588a2b..c9fbb25 100644 --- a/src/mono/mono/mini/llvmonly-runtime.c +++ b/src/mono/mono/mini/llvmonly-runtime.c @@ -550,7 +550,7 @@ mini_llvmonly_resolve_generic_virtual_call (MonoVTable *vt, int slot, MonoMethod context.method_inst = ((MonoMethodInflated*)generic_virtual)->context.method_inst; m = mono_class_inflate_generic_method_checked (declaring, &context, error); - g_assert (mono_error_ok (error)); + g_assert (is_ok (error)); if (m_class_is_valuetype (vt->klass)) need_unbox_tramp = TRUE; diff --git a/src/mono/mono/mini/method-to-ir.c b/src/mono/mono/mini/method-to-ir.c index 6b11d82..d46ac2b 100644 --- a/src/mono/mono/mini/method-to-ir.c +++ b/src/mono/mono/mini/method-to-ir.c @@ -162,7 +162,7 @@ mono_tailcall_print (const char *format, ...) } while (0) #define CHECK_CFG_ERROR do {\ - if (!mono_error_ok (&cfg->error)) { \ + if (!is_ok (&cfg->error)) { \ mono_cfg_set_exception (cfg, MONO_EXCEPTION_MONO_ERROR); \ goto mono_error_exit; \ } \ @@ -11182,7 +11182,7 @@ mono_error_exit: if (cfg->verbose_level > 3) g_print ("exiting due to error"); - g_assert (!mono_error_ok (&cfg->error)); + g_assert (!is_ok (&cfg->error)); goto cleanup; exception_exit: diff --git a/src/mono/mono/mini/mini-exceptions.c b/src/mono/mono/mini/mini-exceptions.c index 35bc9b4..4f55329 100644 --- a/src/mono/mono/mini/mini-exceptions.c +++ b/src/mono/mono/mini/mini-exceptions.c @@ -903,7 +903,7 @@ get_method_from_stack_frame (MonoJitInfo *ji, gpointer generic_info) method = jinfo_get_method (ji); method = mono_method_get_declaring_generic_method (method); method = mono_class_inflate_generic_method_checked (method, &context, error); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + g_assert (is_ok (error)); /* FIXME don't swallow the error */ return method; } @@ -1054,7 +1054,7 @@ ves_icall_get_trace (MonoException *exc, gint32 skip, MonoBoolean need_file_info for (i = skip; i < len; i++) { MonoJitInfo *ji; MonoStackFrame *sf = (MonoStackFrame *)mono_object_new_checked (domain, mono_defaults.stack_frame_class, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_set_pending_exception (error); return NULL; } @@ -1097,7 +1097,7 @@ ves_icall_get_trace (MonoException *exc, gint32 skip, MonoBoolean need_file_info } else { MonoReflectionMethod *rm = mono_method_get_object_checked (domain, method, NULL, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_set_pending_exception (error); return NULL; } @@ -1854,7 +1854,7 @@ ves_icall_get_frame_info (gint32 skip, MonoBoolean need_file_info, } MonoReflectionMethod *rm = mono_method_get_object_checked (domain, actual_method, NULL, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_set_pending_exception (error); return FALSE; } diff --git a/src/mono/mono/mini/mini-generic-sharing.c b/src/mono/mono/mini/mini-generic-sharing.c index 033723a..ee4d051 100644 --- a/src/mono/mono/mini/mini-generic-sharing.c +++ b/src/mono/mono/mini/mini-generic-sharing.c @@ -597,7 +597,7 @@ inflate_info (MonoRuntimeGenericContextInfoTemplate *oti, MonoGenericContext *co } else { ERROR_DECL (error); inflated_method = mono_class_inflate_generic_method_checked (method, context, error); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + g_assert (is_ok (error)); /* FIXME don't swallow the error */ } mono_class_init_internal (inflated_method->klass); g_assert (inflated_method->klass == inflated_class); @@ -663,7 +663,7 @@ inflate_info (MonoRuntimeGenericContextInfoTemplate *oti, MonoGenericContext *co } else { ERROR_DECL (error); inflated_method = mono_class_inflate_generic_method_checked (method, context, error); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + g_assert (is_ok (error)); /* FIXME don't swallow the error */ } mono_class_init_internal (inflated_method->klass); g_assert (inflated_method->klass == inflated_class); @@ -703,7 +703,7 @@ inflate_info (MonoRuntimeGenericContextInfoTemplate *oti, MonoGenericContext *co ERROR_DECL (error); isig = mono_inflate_generic_signature (sig, context, error); - g_assert (mono_error_ok (error)); + g_assert (is_ok (error)); return isig; } case MONO_RGCTX_INFO_VIRT_METHOD_CODE: @@ -723,7 +723,7 @@ inflate_info (MonoRuntimeGenericContextInfoTemplate *oti, MonoGenericContext *co mono_metadata_free_type (t); res->method = mono_class_inflate_generic_method_checked (info->method, context, error); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + g_assert (is_ok (error)); /* FIXME don't swallow the error */ return res; } @@ -2486,7 +2486,7 @@ instantiate_info (MonoDomain *domain, MonoRuntimeGenericContextInfoTemplate *oti break; default: res->entries [i] = instantiate_info (domain, template_, context, klass, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) return NULL; break; } diff --git a/src/mono/mono/mini/mini-runtime.c b/src/mono/mono/mini/mini-runtime.c index b5de211..0418d67 100644 --- a/src/mono/mono/mini/mini-runtime.c +++ b/src/mono/mono/mini/mini-runtime.c @@ -1376,7 +1376,7 @@ mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code, } case MONO_PATCH_INFO_METHOD_JUMP: target = mono_create_jump_trampoline (domain, patch_info->data.method, FALSE, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) return NULL; break; case MONO_PATCH_INFO_METHOD: @@ -1385,7 +1385,7 @@ mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code, } else { /* get the trampoline to the method from the domain */ target = mono_create_jit_trampoline (domain, patch_info->data.method, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) return NULL; } break; @@ -1518,13 +1518,13 @@ mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code, handle = mono_ldtoken_checked (patch_info->data.token->image, patch_info->data.token->token, &handle_class, patch_info->data.token->has_context ? &patch_info->data.token->context : NULL, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) return NULL; mono_class_init_internal (handle_class); mono_class_init_internal (mono_class_from_mono_type_internal ((MonoType *)handle)); target = mono_type_get_object_checked (domain, (MonoType *)handle, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) return NULL; break; } @@ -2324,7 +2324,7 @@ mono_jit_compile_method_with_opt (MonoMethod *method, guint32 opt, gboolean jit_ method = info->d.synchronized_inner.method; if (ctx) { method = mono_class_inflate_generic_method_checked (method, ctx, error); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + g_assert (is_ok (error)); /* FIXME don't swallow the error */ } } } @@ -2397,7 +2397,7 @@ lookup_start: if (!code) { code = compile_special (method, target_domain, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) return NULL; } @@ -2408,7 +2408,7 @@ lookup_start: } code = mini_get_interp_callbacks ()->create_method_pointer (method, TRUE, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) return NULL; } @@ -2433,7 +2433,7 @@ lookup_start: code = mono_jit_compile_method_inner (method, target_domain, opt, error); unregister_method_for_compile (method, target_domain); } - if (!mono_error_ok (error)) + if (!is_ok (error)) return NULL; if (!code && mono_llvm_only) { @@ -2756,7 +2756,7 @@ create_runtime_invoke_info (MonoDomain *domain, MonoMethod *method, gpointer com invoke = mono_marshal_get_runtime_invoke (method, FALSE); (void)invoke; info->vtable = mono_class_vtable_checked (domain, method->klass, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) goto exit; g_assert (info->vtable); @@ -2861,7 +2861,7 @@ create_runtime_invoke_info (MonoDomain *domain, MonoMethod *method, gpointer com g_free (wrapper_sig); info->compiled_method = mono_jit_compile_method (wrapper, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) goto exit; } else { /* Gsharedvt methods can be invoked the same way */ @@ -2875,7 +2875,7 @@ create_runtime_invoke_info (MonoDomain *domain, MonoMethod *method, gpointer com } } info->runtime_invoke = mono_jit_compile_method (invoke, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) goto exit; } @@ -3042,7 +3042,7 @@ mono_jit_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObjec if (callee) { compiled_method = mono_jit_compile_method_jit_only (callee, error); if (!compiled_method) { - g_assert (!mono_error_ok (error)); + g_assert (!is_ok (error)); if (mono_use_interpreter) use_interp = TRUE; @@ -3064,7 +3064,7 @@ mono_jit_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObjec } info = create_runtime_invoke_info (domain, method, compiled_method, callee_gsharedvt, use_interp, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) return NULL; mono_domain_lock (domain); @@ -3109,7 +3109,7 @@ mono_jit_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObjec if (!dyn_runtime_invoke && mono_use_interpreter) { info->use_interp = TRUE; info->dyn_call_info = NULL; - } else if (!mono_error_ok (error)) { + } else if (!is_ok (error)) { mono_domain_unlock (domain); return NULL; } diff --git a/src/mono/mono/mini/mini-trampolines.c b/src/mono/mono/mini/mini-trampolines.c index 781e91b..b4f7321 100644 --- a/src/mono/mono/mini/mini-trampolines.c +++ b/src/mono/mono/mini/mini-trampolines.c @@ -855,7 +855,7 @@ mono_vcall_trampoline (host_mgreg_t *regs, guint8 *code, int slot, guint8 *tramp res = common_call_trampoline (regs, code, m, vt, vtable_slot, error); leave: - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_set_pending_exception (error); res = NULL; } @@ -892,7 +892,7 @@ mono_generic_virtual_remoting_trampoline (host_mgreg_t *regs, guint8 *code, Mono if (imt_method->is_inflated) context.method_inst = ((MonoMethodInflated*)imt_method)->context.method_inst; m = mono_class_inflate_generic_method_checked (declaring, &context, error); - g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */; + g_assert (is_ok (error)); /* FIXME don't swallow the error */; m = mono_marshal_get_remoting_invoke_with_check (m, error); if (!is_ok (error)) { mono_error_set_pending_exception (error); @@ -900,7 +900,7 @@ mono_generic_virtual_remoting_trampoline (host_mgreg_t *regs, guint8 *code, Mono } addr = mono_jit_compile_method (m, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_set_pending_exception (error); return NULL; } @@ -978,7 +978,7 @@ mono_aot_plt_trampoline (host_mgreg_t *regs, guint8 *code, guint8 *aot_module, res = mono_aot_plt_resolve (aot_module, plt_info_offset, code, error); if (!res) { - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_set_pending_exception (error); return NULL; } @@ -1009,7 +1009,7 @@ mono_rgctx_lazy_fetch_trampoline (host_mgreg_t *regs, guint8 *code, gpointer dat res = mono_method_fill_runtime_generic_context ((MonoMethodRuntimeGenericContext *)arg, index, error); else res = mono_class_fill_runtime_generic_context ((MonoVTable *)arg, index, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_set_pending_exception (error); return NULL; } @@ -1169,7 +1169,7 @@ mono_delegate_trampoline (host_mgreg_t *regs, guint8 *code, gpointer *arg, guint delegate->method_ptr = *delegate->method_code; } else { compiled_method = addr = mono_jit_compile_method (method, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_set_pending_exception (error); return NULL; } @@ -1199,7 +1199,7 @@ mono_delegate_trampoline (host_mgreg_t *regs, guint8 *code, gpointer *arg, guint /* The general, unoptimized case */ m = mono_marshal_get_delegate_invoke (invoke, delegate); code = (guint8 *)mono_jit_compile_method (m, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { mono_error_set_pending_exception (error); return NULL; } @@ -1338,7 +1338,7 @@ mono_create_jump_trampoline (MonoDomain *domain, MonoMethod *method, gboolean ad if (mono_use_interpreter && !mono_aot_only) { gpointer ret = mini_get_interp_callbacks ()->create_method_pointer (method, FALSE, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) return NULL; return ret; } @@ -1355,7 +1355,7 @@ mono_create_jump_trampoline (MonoDomain *domain, MonoMethod *method, gboolean ad if (mono_llvm_only) { code = mono_jit_compile_method (method, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) return NULL; return code; } @@ -1416,7 +1416,7 @@ mono_create_jit_trampoline (MonoDomain *domain, MonoMethod *method, MonoError *e return (gpointer)method_not_found; /* Methods are lazily initialized on first call, so this can't lead recursion */ code = mono_jit_compile_method (method, error); - if (!mono_error_ok (error)) + if (!is_ok (error)) return NULL; return code; } diff --git a/src/mono/mono/mini/mini-wasm-debugger.c b/src/mono/mono/mini/mini-wasm-debugger.c index cc8e147..fd34e21 100644 --- a/src/mono/mono/mini/mini-wasm-debugger.c +++ b/src/mono/mono/mini/mini-wasm-debugger.c @@ -717,7 +717,7 @@ describe_object_properties (guint64 objectId, gboolean isAsyncLocalThis) mono_wasm_add_properties_var(p->name); sig = mono_method_signature_internal (p->get); res = mono_runtime_try_invoke (p->get, obj, NULL, &exc, error); - if (!mono_error_ok (error) && exc == NULL) + if (!is_ok (error) && exc == NULL) exc = (MonoObject*) mono_error_convert_to_exception (error); if (exc) describe_value (mono_get_object_type (), &exc); diff --git a/src/mono/mono/mini/mini.c b/src/mono/mono/mini/mini.c index e332cc7..0dce4d2 100644 --- a/src/mono/mono/mini/mini.c +++ b/src/mono/mono/mini/mini.c @@ -1004,7 +1004,7 @@ mini_method_verify (MonoCompile *cfg, MonoMethod *method, gboolean fail_compile) mono_error_set_generic_error (&cfg->error, "System", "FieldAccessException", "%s", msg); else if (info->exception_type == MONO_EXCEPTION_UNVERIFIABLE_IL) mono_error_set_generic_error (&cfg->error, "System.Security", "VerificationException", "%s", msg); - if (!mono_error_ok (&cfg->error)) { + if (!is_ok (&cfg->error)) { mono_cfg_set_exception (cfg, MONO_EXCEPTION_MONO_ERROR); g_free (msg); } else { @@ -2302,7 +2302,7 @@ mono_codegen (MonoCompile *cfg) continue; target = mono_resolve_patch_target (cfg->method, cfg->domain, cfg->native_code, ji, cfg->run_cctors, &cfg->error); - if (!mono_error_ok (&cfg->error)) { + if (!is_ok (&cfg->error)) { mono_cfg_set_exception (cfg, MONO_EXCEPTION_MONO_ERROR); return; } @@ -4061,7 +4061,7 @@ mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, in } case MONO_EXCEPTION_MONO_ERROR: // FIXME: MonoError has no copy ctor - g_assert (!mono_error_ok (&cfg->error)); + g_assert (!is_ok (&cfg->error)); ex = mono_error_convert_to_exception (&cfg->error); break; default: @@ -4132,7 +4132,7 @@ mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, in #endif mono_domain_unlock (target_domain); - if (!mono_error_ok (error)) + if (!is_ok (error)) return NULL; vtable = mono_class_vtable_checked (target_domain, method->klass, error); diff --git a/src/mono/mono/profiler/aot.c b/src/mono/mono/profiler/aot.c index 5bf7f44..e7c59d8 100644 --- a/src/mono/mono/profiler/aot.c +++ b/src/mono/mono/profiler/aot.c @@ -592,7 +592,7 @@ add_method (MonoProfiler *prof, MonoMethod *m) char *s; sig = mono_method_signature_checked (m, error); - g_assert (mono_error_ok (error)); + g_assert (is_ok (error)); int class_id = add_class (prof, m->klass); if (class_id == -1) diff --git a/src/mono/mono/unit-tests/test-mono-string.c b/src/mono/mono/unit-tests/test-mono-string.c index 438263f..4edda5f 100644 --- a/src/mono/mono/unit-tests/test-mono-string.c +++ b/src/mono/mono/unit-tests/test-mono-string.c @@ -41,7 +41,7 @@ new_string_conv_err (void) ERROR_DECL (error); static const unsigned char bytes[] = { 'a', 0xFC, 'b', 'c', 0 }; MonoString G_GNUC_UNUSED *s = mono_string_new_checked (mono_domain_get (), (const char*)bytes, error); - g_assert (!mono_error_ok (error)); + g_assert (!is_ok (error)); const char *msg = mono_error_get_message (error); g_assert (msg != NULL); fprintf (stderr, "(expected) error message was: \"%s\"", msg); diff --git a/src/mono/mono/utils/mono-error.c b/src/mono/mono/utils/mono-error.c index 16dbe1e..6ee6096 100644 --- a/src/mono/mono/utils/mono-error.c +++ b/src/mono/mono/utils/mono-error.c @@ -189,7 +189,7 @@ mono_error_cleanup (MonoError *oerror) gboolean mono_error_ok (MonoError *error) { - return error->error_code == MONO_ERROR_NONE; + return is_ok (error); } guint16 @@ -672,7 +672,7 @@ mono_error_prepare_exception (MonoError *oerror, MonoError *error_out) if ((error->type_name && error->assembly_name) || error->exn.klass) { type_name = get_type_name_as_mono_string (error, domain, error_out); - if (!mono_error_ok (error_out)) + if (!is_ok (error_out)) break; if (error->assembly_name) { @@ -757,7 +757,7 @@ mono_error_prepare_exception (MonoError *oerror, MonoError *error_out) mono_error_set_execution_engine (error_out, "Invalid error-code %d", error->error_code); } - if (!mono_error_ok (error_out)) + if (!is_ok (error_out)) goto return_null; if (MONO_HANDLE_IS_NULL (exception)) @@ -787,17 +787,17 @@ mono_error_convert_to_exception (MonoError *target_error) /* Mempool stored error shouldn't be cleaned up */ g_assert (!is_boxed ((MonoErrorInternal*)target_error)); - if (mono_error_ok (target_error)) + if (is_ok (target_error)) return NULL; ex = mono_error_prepare_exception (target_error, error); - if (!mono_error_ok (error)) { + if (!is_ok (error)) { ERROR_DECL (second_chance); /*Try to produce the exception for the second error. FIXME maybe we should log about the original one*/ ex = mono_error_prepare_exception (error, second_chance); // We cannot reasonably handle double faults, maybe later. - g_assert (mono_error_ok (second_chance)); + g_assert (is_ok (second_chance)); mono_error_cleanup (error); } mono_error_cleanup (target_error); diff --git a/src/mono/mono/utils/mono-error.h b/src/mono/mono/utils/mono-error.h index c1000e3..d2c688e 100644 --- a/src/mono/mono/utils/mono-error.h +++ b/src/mono/mono/utils/mono-error.h @@ -85,7 +85,7 @@ mono_error_init_flags (MonoError *error, unsigned short flags); MONO_API void mono_error_cleanup (MonoError *error); -MONO_API mono_bool +MONO_API MONO_RT_EXTERNAL_ONLY mono_bool mono_error_ok (MonoError *error); MONO_API unsigned short -- 2.7.4