Remove MAX_HANDLES limit.

This commit is contained in:
Shpoike 2019-10-04 22:19:49 +01:00
parent 425f0fb831
commit 666825037a
2 changed files with 22 additions and 16 deletions

View file

@ -52,21 +52,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
qboolean isDedicated;
cvar_t sys_throttle = {"sys_throttle", "0.02", CVAR_ARCHIVE};
#define MAX_HANDLES 32 /* johnfitz -- was 10 */
static FILE *sys_handles[MAX_HANDLES];
static size_t sys_handles_max; /* spike -- removed limit, was 32 (johnfitz -- was 10) */
static FILE **sys_handles;
static int findhandle (void)
{
int i;
size_t i, n;
for (i = 1; i < MAX_HANDLES; i++)
for (i = 1; i < sys_handles_max; i++)
{
if (!sys_handles[i])
return i;
}
Sys_Error ("out of handles");
return -1;
n = sys_handles_max+10;
sys_handles = realloc(sys_handles, sizeof(*sys_handles)*n);
if (!sys_handles)
Sys_Error ("out of handles");
while (sys_handles_max < n)
sys_handles[sys_handles_max++] = NULL;
return i;
}
long Sys_filelength (FILE *f)

View file

@ -51,21 +51,24 @@ cvar_t sys_throttle = {"sys_throttle", "0.02", CVAR_ARCHIVE};
static HANDLE hinput, houtput;
#define MAX_HANDLES 32 /* johnfitz -- was 10 */
static FILE *sys_handles[MAX_HANDLES];
static size_t sys_handles_max; /* spike -- removed limit, was 32 (johnfitz -- was 10) */
static FILE **sys_handles;
static int findhandle (void)
{
int i;
size_t i, n;
for (i = 1; i < MAX_HANDLES; i++)
for (i = 1; i < sys_handles_max; i++)
{
if (!sys_handles[i])
return i;
}
Sys_Error ("out of handles");
return -1;
n = sys_handles_max+10;
sys_handles = realloc(sys_handles, sizeof(*sys_handles)*n);
if (!sys_handles)
Sys_Error ("out of handles");
while (sys_handles_max < n)
sys_handles[sys_handles_max++] = NULL;
return i;
}
long Sys_filelength (FILE *f)