From a408fd40daacb4b15cfc2ee7d67defde3951c199 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 9 Feb 2021 14:56:48 +0900 Subject: [PATCH] [util] Make plist more const-correct --- include/QF/qfplist.h | 8 ++++---- libs/util/qfplist.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/QF/qfplist.h b/include/QF/qfplist.h index 5de86d05f..89cb00a85 100644 --- a/include/QF/qfplist.h +++ b/include/QF/qfplist.h @@ -185,7 +185,7 @@ const char *PL_String (const plitem_t *string) __attribute__((pure)); \note You are NOT responsible for freeing the returned object. It will be destroyed when its container is. */ -plitem_t *PL_ObjectForKey (plitem_t *dict, const char *key); +plitem_t *PL_ObjectForKey (const plitem_t *dict, const char *key); /** Remove a value from a dictionary object. @@ -195,7 +195,7 @@ plitem_t *PL_ObjectForKey (plitem_t *dict, const char *key); isn't a dictionary. \note You are responsible for freeing the returned object. */ -plitem_t *PL_RemoveObjectForKey (plitem_t *dict, const char *key); +plitem_t *PL_RemoveObjectForKey (const plitem_t *dict, const char *key); /** Retrieve a value from an array object. @@ -206,7 +206,7 @@ plitem_t *PL_RemoveObjectForKey (plitem_t *dict, const char *key); \note You are NOT responsible for freeing the returned object. It will be destroyed when its container is. */ -plitem_t *PL_ObjectAtIndex (plitem_t *array, int index) __attribute__((pure)); +plitem_t *PL_ObjectAtIndex (const plitem_t *array, int index) __attribute__((pure)); /** Retrieve a list of all keys in a dictionary. @@ -222,7 +222,7 @@ plitem_t *PL_D_AllKeys (plitem_t *dict); \return Returns the number of keys in the dictionary. */ -int PL_D_NumKeys (plitem_t *dict) __attribute__((pure)); +int PL_D_NumKeys (const plitem_t *dict) __attribute__((pure)); /** Add a key/value pair to a dictionary. diff --git a/libs/util/qfplist.c b/libs/util/qfplist.c index 9d4a7b2bf..b40fec69a 100644 --- a/libs/util/qfplist.c +++ b/libs/util/qfplist.c @@ -264,7 +264,7 @@ PL_String (const plitem_t *string) } VISIBLE plitem_t * -PL_ObjectForKey (plitem_t *dict, const char *key) +PL_ObjectForKey (const plitem_t *dict, const char *key) { hashtab_t *table = (hashtab_t *) dict->data; dictkey_t *k; @@ -277,7 +277,7 @@ PL_ObjectForKey (plitem_t *dict, const char *key) } VISIBLE plitem_t * -PL_RemoveObjectForKey (plitem_t *dict, const char *key) +PL_RemoveObjectForKey (const plitem_t *dict, const char *key) { hashtab_t *table = (hashtab_t *) dict->data; dictkey_t *k; @@ -320,7 +320,7 @@ PL_D_AllKeys (plitem_t *dict) } VISIBLE int -PL_D_NumKeys (plitem_t *dict) +PL_D_NumKeys (const plitem_t *dict) { if (dict->type != QFDictionary) return 0; @@ -328,7 +328,7 @@ PL_D_NumKeys (plitem_t *dict) } VISIBLE plitem_t * -PL_ObjectAtIndex (plitem_t *array, int index) +PL_ObjectAtIndex (const plitem_t *array, int index) { plarray_t *arr = (plarray_t *) array->data;