[commit: ghc] ghc-8.0: RtsFlags: Un-constify temporary buffer (b18d17d)

git at git.haskell.org git at git.haskell.org
Sun Apr 10 22:17:06 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/b18d17d6f2413d7eb88b4ced46d6a8e6623e7b18/ghc

>---------------------------------------------------------------

commit b18d17d6f2413d7eb88b4ced46d6a8e6623e7b18
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Sun Apr 10 23:28:46 2016 +0200

    RtsFlags: Un-constify temporary buffer
    
    Otherwise we get a const-ness mismatch when we free the buffer, which
    for some reason gcc 5.3 didn't notice.
    
    (cherry picked from commit 378091c9ef6d25a076125f0b82dce1a155c0e8f0)


>---------------------------------------------------------------

b18d17d6f2413d7eb88b4ced46d6a8e6623e7b18
 rts/RtsFlags.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c
index ed6f43e..5ecb5e0 100644
--- a/rts/RtsFlags.c
+++ b/rts/RtsFlags.c
@@ -1576,7 +1576,7 @@ static rtsBool read_heap_profiling_flag(const char *arg_in)
     // 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.
-    const char *arg = strdup(arg_in);
+    char *arg = strdup(arg_in);
     rtsBool error = rtsFalse;
     switch (arg[2]) {
     case '\0':



More information about the ghc-commits mailing list