mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-20 10:43:29 +00:00
fix some sillies with QFS_FileList
Use dynamic strings instead of temp strings for the list
This commit is contained in:
parent
6eae016d3e
commit
ff61dbb329
2 changed files with 13 additions and 4 deletions
|
@ -165,17 +165,23 @@ bi_QFS_Filelist (progs_t *pr)
|
|||
|
||||
list = PR_Zone_Malloc (pr, sizeof (list) + filelist->count * 4);
|
||||
list->count = filelist->count;
|
||||
strings = (string_t *) list + 1;
|
||||
strings = (string_t *) (list + 1);
|
||||
list->list = PR_SetPointer (pr, strings);
|
||||
for (i = 0; i < filelist->count; i++)
|
||||
strings[i] = PR_SetTempString (pr, filelist->list[i]);
|
||||
strings[i] = PR_SetDynamicString (pr, filelist->list[i]);
|
||||
RETURN_POINTER (pr, list);
|
||||
}
|
||||
|
||||
static void
|
||||
bi_QFS_FilelistFree (progs_t *pr)
|
||||
{
|
||||
PR_Zone_Free (pr, P_GPOINTER (pr, 0));
|
||||
qfslist_t *list = &P_STRUCT (pr, qfslist_t, 0);
|
||||
string_t *strings = &G_STRUCT (pr, string_t, list->list);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < list->count; i++)
|
||||
PR_FreeString (pr, strings[i]);
|
||||
PR_Zone_Free (pr, list);
|
||||
}
|
||||
|
||||
static builtin_t builtins[] = {
|
||||
|
|
|
@ -3,7 +3,10 @@
|
|||
|
||||
#include "qfile.h"
|
||||
|
||||
struct _qfslist_t = {};
|
||||
struct _qfslist_t = {
|
||||
integer count;
|
||||
string []list;
|
||||
};
|
||||
typedef struct _qfslist_t [] QFSlist;
|
||||
|
||||
@extern QFile (string path, string mode) QFS_Open;
|
||||
|
|
Loading…
Reference in a new issue