[commit: ghc] master: RTS: simplify read_heap_profiling_flag (eec88ee)
git at git.haskell.org
git at git.haskell.org
Wed May 25 17:21:37 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/eec88ee07c28a18b1b5b4edfde8e898324264bce/ghc
>---------------------------------------------------------------
commit eec88ee07c28a18b1b5b4edfde8e898324264bce
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date: Thu May 19 10:20:15 2016 +0200
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
>---------------------------------------------------------------
eec88ee07c28a18b1b5b4edfde8e898324264bce
rts/RtsFlags.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c
index b0ce8be..31a2c8b 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
More information about the ghc-commits
mailing list