diff options
| author | haad <haad@NetBSD.org> | 2008-09-11 13:15:13 +0000 |
|---|---|---|
| committer | haad <haad@NetBSD.org> | 2008-09-11 13:15:13 +0000 |
| commit | 185aec71feb2d8fa2998c90505f1ed7a33d958a6 (patch) | |
| tree | 9bde16d8bd2017a97690ba022c8bf76f4c7e110c /common/lib/libprop/prop_array_util.c | |
| parent | d3595ddff7cedd713010f6665011cfe0fae314ea (diff) | |
Add prop_array_add_int* and prop_array_add_uint* functions. These functions
can be used to append specified type to the end of prop_array_t.
Ok'ed by @joerg.
Diffstat (limited to 'common/lib/libprop/prop_array_util.c')
| -rw-r--r-- | common/lib/libprop/prop_array_util.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/common/lib/libprop/prop_array_util.c b/common/lib/libprop/prop_array_util.c index 791bcaf4075..c7951cca04a 100644 --- a/common/lib/libprop/prop_array_util.c +++ b/common/lib/libprop/prop_array_util.c @@ -1,4 +1,4 @@ -/* $NetBSD: prop_array_util.c,v 1.1 2008/06/03 20:18:24 haad Exp $ */ +/* $NetBSD: prop_array_util.c,v 1.2 2008/09/11 13:15:13 haad Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -159,6 +159,38 @@ prop_array_set_uint ## size (prop_array_t array, \ prop_object_release(num); \ \ return (rv); \ +} \ + \ +bool \ +prop_array_add_int ## size (prop_array_t array, \ + int ## size ## _t val) \ +{ \ + prop_number_t num; \ + int rv; \ + \ + num = prop_number_create_integer((int64_t) val); \ + if (num == NULL) \ + return (false); \ + rv = prop_array_add(array, num); \ + prop_object_release(num); \ + \ + return (rv); \ +} \ + \ +bool \ +prop_array_add_uint ## size (prop_array_t array, \ + uint ## size ## _t val) \ +{ \ + prop_number_t num; \ + int rv; \ + \ + num = prop_number_create_integer((int64_t) val); \ + if (num == NULL) \ + return (false); \ + rv = prop_array_add(array, num); \ + prop_object_release(num); \ + \ + return (rv); \ } TEMPLATE(8) |
