utils: remove tal_tmpctx altogether, use global.

In particular, we now only free tmpctx at the end of main().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-03-15 16:40:20 +10:30
parent 40fe5b7bac
commit 0a6e3d1e13
45 changed files with 115 additions and 375 deletions

View File

@@ -77,7 +77,7 @@ REGISTER_TYPE_TO_STRING(wireaddr, fmt_wireaddr);
* Returns false if it wasn't one of these forms. If it returns true,
* it only overwrites *port if it was specified by <number> above.
*/
static bool separate_address_and_port(tal_t *ctx, const char *arg,
static bool separate_address_and_port(const tal_t *ctx, const char *arg,
char **addr, u16 *port)
{
char *portcolon;
@@ -126,7 +126,6 @@ bool parse_wireaddr(const char *arg, struct wireaddr *addr, u16 defport,
u16 port;
char *ip;
bool res;
tal_t *tmpctx = tal_tmpctx(NULL);
res = false;
port = defport;
@@ -195,6 +194,5 @@ bool parse_wireaddr(const char *arg, struct wireaddr *addr, u16 defport,
finish:
if (!res && err_msg && !*err_msg)
*err_msg = "Error parsing hostname";
tal_free(tmpctx);
return res;
}