From 6bd69a051921ac0e92d451436f8dff35e0ae3e72 Mon Sep 17 00:00:00 2001 From: Tyrann Date: Sun, 19 Aug 2007 05:32:46 +0930 Subject: [PATCH] [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 --- Makefile | 4 +--- qbsp/util.c | 27 +-------------------------- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/Makefile b/Makefile index 965a3b98..35372928 100644 --- a/Makefile +++ b/Makefile @@ -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 $@ $^ diff --git a/qbsp/util.c b/qbsp/util.c index b7b2d574..0c2ee1c1 100644 --- a/qbsp/util.c +++ b/qbsp/util.c @@ -18,16 +18,6 @@ See file, 'COPYING', for details. */ -// util.c - -#ifdef _WIN32 -# include -# define noecho() do {} while (0) -# define echo() do {} while (0) -# define getch _getche -#else -# include -#endif #include #include @@ -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);