From be8393f201c56f57096f299378aa927de42d3a7b Mon Sep 17 00:00:00 2001 From: Kuang-che Wu Date: Sat, 12 Apr 2025 15:38:20 +0000 Subject: [PATCH] fix in_define in .custom-format.py avoid the extra \ before #define line --- .custom-format.py | 7 +++---- include/xxhash.h | 2 +- src/afl-common.c | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.custom-format.py b/.custom-format.py index e787df28..e7e2892b 100755 --- a/.custom-format.py +++ b/.custom-format.py @@ -86,9 +86,10 @@ def custom_format(filename): out = "" for line in src.split("\n"): + define_start = False if line.lstrip().startswith("#"): if line[line.find("#") + 1:].lstrip().startswith("define"): - in_define = True + define_start = True if ( "/*" in line @@ -126,9 +127,7 @@ def custom_format(filename): and last_line.strip() != "" ): line = (" " * define_padding + "\\" if in_define else "") + "\n" + line - - if not line.endswith("\\"): - in_define = False + in_define = (define_start or in_define) and line.endswith("\\") out += line + "\n" last_line = line diff --git a/include/xxhash.h b/include/xxhash.h index 72044177..59abd0e9 100644 --- a/include/xxhash.h +++ b/include/xxhash.h @@ -3169,7 +3169,7 @@ static xxh_u32 XXH32_avalanche(xxh_u32 hash) { */ static XXH_PUREF xxh_u32 XXH32_finalize(xxh_u32 hash, const xxh_u8 *ptr, size_t len, XXH_alignment align) { -\ + #define XXH_PROCESS1 \ do { \ \ diff --git a/src/afl-common.c b/src/afl-common.c index 059d14d3..736c9f3d 100644 --- a/src/afl-common.c +++ b/src/afl-common.c @@ -1004,7 +1004,7 @@ inline u64 get_cur_time_us(void) { Will return buf for convenience. */ u8 *stringify_int(u8 *buf, size_t len, u64 val) { -\ + #define CHK_FORMAT(_divisor, _limit_mult, _fmt, _cast) \ do { \ \ @@ -1168,7 +1168,7 @@ u8 *stringify_time_diff(u8 *buf, size_t len, u64 cur_ms, u64 event_ms) { Will return buf for convenience. */ u8 *u_stringify_int(u8 *buf, u64 val) { -\ + #define CHK_FORMAT(_divisor, _limit_mult, _fmt, _cast) \ do { \ \