Skip to content

Commit

Permalink
Merge rust-bitcoin#735: secp256k1-sys: update util.h patch to delete …
Browse files Browse the repository at this point in the history
…more stdio code

b66bae7 secp256k1-sys: update util.h patch to delete more stdio code (Andrew Poelstra)

Pull request description:

  Fixes rust-bitcoin#734

ACKs for top commit:
  Kixunil:
    ACK b66bae7

Tree-SHA512: 8d1266a1decbd06055922a19d687ec1e616dcf8a21764386c73cc8e20d390c9bc5a6ca416a3dc2602cc8ad7a5641f1af8607d3f64291325b2b2fff343677bc82
  • Loading branch information
apoelstra committed Sep 10, 2024
2 parents c61dea9 + b66bae7 commit 18654c3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 22 deletions.
21 changes: 0 additions & 21 deletions secp256k1-sys/depend/secp256k1/src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,13 @@

#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <limits.h>

#define STR_(x) #x
#define STR(x) STR_(x)
#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
25 changes: 24 additions & 1 deletion secp256k1-sys/depend/util.h.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
148,152c148,150
14d13
< #include <stdio.h>
22,41d20
< /* 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");
< }
<
148,152c127,129
< void *ret = malloc(size);
< if (ret == NULL) {
< secp256k1_callback_call(cb, "Out of memory");
Expand Down

0 comments on commit 18654c3

Please sign in to comment.