Skip to content

Commit 03ba262

Browse files
authored
Merge pull request #506 from res2k/mi_option-verbose-fixes
"verbose" option fixes
2 parents 0560fc2 + f7c821f commit 03ba262

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/options.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,8 +532,19 @@ static void mi_option_init(mi_option_desc_t* desc) {
532532
desc->init = INITIALIZED;
533533
}
534534
else {
535-
_mi_warning_message("environment option mimalloc_%s has an invalid value: %s\n", desc->name, buf);
535+
/* _mi_warning_message() will itself call mi_option_get() for some options,
536+
* so to avoid a possible infinite recursion it's important to mark the option as
537+
* "initialized" first */
536538
desc->init = DEFAULTED;
539+
if (desc->option == mi_option_verbose) {
540+
/* Special case: if the 'mimalloc_verbose' env var has a bogus value we'd never know
541+
* (since the value default to 'off') - so in that one case briefly set the option to 'on' */
542+
desc->value = 1;
543+
}
544+
_mi_warning_message("environment option mimalloc_%s has an invalid value: %s\n", desc->name, buf);
545+
if (desc->option == mi_option_verbose) {
546+
desc->value = 0;
547+
}
537548
}
538549
}
539550
mi_assert_internal(desc->init != UNINIT);

0 commit comments

Comments
 (0)