mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 18:11:28 +01:00
json: routine to create a uint64_t field.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
725512fb03
commit
aed857a30c
@ -6,6 +6,7 @@
|
||||
#include <ccan/tal/str/str.h>
|
||||
#include <ccan/tal/tal.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@ -357,6 +358,13 @@ void json_add_num(struct json_result *result, const char *fieldname, unsigned in
|
||||
result_append_fmt(result, "%u", value);
|
||||
}
|
||||
|
||||
void json_add_u64(struct json_result *result, const char *fieldname,
|
||||
uint64_t value)
|
||||
{
|
||||
json_start_member(result, fieldname);
|
||||
result_append_fmt(result, "%"PRIu64, value);
|
||||
}
|
||||
|
||||
void json_add_literal(struct json_result *result, const char *fieldname,
|
||||
const char *literal, int len)
|
||||
{
|
||||
|
@ -81,6 +81,9 @@ void json_add_literal(struct json_result *result, const char *fieldname,
|
||||
/* '"fieldname" : value' or 'value' if fieldname is NULL */
|
||||
void json_add_num(struct json_result *result, const char *fieldname,
|
||||
unsigned int value);
|
||||
/* '"fieldname" : value' or 'value' if fieldname is NULL */
|
||||
void json_add_u64(struct json_result *result, const char *fieldname,
|
||||
uint64_t value);
|
||||
/* '"fieldname" : true|false' or 'true|false' if fieldname is NULL */
|
||||
void json_add_bool(struct json_result *result, const char *fieldname,
|
||||
bool value);
|
||||
|
Loading…
Reference in New Issue
Block a user