mirror of
https://github.com/redis/redis.git
synced 2026-05-28 04:02:46 -04:00
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
This commit is contained in:
parent
a50bbcb656
commit
df75153d79
1 changed files with 3 additions and 2 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Reference in a new issue