mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
get the behavior or PL_NewData correct
It taking ownership of the data was the correct behavior, so go back to that.
This commit is contained in:
parent
a744caa421
commit
fd24170b32
2 changed files with 5 additions and 5 deletions
|
@ -232,12 +232,13 @@ plitem_t *PL_NewDictionary (void);
|
|||
plitem_t *PL_NewArray (void);
|
||||
|
||||
/** Create a new data object from the given data.
|
||||
Makes a copy of the given data.
|
||||
Takes ownership of the given data.
|
||||
\param data pointer to data buffer
|
||||
\param size number of bytes in the buffer
|
||||
\return the new dictionary object
|
||||
\note The data will be freed via free() when the item is freed.
|
||||
*/
|
||||
plitem_t *PL_NewData (void *data, int size);
|
||||
plitem_t *PL_NewData (void *data, size_t size);
|
||||
|
||||
/** Create a new string object.
|
||||
Makes a copy of the given string.
|
||||
|
|
|
@ -164,13 +164,12 @@ PL_NewArray (void)
|
|||
}
|
||||
|
||||
VISIBLE plitem_t *
|
||||
PL_NewData (void *data, int size)
|
||||
PL_NewData (void *data, size_t size)
|
||||
{
|
||||
plitem_t *item = PL_NewItem (QFBinary);
|
||||
plbinary_t *bin = malloc (sizeof (plbinary_t));
|
||||
item->data = bin;
|
||||
bin->data = malloc (size);
|
||||
memcpy (bin->data, data, size);
|
||||
bin->data = data;
|
||||
bin->size = size;
|
||||
return item;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue