void idn_testsuite_assertstring(idn_testsuite_t ctx, const char *gotten, const char *expected, const char *file, int lineno) { char *expected_hex = NULL; char *gotten_hex = NULL; char *msg; assert(ctx != NULL && gotten != NULL && expected != NULL && file != NULL); if (idn_testsuite_getstatus(ctx) != idn_teststatus_pass) return; if (strcmp(expected, gotten) == 0) return; idn_testsuite_setstatus(ctx, idn_teststatus_fail); msg = (char *)malloc(strlen(expected) * 4 + strlen(gotten) * 4 + 32); expected_hex = make_hex_string(expected); gotten_hex = make_hex_string(gotten); if (msg == NULL || expected_hex == NULL || gotten_hex == NULL) { msg = ""; } else { sprintf(msg, "`%s' expected, but got `%s'", expected_hex, gotten_hex); } put_failure_message(ctx, msg, file, lineno); free(msg); free(expected_hex); free(gotten_hex); }
OBJFPY_REQUIRE_VALID (obj); TRY { build_id = build_id_bfd_get (objfile->obfd); } CATCH (except, RETURN_MASK_ALL) { GDB_PY_HANDLE_EXCEPTION (except); } END_CATCH if (build_id != NULL) { char *hex_form = make_hex_string (build_id->data, build_id->size); PyObject *result; result = PyString_Decode (hex_form, strlen (hex_form), host_charset (), NULL); xfree (hex_form); return result; } Py_RETURN_NONE; } /* An Objfile method which returns the objfile's progspace, or None. */ static PyObject * objfpy_get_progspace (PyObject *self, void *closure)