Skip to content

Commit

Permalink
Use strcmp instead of strncmp
Browse files Browse the repository at this point in the history
getenv and string literals are guaranteed to be null terminated, so it
should be safe to use strcmp instead.
  • Loading branch information
peterzhu2118 committed Oct 17, 2024
1 parent 74f4c7c commit 27ca580
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gc/mmtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ rb_mmtk_builder_init(void)
enum mmtk_heap_mode mode = RB_MMTK_DYNAMIC_HEAP;

// switch to fixed mode if defined, for any other value assume the default, which is dynamic
if (getenv("MMTK_HEAP_MODE") && !strncmp(getenv("MMTK_HEAP_MODE"), "fixed", 5)) {
if (getenv("MMTK_HEAP_MODE") && !strcmp(getenv("MMTK_HEAP_MODE"), "fixed")) {
mode = RB_MMTK_FIXED_HEAP;
}

Expand Down

0 comments on commit 27ca580

Please sign in to comment.