From eaa835bb0853a30d813bb2a0d386d428ad468234 Mon Sep 17 00:00:00 2001 From: Ben Gamari <ben@smart-cactus.org> Date: Sun, 6 Aug 2023 08:14:17 -0400 Subject: [PATCH] rts/ipe: Fix const-correctness of IpeBufferListNode Both info tables and the string table should be `const` --- rts/IPE.c | 6 +++--- rts/IPE.h | 2 +- rts/include/rts/IPE.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rts/IPE.c b/rts/IPE.c index 0fbbfd1b5d4e..b3e5edea88dc 100644 --- a/rts/IPE.c +++ b/rts/IPE.c @@ -114,7 +114,7 @@ void dumpIPEToEventLog(void) { IpeBufferListNode *cursor = RELAXED_LOAD(&ipeBufferList); while (cursor != NULL) { IpeBufferEntry *entries; - char *strings; + const char *strings; // Decompress if compressed decompressIPEBufferListNodeIfCompressed(cursor, &entries, &strings); @@ -190,7 +190,7 @@ void updateIpeMap(void) { while (pending != NULL) { IpeBufferListNode *current_node = pending; IpeBufferEntry *entries; - char *strings; + const char *strings; // Decompress if compressed decompressIPEBufferListNodeIfCompressed(current_node, &entries, &strings); @@ -220,7 +220,7 @@ referenced by the 'entries_dst' and 'string_table_dst' parameters will point at the decompressed IPE data and string table for the given node, respectively, upon return from this function. */ -void decompressIPEBufferListNodeIfCompressed(IpeBufferListNode *node, IpeBufferEntry **entries_dst, char **string_table_dst) { +void decompressIPEBufferListNodeIfCompressed(IpeBufferListNode *node, IpeBufferEntry **entries_dst, const char **string_table_dst) { if (node->compressed == 1) { // The IPE list buffer node indicates that the strings table and // entries list has been compressed. If zstd is not available, fail. diff --git a/rts/IPE.h b/rts/IPE.h index df1d01646f08..9dbb4f163695 100644 --- a/rts/IPE.h +++ b/rts/IPE.h @@ -17,6 +17,6 @@ void dumpIPEToEventLog(void); void updateIpeMap(void); void initIpe(void); void exitIpe(void); -void decompressIPEBufferListNodeIfCompressed(IpeBufferListNode*, IpeBufferEntry**, char**); +void decompressIPEBufferListNodeIfCompressed(IpeBufferListNode*, IpeBufferEntry**, const char**); #include "EndPrivate.h" diff --git a/rts/include/rts/IPE.h b/rts/include/rts/IPE.h index 8f732c9f9f9c..ca87aa840a95 100644 --- a/rts/include/rts/IPE.h +++ b/rts/include/rts/IPE.h @@ -76,12 +76,12 @@ typedef struct IpeBufferListNode_ { // When TNTC is enabled, these will point to the entry code // not the info table itself. - StgInfoTable **tables; + const StgInfoTable **tables; IpeBufferEntry *entries; StgWord entries_size; // decompressed size - char *string_table; + const char *string_table; StgWord string_table_size; // decompressed size } IpeBufferListNode; -- GitLab