summaryrefslogtreecommitdiffstats
path: root/src/plist.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2019-11-07 04:54:45 +0100
committerGravatar Nikias Bassen2019-11-07 04:54:45 +0100
commit49cbc8df7672c4dd5fa0c73e9046ee91924ae4b8 (patch)
treebc339ae6a11d149538d0a82af105bb73a86b6e17 /src/plist.c
parent4d4586903b4cbab8b307a406e894e34b4b19a723 (diff)
downloadlibplist-49cbc8df7672c4dd5fa0c73e9046ee91924ae4b8.tar.gz
libplist-49cbc8df7672c4dd5fa0c73e9046ee91924ae4b8.tar.bz2
Add plist_get_data_ptr() and plist_get_string_ptr() to the interface
Diffstat (limited to 'src/plist.c')
-rw-r--r--src/plist.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/plist.c b/src/plist.c
index eb0160c..87be488 100644
--- a/src/plist.c
+++ b/src/plist.c
@@ -868,6 +868,19 @@ PLIST_API void plist_get_string_val(plist_t node, char **val)
assert(length == strlen(*val));
}
+PLIST_API const char* plist_get_string_ptr(plist_t node, uint64_t* length)
+{
+ if (!node)
+ return NULL;
+ plist_type type = plist_get_node_type(node);
+ if (PLIST_STRING != type)
+ return NULL;
+ plist_data_t data = plist_get_data(node);
+ if (length)
+ *length = data->length;
+ return (const char*)data->strval;
+}
+
PLIST_API void plist_get_bool_val(plist_t node, uint8_t * val)
{
if (!node || !val)
@@ -926,6 +939,18 @@ PLIST_API void plist_get_data_val(plist_t node, char **val, uint64_t * length)
plist_get_type_and_value(node, &type, (void *) val, length);
}
+PLIST_API const char* plist_get_data_ptr(plist_t node, uint64_t* length)
+{
+ if (!node || !length)
+ return NULL;
+ plist_type type = plist_get_node_type(node);
+ if (PLIST_DATA != type)
+ return NULL;
+ plist_data_t data = plist_get_data(node);
+ *length = data->length;
+ return (const char*)data->buff;
+}
+
PLIST_API void plist_get_date_val(plist_t node, int32_t * sec, int32_t * usec)
{
if (!node)