Browse Source

Add helper to set a json integer and then delete its entry from the json

master
Con Kolivas 10 years ago
parent
commit
40b10ee2ba
  1. 10
      src/ckpool.c
  2. 1
      src/ckpool.h

10
src/ckpool.c

@ -1051,6 +1051,16 @@ out:
return ret;
}
bool json_getdel_int(int *store, json_t *val, const char *res)
{
bool ret;
ret = json_get_int(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;

1
src/ckpool.h

@ -227,5 +227,6 @@ bool json_get_int64(int64_t *store, const json_t *val, const char *res);
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);
#endif /* CKPOOL_H */

Loading…
Cancel
Save