[util] Make plists more const-correct

This commit is contained in:
Bill Currie 2021-02-25 11:55:25 +09:00
parent f8961e4376
commit 4eb07220cd
3 changed files with 8 additions and 8 deletions

View file

@ -132,7 +132,7 @@ plitem_t *PL_GetPropertyList (const char *string,
\return the text representation of the property list \return the text representation of the property list
\note You are responsible for freeing the returned string. \note You are responsible for freeing the returned string.
*/ */
char *PL_WritePropertyList (plitem_t *pl); char *PL_WritePropertyList (const plitem_t *pl);
/** Retrieve the type of an object. /** Retrieve the type of an object.
@ -226,7 +226,7 @@ plitem_t *PL_ObjectAtIndex (const plitem_t *array, int index) __attribute__((pur
\return an Array containing Strings or NULL if dict isn't a dictionary \return an Array containing Strings or NULL if dict isn't a dictionary
\note You are responsible for freeing this array. \note You are responsible for freeing this array.
*/ */
plitem_t *PL_D_AllKeys (plitem_t *dict); plitem_t *PL_D_AllKeys (const plitem_t *dict);
/** Retrieve the number of keys in a dictionary. /** Retrieve the number of keys in a dictionary.
@ -265,7 +265,7 @@ qboolean PL_A_AddObject (plitem_t *array, plitem_t *item);
\return number of objects in the array \return number of objects in the array
*/ */
int PL_A_NumObjects (plitem_t *array) __attribute__((pure)); int PL_A_NumObjects (const plitem_t *array) __attribute__((pure));
/** Insert an item into an array before the specified location. /** Insert an item into an array before the specified location.

View file

@ -501,7 +501,7 @@ ED_Parse (progs_t *pr, const char *data)
// new style (plist) entity data // new style (plist) entity data
entity_list = PL_GetPropertyList (data, pr->hashlink_freelist); entity_list = PL_GetPropertyList (data, pr->hashlink_freelist);
} else { } else {
// oldstyle entity data // old style entity data
Script_UngetToken (script); Script_UngetToken (script);
entity_list = ED_ConvertToPlist (script, 0, pr->hashlink_freelist); entity_list = ED_ConvertToPlist (script, 0, pr->hashlink_freelist);
} }

View file

@ -330,7 +330,7 @@ PL_RemoveObjectForKey (const plitem_t *item, const char *key)
} }
VISIBLE plitem_t * VISIBLE plitem_t *
PL_D_AllKeys (plitem_t *item) PL_D_AllKeys (const plitem_t *item)
{ {
pldict_t *dict = (pldict_t *) item->data; pldict_t *dict = (pldict_t *) item->data;
dictkey_t *current; dictkey_t *current;
@ -440,7 +440,7 @@ PL_A_AddObject (plitem_t *array, plitem_t *item)
} }
VISIBLE int VISIBLE int
PL_A_NumObjects (plitem_t *array) PL_A_NumObjects (const plitem_t *array)
{ {
if (array->type != QFArray) if (array->type != QFArray)
return 0; return 0;
@ -1056,7 +1056,7 @@ write_string (dstring_t *dstr, const char *str)
} }
static void static void
write_item (dstring_t *dstr, plitem_t *item, int level) write_item (dstring_t *dstr, const plitem_t *item, int level)
{ {
dictkey_t *current; dictkey_t *current;
plarray_t *array; plarray_t *array;
@ -1107,7 +1107,7 @@ write_item (dstring_t *dstr, plitem_t *item, int level)
} }
VISIBLE char * VISIBLE char *
PL_WritePropertyList (plitem_t *pl) PL_WritePropertyList (const plitem_t *pl)
{ {
dstring_t *dstr = dstring_newstr (); dstring_t *dstr = dstring_newstr ();