Skip to content

Commit

Permalink
Fix switch-case levels for Replaces and Feature-Caps header name parsing
Browse files Browse the repository at this point in the history
(cherry picked from commit 6b49736)
  • Loading branch information
bogdan-iancu committed Feb 23, 2022
1 parent 77fff20 commit 21e20da
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 40 deletions.
32 changes: 12 additions & 20 deletions parser/case_feat.h
Expand Up @@ -23,14 +23,11 @@
#ifndef CASE_FEAT_H
#define CASE_FEAT_H

#define feat_CASE \
switch(LOWER_DWORD(val)) { \
case _feat_: \
p += 4; \
val = READ(p); \
ure__CASE; \
goto other; \
}
#define feat_CASE \
p += 4; \
val = READ(p); \
ure__CASE; \
goto other; \

#define ure__CASE \
switch(LOWER_DWORD(val)) { \
Expand All @@ -41,17 +38,12 @@
goto other; \
}

#define caps_CASE \
switch(LOWER_DWORD(val)) { \
case _caps_: \
p += 4; \
if (*p == ':') { \
hdr->type = HDR_FEATURE_CAPS_T; \
hdr->name.len = 12; \
return p + 1; \
} \
p++; \
goto dc_cont; \
}
#define caps_CASE \
if (LOWER_DWORD(val) == _caps_) { \
hdr->type = HDR_FEATURE_CAPS_T; \
hdr->name.len = 12; \
p += 4; \
goto dc_cont; \
}

#endif /* CASE_FEAT_H */
32 changes: 12 additions & 20 deletions parser/case_repl.h
Expand Up @@ -23,26 +23,18 @@
#ifndef CASE_REPL_H
#define CASE_REPL_H

#define repl_CASE \
switch(LOWER_DWORD(val)) { \
case _repl_: \
p += 4; \
val = READ(p); \
aces_CASE; \
goto other; \
}
#define repl_CASE \
p += 4; \
val = READ(p); \
aces_CASE; \
goto other; \

#define aces_CASE \
switch(LOWER_DWORD(val)) { \
case _aces_: \
p += 4; \
if (*p == ':') { \
hdr->type = HDR_REPLACES_T; \
hdr->name.len = 8; \
return p + 1; \
} \
p++; \
goto dc_cont; \
}
#define aces_CASE \
if (LOWER_DWORD(val) == _aces_) { \
hdr->type = HDR_REPLACES_T; \
hdr->name.len = 8; \
p += 4; \
goto dc_cont; \
}

#endif /* CASE_REPL_H */

0 comments on commit 21e20da

Please sign in to comment.