Skip to content

Commit

Permalink
kvlist: support uint64_t
Browse files Browse the repository at this point in the history
Signed-off-by: Takahiro Yamashita <[email protected]>
  • Loading branch information
nokute78 authored and leonardo-albertovich committed May 21, 2023
1 parent 6cc13e6 commit 365470d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/cfl/cfl_kvlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ int cfl_kvlist_insert_bool(struct cfl_kvlist *list,
int cfl_kvlist_insert_int64(struct cfl_kvlist *list,
char *key, int64_t value);

int cfl_kvlist_insert_uint64(struct cfl_kvlist *list,
char *key, uint64_t value);

int cfl_kvlist_insert_double(struct cfl_kvlist *list,
char *key, double value);

Expand Down
23 changes: 23 additions & 0 deletions src/cfl_kvlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,29 @@ int cfl_kvlist_insert_int64(struct cfl_kvlist *list,
return 0;
}

int cfl_kvlist_insert_uint64(struct cfl_kvlist *list,
char *key, uint64_t value)
{
struct cfl_variant *value_instance;
int result;

value_instance = cfl_variant_create_from_uint64(value);

if (value_instance == NULL) {
return -1;
}

result = cfl_kvlist_insert(list, key, value_instance);

if (result) {
cfl_variant_destroy(value_instance);

return -2;
}

return 0;
}

int cfl_kvlist_insert_double(struct cfl_kvlist *list,
char *key, double value)
{
Expand Down

0 comments on commit 365470d

Please sign in to comment.