diff options
author | Thomas Miedema <thomasmiedema@gmail.com> | 2016-05-19 10:20:15 +0200 |
---|---|---|
committer | Thomas Miedema <thomasmiedema@gmail.com> | 2016-05-25 19:25:01 +0200 |
commit | eec88ee07c28a18b1b5b4edfde8e898324264bce (patch) | |
tree | 4698d0b9f80b1b6561c98e107d2aa92d23bc4665 /rts/RtsFlags.c | |
parent | 961ed26b69292f6bfb75cd2209ea0c67e77abf7b (diff) | |
download | haskell-eec88ee07c28a18b1b5b4edfde8e898324264bce.tar.gz |
RTS: simplify read_heap_profiling_flag
Since 535896e58f7fc8d89a5ff34629a3471eac529d93, "args" is not mutated
anymore, so we don't need to create a temporary copy.
Reviewed by: bgamari
Differential Revision: https://phabricator.haskell.org/D2264
Diffstat (limited to 'rts/RtsFlags.c')
-rw-r--r-- | rts/RtsFlags.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index b0ce8bee1b..31a2c8b4f2 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -1588,15 +1588,10 @@ static void read_debug_flags(const char* arg) #ifdef PROFILING // Parse a "-h" flag, returning whether the parse resulted in an error. -static rtsBool read_heap_profiling_flag(const char *arg_in) +static rtsBool read_heap_profiling_flag(const char *arg) { // Already parsed "-h" - // For historical reasons the parser here mutates the arguments. - // However, for sanity we want to guarantee const-correctness and parsing - // really ought to be an immutable operation. To avoid rewriting the parser - // we just operate on a temporary copy of the argument. - char *arg = strdup(arg_in); rtsBool error = rtsFalse; switch (arg[2]) { case '\0': @@ -1703,7 +1698,6 @@ static rtsBool read_heap_profiling_flag(const char *arg_in) error = rtsTrue; } - free(arg); return error; } #endif |