To protect your data, the CISO officer has suggested users to enable GitLab 2FA as soon as possible.

Commit 6d42793c authored by Kunshan Wang's avatar Kunshan Wang
Browse files

MuCString is now const char*

And apparently no Scala code is changed.
parent 286db316
......@@ -83,7 +83,7 @@ typedef MuGenRefValue MuIBRefValue; // irbuilderref
// Mu IR. If you want to build IR using this C API, use MuCtx->new_ir_builder.
// C-style '\0'-terminated string
typedef char *MuCString;
typedef const char *MuCString;
// Identifiers and names of Mu
typedef uint32_t MuID;
......
......@@ -15,7 +15,7 @@ r_param = re.compile(r'\s*(?P<type>\w+\s*\*?)\s*(?P<name>\w+)')
r_define = re.compile(r'^\s*#define\s+(?P<name>\w+)\s*\(\((?P<type>\w+)\)(?P<value>\w+)\)\s*' + rfrag_commpragma + r'\s*$', re.MULTILINE)
r_typedef = re.compile(r'^\s*typedef\s+(?P<expand_to>\w+\s*\*?)\s*(?P<name>\w+)\s*;', re.MULTILINE)
r_typedef = re.compile(r'^\s*typedef\s+(?P<const>const\s+)?(?P<expand_to>\w+\s*\*?)\s*(?P<name>\w+)\s*;', re.MULTILINE)
r_struct_start = re.compile(r'^struct\s+(\w+)\s*\{')
r_struct_end = re.compile(r'^\};')
......@@ -141,7 +141,7 @@ def extract_typedefs(text):
typedefs = {}
typedefs_order = []
for m in r_typedef.finditer(text):
expand_to, name = m.groups()
const_qualifier, expand_to, name = m.groups()
expand_to = expand_to.replace(" ","")
typedefs[name] = expand_to
typedefs_order.append((name, expand_to))
......
......@@ -22,7 +22,7 @@
#define muprintf(fmt, ...) printf("[C:%d:%s] " fmt, __LINE__, __func__, ## __VA_ARGS__)
bool test_basic(MuVM *mvm, int theID, char *theName) {
bool test_basic(MuVM *mvm, int theID, const char *theName) {
muprintf("header: %p\n", mvm->header);
muprintf("new_context: %p\n", mvm->new_context);
muprintf("id_of: %p\n", mvm->id_of);
......@@ -36,7 +36,7 @@ bool test_basic(MuVM *mvm, int theID, char *theName) {
return false;
}
char *name = mvm->name_of(mvm, theID);
const char *name = mvm->name_of(mvm, theID);
muprintf("name = %s\n", name);
if (strcmp(name, theName) != 0) {
muprintf("name %s is not equal to %s\n", name, theName);
......@@ -46,7 +46,7 @@ bool test_basic(MuVM *mvm, int theID, char *theName) {
return true;
}
bool test_with_ctx(MuVM *mvm, int theID, char *theName) {
bool test_with_ctx(MuVM *mvm, int theID, const char *theName) {
MuCtx *ctx = mvm->new_context(mvm);
int id = ctx->id_of(ctx, theName);
......@@ -56,7 +56,7 @@ bool test_with_ctx(MuVM *mvm, int theID, char *theName) {
return false;
}
char *name = ctx->name_of(ctx, theID);
const char *name = ctx->name_of(ctx, theID);
muprintf("name = %s\n", name);
if (strcmp(name, theName) != 0) {
muprintf("name %s is not equal to %s\n", name, theName);
......
Markdown is supported
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