secp256k1-sys: update util.h patch to delete more stdio code

Fixes #734
This commit is contained in:
Andrew Poelstra 2024-09-10 16:11:53 +00:00
parent c61dea914f
commit b66bae7d5b
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
2 changed files with 24 additions and 22 deletions

View File

@ -11,7 +11,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h>
#include <limits.h> #include <limits.h>
#define STR_(x) #x #define STR_(x) #x
@ -19,26 +18,6 @@
#define DEBUG_CONFIG_MSG(x) "DEBUG_CONFIG: " x #define DEBUG_CONFIG_MSG(x) "DEBUG_CONFIG: " x
#define DEBUG_CONFIG_DEF(x) DEBUG_CONFIG_MSG(#x "=" STR(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 (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) )
# if SECP256K1_GNUC_PREREQ(2,7) # if SECP256K1_GNUC_PREREQ(2,7)
# define SECP256K1_INLINE __inline__ # define SECP256K1_INLINE __inline__

View File

@ -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); < void *ret = malloc(size);
< if (ret == NULL) { < if (ret == NULL) {
< secp256k1_callback_call(cb, "Out of memory"); < secp256k1_callback_call(cb, "Out of memory");