mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
lightning-cli: use tal_arr for toks again.
We moved to raw malloc to detect OOM, but json_tok_remove wants a tal array. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -14,9 +14,6 @@ int test_connect(int sockfd, const struct sockaddr *addr,
|
||||
socklen_t addrlen);
|
||||
int test_getpid(void);
|
||||
int test_printf(const char *format, ...);
|
||||
void *test_malloc(size_t n);
|
||||
void *test_realloc(void *p, size_t n);
|
||||
void test_free(void *p);
|
||||
|
||||
#define main test_main
|
||||
#define read test_read
|
||||
@@ -24,9 +21,6 @@ void test_free(void *p);
|
||||
#define connect test_connect
|
||||
#define getpid test_getpid
|
||||
#define printf test_printf
|
||||
#define malloc test_malloc
|
||||
#define realloc test_realloc
|
||||
#define free test_free
|
||||
|
||||
#include "../lightning-cli.c"
|
||||
#undef main
|
||||
@@ -62,22 +56,6 @@ int test_printf(const char *fmt UNUSED, ...)
|
||||
static char *response;
|
||||
static size_t response_off, max_read_return;
|
||||
|
||||
void *test_malloc(size_t n)
|
||||
{
|
||||
return tal_arr(response, u8, n);
|
||||
}
|
||||
|
||||
void *test_realloc(void *p, size_t n)
|
||||
{
|
||||
tal_resize(&p, n);
|
||||
return p;
|
||||
}
|
||||
|
||||
void test_free(void *p)
|
||||
{
|
||||
tal_free(p);
|
||||
}
|
||||
|
||||
ssize_t test_read(int fd UNUSED, void *buf, size_t len)
|
||||
{
|
||||
if (len > max_read_return)
|
||||
|
||||
Reference in New Issue
Block a user