mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-14 11:08:06 +00:00
remove macro indentation from code-format
This commit is contained in:
@ -45,31 +45,14 @@ def custom_format(filename):
|
||||
src, _ = p.communicate()
|
||||
src = str(src, "utf-8")
|
||||
|
||||
macro_indent = 0
|
||||
in_define = False
|
||||
last_line = None
|
||||
out = ""
|
||||
|
||||
for line in src.split("\n"):
|
||||
if line.startswith("#"):
|
||||
i = macro_indent
|
||||
if line.startswith("#end") and macro_indent > 0:
|
||||
macro_indent -= 1
|
||||
i -= 1
|
||||
elif line.startswith("#el") and macro_indent > 0:
|
||||
i -= 1
|
||||
elif line.startswith("#if") and not (line.startswith("#ifndef") and (line.endswith("_H") or line.endswith("H_"))):
|
||||
macro_indent += 1
|
||||
elif line.startswith("#define"):
|
||||
if line.startswith("#define"):
|
||||
in_define = True
|
||||
r = "#" + (i * " ") + line[1:]
|
||||
if i != 0 and line.endswith("\\"):
|
||||
r = r[:-1]
|
||||
while r[-1].isspace() and len(r) != (len(line)-1):
|
||||
r = r[:-1]
|
||||
r += "\\"
|
||||
if len(r) <= COLUMN_LIMIT:
|
||||
line = r
|
||||
|
||||
elif "/*" in line and not line.strip().startswith("/*") and line.endswith("*/") and len(line) < (COLUMN_LIMIT-2):
|
||||
cmt_start = line.rfind("/*")
|
||||
|
@ -105,18 +105,22 @@
|
||||
#define CHECK_PTR(_p) do { \
|
||||
\
|
||||
\
|
||||
\
|
||||
if (_p) { \
|
||||
\
|
||||
\
|
||||
\
|
||||
if (ALLOC_C1(_p) ^ ALLOC_MAGIC_C1) {\
|
||||
\
|
||||
\
|
||||
\
|
||||
if (ALLOC_C1(_p) == ALLOC_MAGIC_F) \
|
||||
ABORT("Use after free."); \
|
||||
else ABORT("Corrupted head alloc canary."); \
|
||||
\
|
||||
} \
|
||||
\
|
||||
\
|
||||
if (ALLOC_C2(_p) ^ ALLOC_MAGIC_C2) \
|
||||
ABORT("Corrupted tail alloc canary."); \
|
||||
\
|
||||
@ -124,7 +128,9 @@
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
} while (0)
|
||||
|
||||
*/
|
||||
|
||||
#define CHECK_PTR_EXPR(_p) \
|
||||
|
Reference in New Issue
Block a user