Skip to content

Commit

Permalink
Merge bitcoin-core/secp256k1#1286: tests: remove extra semicolon in m…
Browse files Browse the repository at this point in the history
…acro

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
  • Loading branch information
real-or-random committed Apr 25, 2023
2 parents 1f33bb2 + c4062d6 commit 1c89536
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
19 changes: 0 additions & 19 deletions src/tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,6 @@ static int all_bytes_equal(const void* s, unsigned char value, size_t n) {
return 1;
}

/* Debug helper for printing arrays of unsigned char. */
#define PRINT_BUF(buf, len) do { \
printf("%s[%lu] = ", #buf, (unsigned long)len); \
print_buf_plain(buf, len); \
} while(0);
static void print_buf_plain(const unsigned char *buf, size_t len) {
size_t i;
printf("{");
for (i = 0; i < len; i++) {
if (i % 8 == 0) {
printf("\n ");
} else {
printf(" ");
}
printf("0x%02X,", buf[i]);
}
printf("\n}\n");
}

/* TODO Use CHECK_ILLEGAL(_VOID) everywhere and get rid of the uncounting callback */
/* CHECK that expr_or_stmt calls the illegal callback of ctx exactly once
*
Expand Down
20 changes: 20 additions & 0 deletions src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,26 @@
#define DEBUG_CONFIG_MSG(x) "DEBUG_CONFIG: " x
#define DEBUG_CONFIG_DEF(x) DEBUG_CONFIG_MSG(#x "=" STR(x))

/* Debug helper for printing arrays of unsigned char. */
#define PRINT_BUF(buf, len) do { \
printf("%s[%lu] = ", #buf, (unsigned long)len); \
print_buf_plain(buf, len); \
} while(0)

static void print_buf_plain(const unsigned char *buf, size_t len) {
size_t i;
printf("{");
for (i = 0; i < len; i++) {
if (i % 8 == 0) {
printf("\n ");
} else {
printf(" ");
}
printf("0x%02X,", buf[i]);
}
printf("\n}\n");
}

# if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) )
# if SECP256K1_GNUC_PREREQ(2,7)
# define SECP256K1_INLINE __inline__
Expand Down

0 comments on commit 1c89536

Please sign in to comment.