Browse Source

common/json: Add json_add_double.

ppa-0.6.1
ZmnSCPxj 7 years ago
committed by Christian Decker
parent
commit
e1284b1df1
  1. 5
      common/json.c
  2. 3
      common/json.h

5
common/json.c

@ -411,6 +411,11 @@ void json_add_snum(struct json_result *result, const char *fieldname, int value)
json_start_member(result, fieldname);
result_append_fmt(result, "%d", value);
}
void json_add_double(struct json_result *result, const char *fieldname, double value)
{
json_start_member(result, fieldname);
result_append_fmt(result, "%f", value);
}
void json_add_u64(struct json_result *result, const char *fieldname,
uint64_t value)

3
common/json.h

@ -90,6 +90,9 @@ void json_add_literal(struct json_result *result, const char *fieldname,
void json_add_snum(struct json_result *result, const char *fieldname,
int value);
/* '"fieldname" : value' or 'value' if fieldname is NULL */
void json_add_double(struct json_result *result, const char *fieldname,
double value);
/* '"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 */

Loading…
Cancel
Save