Skip to content

Commit 1c89536

Browse files
Merge #1286: tests: remove extra semicolon in macro
c4062d6 debug: move helper for printing buffers into util.h (Jonas Nick) 3858bad tests: remove extra semicolon in macro (Jonas Nick) Pull request description: ACKs for top commit: real-or-random: utACK c4062d6 hebasto: ACK c4062d6, I have reviewed the code and it looks OK. Tree-SHA512: a2c97433d82c1ab2ba976c4fd8aaf337de5f225abcd459e84dcdab689e77e43d4ed654c971ab7f11f27af12e7a744122a0fdd9ece8e635d7a7041c45e9484de8
2 parents 1f33bb2 + c4062d6 commit 1c89536

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

src/tests.c

-19
Original file line numberDiff line numberDiff line change
@@ -44,25 +44,6 @@ static int all_bytes_equal(const void* s, unsigned char value, size_t n) {
4444
return 1;
4545
}
4646

47-
/* Debug helper for printing arrays of unsigned char. */
48-
#define PRINT_BUF(buf, len) do { \
49-
printf("%s[%lu] = ", #buf, (unsigned long)len); \
50-
print_buf_plain(buf, len); \
51-
} while(0);
52-
static void print_buf_plain(const unsigned char *buf, size_t len) {
53-
size_t i;
54-
printf("{");
55-
for (i = 0; i < len; i++) {
56-
if (i % 8 == 0) {
57-
printf("\n ");
58-
} else {
59-
printf(" ");
60-
}
61-
printf("0x%02X,", buf[i]);
62-
}
63-
printf("\n}\n");
64-
}
65-
6647
/* TODO Use CHECK_ILLEGAL(_VOID) everywhere and get rid of the uncounting callback */
6748
/* CHECK that expr_or_stmt calls the illegal callback of ctx exactly once
6849
*

src/util.h

+20
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,26 @@
1919
#define DEBUG_CONFIG_MSG(x) "DEBUG_CONFIG: " x
2020
#define DEBUG_CONFIG_DEF(x) DEBUG_CONFIG_MSG(#x "=" STR(x))
2121

22+
/* Debug helper for printing arrays of unsigned char. */
23+
#define PRINT_BUF(buf, len) do { \
24+
printf("%s[%lu] = ", #buf, (unsigned long)len); \
25+
print_buf_plain(buf, len); \
26+
} while(0)
27+
28+
static void print_buf_plain(const unsigned char *buf, size_t len) {
29+
size_t i;
30+
printf("{");
31+
for (i = 0; i < len; i++) {
32+
if (i % 8 == 0) {
33+
printf("\n ");
34+
} else {
35+
printf(" ");
36+
}
37+
printf("0x%02X,", buf[i]);
38+
}
39+
printf("\n}\n");
40+
}
41+
2242
# if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) )
2343
# if SECP256K1_GNUC_PREREQ(2,7)
2444
# define SECP256K1_INLINE __inline__

0 commit comments

Comments
 (0)