Commit d585073d authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari
Browse files

RtsFlags: Fix const warning

Reviewers: austin

Reviewed By: austin

Subscribers: thomie

Differential Revision:
parent 7f77e4e9
......@@ -131,13 +131,13 @@ typedef struct _PROFILING_FLAGS {
nat ccsLength;
char* modSelector;
char* descrSelector;
char* typeSelector;
char* ccSelector;
char* ccsSelector;
char* retainerSelector;
char* bioSelector;
const char* modSelector;
const char* descrSelector;
const char* typeSelector;
const char* ccSelector;
const char* ccsSelector;
const char* retainerSelector;
const char* bioSelector;
......@@ -549,9 +549,9 @@ fprint_ccs(FILE *fp, CostCentreStack *ccs, nat max_length)
strMatchesSelector( char* str, char* sel )
strMatchesSelector( const char* str, const char* sel )
char* p;
const char* p;
// debugBelch("str_matches_selector %s %s\n", str, sel);
while (1) {
// Compare str against wherever we've got to in sel.
......@@ -14,7 +14,7 @@
void heapCensus (Time t);
nat initHeapProfiling (void);
void endHeapProfiling (void);
rtsBool strMatchesSelector (char* str, char* sel);
rtsBool strMatchesSelector (const char* str, const char* sel);
#include "EndPrivate.h"
......@@ -1531,9 +1531,15 @@ static void read_debug_flags(const char* arg)
// Parse a "-h" flag, returning whether the parse resulted in an error.
static rtsBool read_heap_profiling_flag(const char *arg)
static rtsBool read_heap_profiling_flag(const char *arg_in)
// 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':
......@@ -1638,6 +1644,7 @@ static rtsBool read_heap_profiling_flag(const char *arg)
error = rtsTrue;
return error;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment