reduce the amount of memory needed to read menu.plist

This commit is contained in:
Bill Currie 2005-06-15 01:41:10 +00:00
parent 4a21eb02c5
commit 6e0c70cac7
4 changed files with 18 additions and 2 deletions

View file

@ -69,6 +69,16 @@ bi_str_copy (progs_t *pr)
R_STRING (pr) = P_STRING (pr, 0);
}
static void
bi_str_cat (progs_t *pr)
{
dstring_t *dst = P_DSTRING (pr, 0);
const char *src = P_GSTRING (pr, 1);
dstring_appendstr (dst, src);
R_STRING (pr) = P_STRING (pr, 0);
}
static void
bi_str_clear (progs_t *pr)
{
@ -121,6 +131,7 @@ static builtin_t builtins[] = {
{"str_new", bi_str_new, -1},
{"str_free", bi_str_free, -1},
{"str_copy", bi_str_copy, -1},
{"str_cat", bi_str_cat, -1},
{"str_clear", bi_str_clear, -1},
{"str_mid|*i", bi_str_mid, -1},
{"str_mid|*ii", bi_str_mid, -1},

View file

@ -275,13 +275,16 @@ PLItem read_plist (void)
{
local string plist_data, l;
local QFile file;
local PLItem plist;
file = QFS_OpenFile ("menu.plist");
plist_data = "";
plist_data = str_new ();
while ((l = Qgetline (file)))
plist_data += l;
Qclose (file);
return [PLItem newFromString:plist_data];
plist = [PLItem newFromString:plist_data];
str_free (plist_data);
return plist;
}
/*

View file

@ -14,6 +14,7 @@
@extern string (void) str_new;
@extern string (string str) str_free;
@extern string (string dst, string src) str_copy;
@extern string (string dst, string src) str_cat;
@extern string (string str) str_clear;
@extern string (string str, integer start) @overload str_mid;
@extern string (string str, integer start, integer len) @overload str_mid;

View file

@ -13,6 +13,7 @@ vector (string s) stov = #0x000f0000 + 114;
string (void) str_new = #0;
string (string str) str_free = #0;
string (string dst, string src) str_copy = #0;
string (string dst, string src) str_cat = #0;
string (string str) str_clear = #0;
string (string str, integer start) str_mid = #0;
string (string str, integer start, integer len) str_mid = #0;