mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
heh, turned out that didn't hurt overkill as much as I thought, but this
gives it a tiny boost (and will help more in the more alias heavy mods).
This commit is contained in:
parent
3c06cd5620
commit
8be15a16e6
1 changed files with 10 additions and 5 deletions
|
@ -480,11 +480,10 @@ Cmd_TokenizeString (const char *text)
|
||||||
static char *argv_buf;
|
static char *argv_buf;
|
||||||
static size_t argv_buf_size;
|
static size_t argv_buf_size;
|
||||||
int argv_idx;
|
int argv_idx;
|
||||||
size_t len = strlen (text) + 1;
|
|
||||||
|
|
||||||
if (len > argv_buf_size) {
|
if (!argv_buf_size) {
|
||||||
argv_buf_size = (len + 1023) & ~1023;
|
argv_buf_size = 1024; //FIXME dynamic
|
||||||
argv_buf = realloc (argv_buf, argv_buf_size);
|
argv_buf = malloc (argv_buf_size);
|
||||||
if (!argv_buf)
|
if (!argv_buf)
|
||||||
Sys_Error ("Cmd_TokenizeString: could not allocate %d bytes",
|
Sys_Error ("Cmd_TokenizeString: could not allocate %d bytes",
|
||||||
argv_buf_size);
|
argv_buf_size);
|
||||||
|
@ -518,9 +517,15 @@ Cmd_TokenizeString (const char *text)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (cmd_argc < MAX_ARGS) {
|
if (cmd_argc < MAX_ARGS) {
|
||||||
|
size_t len = strlen (com_token) + 1;
|
||||||
|
|
||||||
|
if (argv_idx + len > argv_buf_size) {
|
||||||
|
Sys_Printf ("Cmd_TokenizeString: overflow\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
cmd_argv[cmd_argc] = argv_buf + argv_idx;
|
cmd_argv[cmd_argc] = argv_buf + argv_idx;
|
||||||
strcpy (cmd_argv[cmd_argc], com_token);
|
strcpy (cmd_argv[cmd_argc], com_token);
|
||||||
argv_idx += strlen (com_token) + 1;
|
argv_idx += len;
|
||||||
|
|
||||||
cmd_argc++;
|
cmd_argc++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue