From 48f7702bd6d91ecafb34e10bd3f79e517c1b7458 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sat, 14 Feb 2015 11:15:45 +1100 Subject: [PATCH] Add json_getdel_int64 helper --- src/ckpool.c | 10 ++++++++++ src/ckpool.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/ckpool.c b/src/ckpool.c index 06fddd1e..1e51d664 100644 --- a/src/ckpool.c +++ b/src/ckpool.c @@ -1061,6 +1061,16 @@ bool json_getdel_int(int *store, json_t *val, const char *res) return ret; } +bool json_getdel_int64(int64_t *store, json_t *val, const char *res) +{ + bool ret; + + ret = json_get_int64(store, val, res); + if (ret) + json_object_del(val, res); + return ret; +} + static void parse_btcds(ckpool_t *ckp, const json_t *arr_val, const int arr_size) { json_t *val; diff --git a/src/ckpool.h b/src/ckpool.h index 97fb27f7..48687646 100644 --- a/src/ckpool.h +++ b/src/ckpool.h @@ -228,5 +228,6 @@ bool json_get_int(int *store, const json_t *val, const char *res); bool json_get_double(double *store, const json_t *val, const char *res); bool json_get_bool(bool *store, const json_t *val, const char *res); bool json_getdel_int(int *store, json_t *val, const char *res); +bool json_getdel_int64(int64_t *store, json_t *val, const char *res); #endif /* CKPOOL_H */