diff options
author | Peter Zhu <[email protected]> | 2024-03-21 16:22:46 -0400 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2024-03-26 10:02:17 -0400 |
commit | 19752cf4aa227106212be129507ac1bf339b26c0 (patch) | |
tree | 810a2320d68ef0b044b5699285b70612b3815b15 /debug.c | |
parent | e9152bc9da39ad864b755e7bcc682610f8035a98 (diff) |
Use macro SET_WHEN_UINT
Diffstat (limited to 'debug.c')
-rw-r--r-- | debug.c | 19 |
1 files changed, 8 insertions, 11 deletions
@@ -219,7 +219,11 @@ ruby_env_debug_option(const char *str, int len, void *arg) } \ } while (0) #define SET_WHEN_UINT(name, vals, num, req) \ - if (NAME_MATCH_VALUE(name)) SET_UINT_LIST(name, vals, num); + if (NAME_MATCH_VALUE(name)) { \ + if (!len) req; \ + else SET_UINT_LIST(name, vals, num); \ + return 1; \ + } if (NAME_MATCH("gc_stress")) { rb_gc_stress_set(Qtrue); @@ -227,22 +231,15 @@ ruby_env_debug_option(const char *str, int len, void *arg) } SET_WHEN("core", ruby_enable_coredump, 1); SET_WHEN("ci", ruby_on_ci, 1); - if (NAME_MATCH_VALUE("rgengc")) { - if (!len) ruby_rgengc_debug = 1; - else SET_UINT_LIST("rgengc", &ruby_rgengc_debug, 1); - return 1; - } + SET_WHEN_UINT("rgengc", &ruby_rgengc_debug, 1, ruby_rgengc_debug = 1); #if defined _WIN32 # if RUBY_MSVCRT_VERSION >= 80 SET_WHEN("rtc_error", ruby_w32_rtc_error, 1); # endif #endif #if defined _WIN32 || defined __CYGWIN__ - if (NAME_MATCH_VALUE("codepage")) { - if (!len) fprintf(stderr, "missing codepage argument"); - else SET_UINT_LIST("codepage", ruby_w32_codepage, numberof(ruby_w32_codepage)); - return 1; - } + SET_WHEN_UINT("codepage", ruby_w32_codepage, numberof(ruby_w32_codepage), + fprintf(stderr, "missing codepage argument")); #endif return 0; } |