diff options
| author | thorpej <thorpej@NetBSD.org> | 2020-06-06 21:25:59 +0000 |
|---|---|---|
| committer | thorpej <thorpej@NetBSD.org> | 2020-06-06 21:25:59 +0000 |
| commit | ca95539f7e401ecc6c3ad94f5abfe41dda98026e (patch) | |
| tree | e6aab6ce366dc8c164c0674fbd38b2d48960c29c /common/include/prop/prop_array.h | |
| parent | a3eff718210e1e35691bf2ecdb20b551dea312a3 (diff) | |
Improvements to the problib(3) API:
==> Provide a much more complete set of setters and getters for different
value types in the prop_array_util(3) and prop_dictionary_util(3)
functions.
==> Overhaul the prop_data(3), prop_number(3), and prop_string(3) APIs
to be easier to use and less awkwardly named, Deprecate the old
awkward names, and produce link-time warnings when they are referenced.
==> Deprecate mutable prop_data(3) and prop_string(3) objects. The old
APIs that support them still exist, but will now produce link-time
warnings when used.
==> When the new prop_string(3) API is used, strings are internally
de-duplicated as a memory footprint optimization.
==> Provide a rich set of bounds-checked gettter functions in and a
corresponding set of convenience setters in the prop_number(3) API.
==> Add a new prop_bool_value(3) function that is equivalent to
prop_bool_true(3), but aligned with the new "value" routines in
prop_data(3), prop_string(3), and prop_number(3).
Diffstat (limited to 'common/include/prop/prop_array.h')
| -rw-r--r-- | common/include/prop/prop_array.h | 109 |
1 files changed, 104 insertions, 5 deletions
diff --git a/common/include/prop/prop_array.h b/common/include/prop/prop_array.h index 5d1361ac1de..1b7f87f9201 100644 --- a/common/include/prop/prop_array.h +++ b/common/include/prop/prop_array.h @@ -1,7 +1,7 @@ -/* $NetBSD: prop_array.h,v 1.16 2017/01/29 02:07:44 christos Exp $ */ +/* $NetBSD: prop_array.h,v 1.17 2020/06/06 21:25:59 thorpej Exp $ */ /*- - * Copyright (c) 2006, 2009 The NetBSD Foundation, Inc. + * Copyright (c) 2006, 2009, 2020 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -101,6 +101,60 @@ bool prop_array_get_bool(prop_array_t, unsigned int, bool prop_array_set_bool(prop_array_t, unsigned int, bool); +bool prop_array_get_schar(prop_array_t, unsigned int, + signed char *); +bool prop_array_get_uchar(prop_array_t, unsigned int, + unsigned char *); +bool prop_array_set_schar(prop_array_t, unsigned int, + signed char); +bool prop_array_set_uchar(prop_array_t, unsigned int, + unsigned char); + +bool prop_array_get_short(prop_array_t, unsigned int, + short *); +bool prop_array_get_ushort(prop_array_t, unsigned int, + unsigned short *); +bool prop_array_set_short(prop_array_t, unsigned int, + short); +bool prop_array_set_ushort(prop_array_t, unsigned int, + unsigned short); + +bool prop_array_get_int(prop_array_t, unsigned int, + int *); +bool prop_array_get_uint(prop_array_t, unsigned int, + unsigned int *); +bool prop_array_set_int(prop_array_t, unsigned int, + int); +bool prop_array_set_uint(prop_array_t, unsigned int, + unsigned int); + +bool prop_array_get_long(prop_array_t, unsigned int, + long *); +bool prop_array_get_ulong(prop_array_t, unsigned int, + unsigned long *); +bool prop_array_set_long(prop_array_t, unsigned int, + long); +bool prop_array_set_ulong(prop_array_t, unsigned int, + unsigned long); + +bool prop_array_get_longlong(prop_array_t, unsigned int, + long long *); +bool prop_array_get_ulonglong(prop_array_t, unsigned int, + unsigned long long *); +bool prop_array_set_longlong(prop_array_t, unsigned int, + long long); +bool prop_array_set_ulonglong(prop_array_t, unsigned int, + unsigned long long); + +bool prop_array_get_intptr(prop_array_t, unsigned int, + intptr_t *); +bool prop_array_get_uintptr(prop_array_t, unsigned int, + uintptr_t *); +bool prop_array_set_intptr(prop_array_t, unsigned int, + intptr_t); +bool prop_array_set_uintptr(prop_array_t, unsigned int, + uintptr_t); + bool prop_array_get_int8(prop_array_t, unsigned int, int8_t *); bool prop_array_get_uint8(prop_array_t, unsigned int, @@ -137,6 +191,29 @@ bool prop_array_set_int64(prop_array_t, unsigned int, bool prop_array_set_uint64(prop_array_t, unsigned int, uint64_t); +bool prop_array_set_and_rel(prop_array_t, unsigned int, + prop_object_t); + +bool prop_array_add_bool(prop_array_t, bool); + +bool prop_array_add_schar(prop_array_t, signed char); +bool prop_array_add_uchar(prop_array_t, unsigned char); + +bool prop_array_add_short(prop_array_t, short); +bool prop_array_add_ushort(prop_array_t, unsigned short); + +bool prop_array_add_int(prop_array_t, int); +bool prop_array_add_uint(prop_array_t, unsigned int); + +bool prop_array_add_long(prop_array_t, long); +bool prop_array_add_ulong(prop_array_t, unsigned long); + +bool prop_array_add_longlong(prop_array_t, long long); +bool prop_array_add_ulonglong(prop_array_t, unsigned long long); + +bool prop_array_add_intptr(prop_array_t, intptr_t); +bool prop_array_add_uintptr(prop_array_t, uintptr_t); + bool prop_array_add_int8(prop_array_t, int8_t); bool prop_array_add_uint8(prop_array_t, uint8_t); @@ -149,6 +226,31 @@ bool prop_array_add_uint32(prop_array_t, uint32_t); bool prop_array_add_int64(prop_array_t, int64_t); bool prop_array_add_uint64(prop_array_t, uint64_t); +bool prop_array_get_string(prop_array_t, unsigned int, + const char **); +bool prop_array_set_string(prop_array_t, unsigned int, + const char *); +bool prop_array_add_string(prop_array_t, const char *); +bool prop_array_set_string_nocopy(prop_array_t, unsigned int, + const char *); +bool prop_array_add_string_nocopy(prop_array_t, const char *); + +bool prop_array_get_data(prop_array_t, unsigned int, + const void **, size_t *); +bool prop_array_set_data(prop_array_t, unsigned int, + const void *, size_t); +bool prop_array_add_data(prop_array_t, + const void *, size_t); +bool prop_array_set_data_nocopy(prop_array_t, unsigned int, + const void *, size_t); +bool prop_array_add_data_nocopy(prop_array_t, + const void *, size_t); + +bool prop_array_add_and_rel(prop_array_t, prop_object_t); + + +/* Deprecated functions. */ + bool prop_array_add_cstring(prop_array_t, const char *); bool prop_array_get_cstring(prop_array_t, unsigned int, char **); @@ -162,9 +264,6 @@ bool prop_array_get_cstring_nocopy(prop_array_t, bool prop_array_set_cstring_nocopy(prop_array_t, unsigned int, const char *); - -bool prop_array_add_and_rel(prop_array_t, prop_object_t); - __END_DECLS #endif /* _PROPLIB_PROP_ARRAY_H_ */ |
