Unverified Commit df75153d authored by Binbin's avatar Binbin Committed by GitHub
Browse files

Fix reply schemas validator build issue due to new regular expression (#13103)

The new regular expression break the validator:
```
In file included from commands.c:10:
commands_with_reply_schema.def:14528:72: error: stray ‘\’ in program
14528 | struct jsonObjectElement MEMORY_STATS_ReplySchema_patternProperties__db\_\d+__properties_overhead_hashtable_main_elements[] = {
```

The reason is that special characters are not added to to_c_name,
causes special characters to appear in the structure name, causing
c file compilation to fail.

Broken by #12913
parent a50bbcb6
......@@ -242,7 +242,8 @@ class Argument(object):
def to_c_name(str):
return str.replace(":", "").replace(".", "_").replace("$", "_")\
.replace("^", "_").replace("*", "_").replace("-", "_")
.replace("^", "_").replace("*", "_").replace("-", "_") \
.replace("\\", "_").replace("+", "_")
class ReplySchema(object):
......@@ -285,7 +286,7 @@ class ReplySchema(object):
t = "JSON_TYPE_INTEGER"
vstr = ".value.integer=%d" % v
return "%s,\"%s\",%s" % (t, k, vstr)
return "%s,%s,%s" % (t, json.dumps(k), vstr)
for k, v in self.schema.items():
if isinstance(v, ReplySchema):
......
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