return jv_invalid_with_msg(jv_string_concat(jv_string("Regex failure: "),
jv_string((char*)ebuf)));
}
- if (!test)
- result = jv_array();
+ result = test ? jv_false() : jv_array();
const char *input_string = jv_string_value(input);
const UChar* start = (const UChar*)jv_string_value(input);
const unsigned long length = jv_string_length_bytes(jv_copy(input));
start = (const UChar*)(input_string+region->end[0]);
onig_region_free(region,0);
} else if (onigret == ONIG_MISMATCH) {
- if (test)
- result = jv_false();
break;
} else { /* Error */
UChar ebuf[ONIG_MAX_ERROR_MESSAGE_LEN];
static uint16_t nesting_level(struct bytecode* bc, inst* target) {
uint16_t level = 0;
- assert(bc && target->compiled);
+ assert(bc && target && target->compiled);
while (bc && target->compiled != bc) {
level++;
bc = bc->parent;
if (must_fail) {
jq_set_error_cb(jq, NULL, NULL);
- must_fail = 0;
- check_msg = 0;
if (!fgets(buf, sizeof(buf), testdata)) { invalid++; break; }
lineno++;
if (buf[strlen(buf)-1] == '\n') buf[strlen(buf)-1] = 0;
if (compiled) {
printf("*** Test program compiled that should not have at line %u: %s\n", lineno, prog);
- invalid++; continue;
+ must_fail = 0;
+ check_msg = 0;
+ invalid++;
+ continue;
}
if (check_msg && strcmp(buf, err_msg.buf) != 0) {
printf("*** Erroneous test program failed with wrong message (%s) at line %u: %s\n", err_msg.buf, lineno, prog);
} else {
passed++;
}
+ must_fail = 0;
+ check_msg = 0;
continue;
}
/* Assumes valid UTF8 */
static jv jvp_string_new(const char* data, uint32_t length) {
+ assert(data);
jvp_string* s = jvp_string_alloc(length);
s->length_hashed = length << 1;
memcpy(s->data, data, length);
#ifndef NDEBUG
volatile char jv_mem_uninitialised;
__attribute__((constructor)) void jv_mem_uninit_setup(){
+ // ignore warning that this reads uninitialized memory - that's the point!
+#ifndef __clang_analyzer__
char* p = malloc(1);
jv_mem_uninitialised = *p;
free(p);
+#endif
}
#endif
if (jv_invalid_has_msg(jv_copy(value))) {
jv_free(data);
data = value;
- value = jv_invalid();
break;
}
}