[commit: ghc] wip/erikd/remove-nat: RtsFlags: Make `mallocFailHook` const correct (8d42d24)

git at git.haskell.org git at git.haskell.org
Mon May 2 23:23:40 UTC 2016


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

On branch  : wip/erikd/remove-nat
Link       : http://ghc.haskell.org/trac/ghc/changeset/8d42d24f8421a15a2305531d1b12e0b83a4b0ac5/ghc

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

commit 8d42d24f8421a15a2305531d1b12e0b83a4b0ac5
Author: Erik de Castro Lopo <erikd at mega-nerd.com>
Date:   Mon May 2 21:20:28 2016 +1000

    RtsFlags: Make `mallocFailHook` const correct


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

8d42d24f8421a15a2305531d1b12e0b83a4b0ac5
 includes/RtsAPI.h      | 2 +-
 rts/hooks/Hooks.h      | 2 +-
 rts/hooks/MallocFail.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/includes/RtsAPI.h b/includes/RtsAPI.h
index 16b8486..a4a094f 100644
--- a/includes/RtsAPI.h
+++ b/includes/RtsAPI.h
@@ -90,7 +90,7 @@ typedef struct {
     void (* outOfHeapHook) (W_ request_size, W_ heap_size);
 
     // Called when malloc() fails, before exiting
-    void (* mallocFailHook) (W_ request_size /* in bytes */, char *msg);
+    void (* mallocFailHook) (W_ request_size /* in bytes */, const char *msg);
 
     // Called for every GC
     void (* gcDoneHook) (unsigned int gen,
diff --git a/rts/hooks/Hooks.h b/rts/hooks/Hooks.h
index 35a6011..1383ccd 100644
--- a/rts/hooks/Hooks.h
+++ b/rts/hooks/Hooks.h
@@ -21,7 +21,7 @@ extern char *ghc_rts_opts;
 extern void OnExitHook (void);
 extern void StackOverflowHook (W_ stack_size);
 extern void OutOfHeapHook (W_ request_size, W_ heap_size);
-extern void MallocFailHook (W_ request_size /* in bytes */, char *msg);
+extern void MallocFailHook (W_ request_size /* in bytes */, const char *msg);
 extern void FlagDefaultsHook (void);
 
 #include "EndPrivate.h"
diff --git a/rts/hooks/MallocFail.c b/rts/hooks/MallocFail.c
index 63343a7..42606b6 100644
--- a/rts/hooks/MallocFail.c
+++ b/rts/hooks/MallocFail.c
@@ -11,7 +11,7 @@
 #include <stdio.h>
 
 void
-MallocFailHook (W_ request_size /* in bytes */, char *msg)
+MallocFailHook (W_ request_size /* in bytes */, const char *msg)
 {
     fprintf(stderr, "malloc: failed on request for %" FMT_Word " bytes; message: %s\n", request_size, msg);
 }



More information about the ghc-commits mailing list