[PATCH] qbsp: Remove malloc retry logic

If we run out of memory, then too bad. Qbsp never _really_ takes so long that
you'd really care too much about starting again. Simplifies portability.

Signed-off-by: Tyrann <tyrann@disenchant.net>
This commit is contained in:
Tyrann 2007-08-19 05:32:46 +09:30
parent b22ed2107a
commit 6bd69a0519
2 changed files with 2 additions and 29 deletions

View File

@ -8,12 +8,10 @@ ifeq ($(OSTYPE),msys)
EXT=.exe
DPTHREAD=
LPTHREAD=
LCURSES=
else
EXT=
DPTHREAD=-DUSE_PTHREADS
LPTHREAD=-lpthread
LCURSES=-lcurses
endif
#CFLAGS = -Wall -Werror -g
@ -145,4 +143,4 @@ QBSP_OBJECTS = \
qbsp/%.o: CPPFLAGS += -DDOUBLEVEC_T -DQBSP_VERSION=$(QBSP_VERSION)
qbsp/$(BIN_PFX)qbsp$(EXT): $(patsubst %,qbsp/%,$(QBSP_OBJECTS))
$(CC) -o $@ $^ $(LCURSES)
$(CC) -o $@ $^

View File

@ -18,16 +18,6 @@
See file, 'COPYING', for details.
*/
// util.c
#ifdef _WIN32
# include <conio.h>
# define noecho() do {} while (0)
# define echo() do {} while (0)
# define getch _getche
#else
# include <curses.h>
#endif
#include <stdarg.h>
#include <malloc.h>
@ -66,24 +56,9 @@ AllocMem(int Type, int cElements, bool fZero)
} else
cSize = cElements * rgcMemSize[Type];
Retry:
pTemp = malloc(cSize);
if (pTemp == NULL) {
char ch;
printf
("\bOut of memory. Please close some apps and hit 'y' to try again,\n");
printf("or any other key to exit -> ");
noecho();
ch = toupper(getch());
echo();
printf("\n");
fflush(stdin);
if (ch == 'Y')
goto Retry;
if (!pTemp)
Message(msgError, errOutOfMemory);
}
if (fZero)
memset(pTemp, 0, cSize);