[Scummvm-git-logs] scummvm master -> df30831bcfdb63fc6dc1e5519fe2f24c905e0804

sev- sev at scummvm.org
Mon Apr 27 21:19:31 UTC 2020


This automated email contains information about 6 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
1cf604363c CRUISE: Fix mismatching malloc/delete[]
4a6c0fb35e SWORD1: Fix mismatching malloc/delete[]
14242835ef GLK: Fix mismatching new[]/free
511722a6c7 GLK: AGT: Clean up strdup usage
8e6776ebd9 GLK: ALAN2: Replace defines with actual function calls
df30831bcf GLK: ALAN3: Replace defines with actual function calls


Commit: 1cf604363cb8793ac2757ce67620767b3b578848
    https://github.com/scummvm/scummvm/commit/1cf604363cb8793ac2757ce67620767b3b578848
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-04-27T22:51:25+02:00

Commit Message:
CRUISE: Fix mismatching malloc/delete[]

Changed paths:
    engines/cruise/font.cpp


diff --git a/engines/cruise/font.cpp b/engines/cruise/font.cpp
index 3a4e0d6d78..fe3b93d1a7 100644
--- a/engines/cruise/font.cpp
+++ b/engines/cruise/font.cpp
@@ -273,7 +273,7 @@ void drawString(int32 x, int32 y, const char *string, uint8 *buffer, uint8 fontC
 
 	// Free the data
 	delete s->imagePtr;
-	delete s;
+	free(s);
 }
 
 // calculates all necessary datas and renders text


Commit: 4a6c0fb35eb2ac7a7e3f53bf11a74f17fd24643c
    https://github.com/scummvm/scummvm/commit/4a6c0fb35eb2ac7a7e3f53bf11a74f17fd24643c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-04-27T22:52:13+02:00

Commit Message:
SWORD1: Fix mismatching malloc/delete[]

Changed paths:
    engines/sword1/sound.cpp


diff --git a/engines/sword1/sound.cpp b/engines/sword1/sound.cpp
index 720ed8afc8..3b6a5730c7 100644
--- a/engines/sword1/sound.cpp
+++ b/engines/sword1/sound.cpp
@@ -130,11 +130,11 @@ void Sound::checkSpeechFileEndianness() {
 		int16 *data = uncompressSpeech(index + _cowHeaderSize, sampleSize, &size, &leOk);
 		uint32 maxSamples = size > 2000 ? 2000 : size;
 		double le_diff = endiannessHeuristicValue(data, size, maxSamples);
-		delete[] data;
+		free(data);
 		_bigEndianSpeech = true;
 		data = uncompressSpeech(index + _cowHeaderSize, sampleSize, &size, &beOk);
 		double be_diff = endiannessHeuristicValue(data, size, maxSamples);
-		delete [] data;
+		free(data);
 		// Set the big endian flag
 		if (leOk && !beOk)
 			_bigEndianSpeech = false;


Commit: 14242835ef6475c568cbd0d3509a7e0b9ddf67fe
    https://github.com/scummvm/scummvm/commit/14242835ef6475c568cbd0d3509a7e0b9ddf67fe
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-04-27T22:53:26+02:00

Commit Message:
GLK: Fix mismatching new[]/free

Changed paths:
    engines/glk/unicode.cpp


diff --git a/engines/glk/unicode.cpp b/engines/glk/unicode.cpp
index b871fc7778..e6f4ac2c07 100644
--- a/engines/glk/unicode.cpp
+++ b/engines/glk/unicode.cpp
@@ -144,7 +144,7 @@ uint bufferChangeCase(uint32 *buf, uint len, uint numchars, BufferChangeCase des
 			finallen = len;
 		if (finallen)
 			memcpy(buf, newoutbuf, finallen * sizeof(uint));
-		free(newoutbuf);
+		delete[] newoutbuf;
 	}
 
 	return outcount;


Commit: 511722a6c7ebca69d2cb16159a5dd8aa5706ca81
    https://github.com/scummvm/scummvm/commit/511722a6c7ebca69d2cb16159a5dd8aa5706ca81
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-04-27T23:00:41+02:00

Commit Message:
GLK: AGT: Clean up strdup usage

Changed paths:
    engines/glk/agt/config.h
    engines/glk/agt/util.cpp


diff --git a/engines/glk/agt/config.h b/engines/glk/agt/config.h
index 0780e1a9a6..14e4c6e96b 100644
--- a/engines/glk/agt/config.h
+++ b/engines/glk/agt/config.h
@@ -173,7 +173,6 @@ namespace AGT {
 #ifdef __STRICT_ANSI__
 #define NEED_STR_CMP
 #define NEED_STRN_CMP
-#undef HAVE_STRDUP
 #endif
 
 #ifndef fix_ascii
diff --git a/engines/glk/agt/util.cpp b/engines/glk/agt/util.cpp
index fce4e8b433..892a3085be 100644
--- a/engines/glk/agt/util.cpp
+++ b/engines/glk/agt/util.cpp
@@ -180,26 +180,14 @@ void *rrealloc(void *old, long size) {
 }
 
 char *rstrdup(const char *s) {
-	char *t;
-#ifndef HAVE_STRDUP
-	int i;
-#endif
-
 	if (s == NULL) return NULL;
-#ifdef HAVE_STRDUP
-	t = strdup(s);
-#else
-	t = (char *)malloc((strlen(s) + 1) * sizeof(char));
-#endif
+
+	char *t = scumm_strdup(s);
 	if (t == NULL && rm_trap) {
 		error("Memory duplication error: Out of memory.");
 	}
 	if (rm_acct) ralloc_cnt++;
-#ifndef HAVE_STRDUP
-	for (i = 0; s[i] != 0; i++)
-		t[i] = s[i];
-	t[i] = 0;
-#endif
+
 	return t;
 }
 


Commit: 8e6776ebd9242090efde9e4141a84b684b76b360
    https://github.com/scummvm/scummvm/commit/8e6776ebd9242090efde9e4141a84b684b76b360
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-04-27T23:03:43+02:00

Commit Message:
GLK: ALAN2: Replace defines with actual function calls

Changed paths:
    engines/glk/alan2/args.cpp
    engines/glk/alan2/exe.cpp
    engines/glk/alan2/main.cpp
    engines/glk/alan2/parse.cpp
    engines/glk/alan2/sysdep.h


diff --git a/engines/glk/alan2/args.cpp b/engines/glk/alan2/args.cpp
index 400356cb4e..66989f6058 100644
--- a/engines/glk/alan2/args.cpp
+++ b/engines/glk/alan2/args.cpp
@@ -49,9 +49,9 @@ void args(int argc, char *argv[]) {
 	switches(argc, argv);
 	if (advnam[0] == '\0')
 		/* No game given, try program name */
-		if (stricmp(prgnam, PROGNAME) != 0
+		if (scumm_stricmp(prgnam, PROGNAME) != 0
 		        && strstr(prgnam, PROGNAME) == 0)
-			advnam = strdup(argv[0]);
+			advnam = scumm_strdup(argv[0]);
 }
 
 } // End of namespace Alan2
diff --git a/engines/glk/alan2/exe.cpp b/engines/glk/alan2/exe.cpp
index 38f1c489a6..284556c279 100644
--- a/engines/glk/alan2/exe.cpp
+++ b/engines/glk/alan2/exe.cpp
@@ -471,7 +471,7 @@ Aptr attribute(Aword id, Aword atr) {
 }
 
 Aptr strattr(Aword id, Aword atr) {
-	return (Aptr) strdup((char *)attribute(id, atr));
+	return (Aptr)scumm_strdup((char *)attribute(id, atr));
 }
 
 
@@ -751,7 +751,7 @@ static void saylit(Aword lit) {
 	if (isNum(lit))
 		sayint(litValues[lit - LITMIN].value);
 	else {
-		str = (char *)strdup((char *)litValues[lit - LITMIN].value);
+		str = (char *)scumm_strdup((char *)litValues[lit - LITMIN].value);
 		saystr(str);
 	}
 }
@@ -1091,9 +1091,9 @@ Aword rnd(Aword from, Aword to) {
 	if (to == from)
 		return to;
 	else if (to > from)
-		return (rand() / 10) % (to - from + 1) + from;
+		return (g_vm->getRandomNumber(0x7fffffff) / 10) % (to - from + 1) + from;
 	else
-		return (rand() / 10) % (from - to + 1) + to;
+		return (g_vm->getRandomNumber(0x7fffffff) / 10) % (from - to + 1) + to;
 }
 
 /*----------------------------------------------------------------------
diff --git a/engines/glk/alan2/main.cpp b/engines/glk/alan2/main.cpp
index d09ac25ba8..6f3eda07fc 100644
--- a/engines/glk/alan2/main.cpp
+++ b/engines/glk/alan2/main.cpp
@@ -427,7 +427,7 @@ void output(const char original[]) {
 	char *str, *copy;
 	char *symptr;
 
-	copy = strdup(original);
+	copy = scumm_strdup(original);
 	str = copy;
 
 	if (str[0] != '$' || str[1] != '$')
diff --git a/engines/glk/alan2/parse.cpp b/engines/glk/alan2/parse.cpp
index b6ef86bd88..5b97448cfb 100644
--- a/engines/glk/alan2/parse.cpp
+++ b/engines/glk/alan2/parse.cpp
@@ -132,9 +132,9 @@ static char *gettoken(char *tokBuf) {
 	while (*marker != '\0' && isSpace(*marker) && *marker != '\n') marker++;
 	tokBuf = marker;
 	if (isISOLetter(*marker))
-		while (*marker && (isISOLetter(*marker) || isdigit(*marker) || *marker == '\'')) marker++;
-	else if (isdigit(*marker))
-		while (isdigit(*marker)) marker++;
+		while (*marker && (isISOLetter(*marker) || Common::isDigit(*marker) || *marker == '\'')) marker++;
+	else if (Common::isDigit(*marker))
+		while (Common::isDigit(*marker)) marker++;
 	else if (*marker == '\"') {
 		marker++;
 		while (*marker != '\"') marker++;
@@ -203,7 +203,7 @@ static void scan(CONTEXT) {
 
 			if (!isNoise(w))
 				wrds[i++] = w;
-		} else if (isdigit(token[0])) {
+		} else if (Common::isDigit(token[0])) {
 			if (litCount > MAXPARAMS)
 				syserr("Too many parameters.");
 			wrds[i++] = dictsize + litCount; /* Word outside dictionary = literal */
@@ -215,7 +215,7 @@ static void scan(CONTEXT) {
 			wrds[i++] = dictsize + litCount; /* Word outside dictionary = literal */
 			litValues[litCount].type = TYPSTR;
 			/* Remove the string quotes while copying */
-			str = strdup(&token[1]);
+			str = scumm_strdup(&token[1]);
 			str[strlen(token) - 2] = '\0';
 			litValues[litCount++].value = (Aptr) str;
 		} else if (token[0] == ',') {
@@ -456,7 +456,7 @@ static void complex(CONTEXT, ParamElem olst[]) {
 	if (isAll(wrds[wrdidx])) {
 		plural = TRUE;
 		// Build list of all objects
-		CALL1(buildall, alst)     
+		CALL1(buildall, alst)
 		wrdidx++;
 		if (wrds[wrdidx] != EOD && isBut(wrds[wrdidx])) {
 			wrdidx++;
diff --git a/engines/glk/alan2/sysdep.h b/engines/glk/alan2/sysdep.h
index ea513aa9ec..24c0aefe72 100644
--- a/engines/glk/alan2/sysdep.h
+++ b/engines/glk/alan2/sysdep.h
@@ -45,14 +45,6 @@ namespace Alan2 {
 #define GLK
 #define __win__
 
-#undef isdigit
-#define isdigit Common::isDigit
-#undef stricmp
-#define stricmp scumm_stricmp
-#undef strdup
-#define strdup scumm_strdup
-#undef rand
-#define rand() g_vm->getRandomNumber(0x7fffffff)
 #undef fprintf
 extern void fprintf(Common::WriteStream *ws, const char *fmt, ...);
 


Commit: df30831bcfdb63fc6dc1e5519fe2f24c905e0804
    https://github.com/scummvm/scummvm/commit/df30831bcfdb63fc6dc1e5519fe2f24c905e0804
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-04-27T23:18:56+02:00

Commit Message:
GLK: ALAN3: Replace defines with actual function calls

Changed paths:
    engines/glk/alan3/debug.cpp
    engines/glk/alan3/exe.cpp
    engines/glk/alan3/instance.cpp
    engines/glk/alan3/inter.cpp
    engines/glk/alan3/literal.cpp
    engines/glk/alan3/output.cpp
    engines/glk/alan3/scan.cpp
    engines/glk/alan3/state_stack.cpp
    engines/glk/alan3/sysdep.h


diff --git a/engines/glk/alan3/debug.cpp b/engines/glk/alan3/debug.cpp
index 114019d520..3f5d747bbe 100644
--- a/engines/glk/alan3/debug.cpp
+++ b/engines/glk/alan3/debug.cpp
@@ -708,7 +708,7 @@ static void handleHelpCommand() {
 /*----------------------------------------------------------------------*/
 static const DebugParseEntry *findEntry(char *command, const DebugParseEntry *entry) {
 	while (entry->command != NULL) {
-		if (strncasecmp(command, entry->command, strlen(command)) == 0)
+		if (scumm_strnicmp(command, entry->command, strlen(command)) == 0)
 			return entry;
 		entry++;
 	}
@@ -881,7 +881,7 @@ static void handleTraceCommand() {
 /*----------------------------------------------------------------------*/
 static void handleBreakCommand(int fileNumber) {
 	char *parameter = strtok(NULL, ":");
-	if (parameter != NULL && isalpha((int)parameter[0])) {
+	if (parameter != NULL && Common::isAlpha((int)parameter[0])) {
 		fileNumber = sourceFileNumber(parameter);
 		if (fileNumber == -1) {
 			printf("No such file: '%s'\n", parameter);
@@ -946,7 +946,7 @@ static void handleClassesCommand(CONTEXT) {
 		output("Classes:");
 		showClassHierarchy(1, 0);
 		listInstances(context, parameter);
-	} else if (isdigit((int)parameter[0]))
+	} else if (Common::isDigit((int)parameter[0]))
 		showClass(atoi(parameter));
 	else {
 		printf("You have to give a class index to display. You can't use names (yet).");
@@ -971,7 +971,7 @@ static void handleInstancesCommand(CONTEXT) {
 
 	if (parameter == NULL || strchr(parameter, '*') != 0)
 		listInstances(context, parameter);
-	else if (isdigit((int)parameter[0]))
+	else if (Common::isDigit((int)parameter[0]))
 		showInstance(context, atoi(parameter));
 	else {
 		for (i = 1; i < header->instanceMax; i++)
diff --git a/engines/glk/alan3/exe.cpp b/engines/glk/alan3/exe.cpp
index 89a4a83d46..3a7c8adf37 100644
--- a/engines/glk/alan3/exe.cpp
+++ b/engines/glk/alan3/exe.cpp
@@ -213,17 +213,17 @@ void quitGame(CONTEXT) {
 		if (!flag)
 			CALL1(terminate, 0)
 
-		if (strcasecmp(buf, "restart") == 0) {
+		if (scumm_stricmp(buf, "restart") == 0) {
 			LONG_JUMP_LABEL("restart")
 
-		} else if (strcasecmp(buf, "restore") == 0) {
+		} else if (scumm_stricmp(buf, "restore") == 0) {
 			g_vm->loadGame();
 			return;
 
-		} else if (strcasecmp(buf, "quit") == 0) {
+		} else if (scumm_stricmp(buf, "quit") == 0) {
 			CALL1(terminate, 0)
 
-		} else if (strcasecmp(buf, "undo") == 0) {
+		} else if (scumm_stricmp(buf, "undo") == 0) {
 			if (gameStateChanged) {
 				rememberCommands();
 				rememberGameState();
@@ -345,8 +345,8 @@ static char *stripCharsFromStringForwards(int count, char *initialString, char *
 		stripPosition = strlen(initialString);
 	else
 		stripPosition = count;
-	rest = strdup(&initialString[stripPosition]);
-	strippedString = strdup(initialString);
+	rest = scumm_strdup(&initialString[stripPosition]);
+	strippedString = scumm_strdup(initialString);
 	strippedString[stripPosition] = '\0';
 	*theRest = rest;
 	return strippedString;
@@ -362,8 +362,8 @@ static char *stripCharsFromStringBackwards(Aint count, char *initialString, char
 		stripPosition = 0;
 	else
 		stripPosition = strlen(initialString) - count;
-	strippedString = strdup(&initialString[stripPosition]);
-	rest = strdup(initialString);
+	strippedString = scumm_strdup(&initialString[stripPosition]);
+	rest = scumm_strdup(initialString);
 	rest[stripPosition] = '\0';
 	*theRest = rest;
 	return strippedString;
@@ -408,7 +408,7 @@ static char *stripWordsFromStringForwards(Aint count, char *initialString, char
 	stripped[position] = '\0';
 
 	skippedChars = countLeadingBlanks(initialString, position);
-	*theRest = strdup(&initialString[position + skippedChars]);
+	*theRest = scumm_strdup(&initialString[position + skippedChars]);
 
 	return (stripped);
 }
@@ -465,7 +465,7 @@ static char *stripWordsFromStringBackwards(Aint count, char *initialString, char
 		skippedChars = countTrailingBlanks(initialString, position - 1);
 		position -= skippedChars;
 	}
-	*theRest = strdup(initialString);
+	*theRest = scumm_strdup(initialString);
 	(*theRest)[position] = '\0';
 	return (stripped);
 }
@@ -584,9 +584,9 @@ int randomInteger(int from, int to) {
 		if (to == from)
 			return to;
 		else if (to > from)
-			return (rand() / 10) % (to - from + 1) + from;
+			return (g_vm->getRandomNumber(0x7fffffff) / 10) % (to - from + 1) + from;
 		else
-			return (rand() / 10) % (from - to + 1) + to;
+			return (g_vm->getRandomNumber(0x7fffffff) / 10) % (from - to + 1) + to;
 	}
 }
 
diff --git a/engines/glk/alan3/instance.cpp b/engines/glk/alan3/instance.cpp
index fa4084fb94..17877bca2a 100644
--- a/engines/glk/alan3/instance.cpp
+++ b/engines/glk/alan3/instance.cpp
@@ -191,7 +191,7 @@ Aptr getInstanceAttribute(int instance, int attribute) {
 
 /*======================================================================*/
 char *getInstanceStringAttribute(int instance, int attribute) {
-	return strdup((char *)fromAptr(getInstanceAttribute(instance, attribute)));
+	return scumm_strdup((char *)fromAptr(getInstanceAttribute(instance, attribute)));
 }
 
 
@@ -481,7 +481,7 @@ void sayInstance(CONTEXT, int instance) {
 						output((char *)pointerTo(dict[wrds[i]].wrd));
 					/* ... and then the noun, capitalized if necessary */
 					if (header->capitalizeNouns) {
-						capitalized = strdup((char *)pointerTo(dict[wrds[params[p].lastWord]].wrd));
+						capitalized = scumm_strdup((char *)pointerTo(dict[wrds[params[p].lastWord]].wrd));
 						capitalized[0] = IsoToUpperCase(capitalized[0]);
 						output(capitalized);
 						deallocate(capitalized);
@@ -491,7 +491,7 @@ void sayInstance(CONTEXT, int instance) {
 				return;
 			}
 #endif
-	
+
 	bool flag;
 	FUNC1(mention, flag, instance)
 	if (!flag)
@@ -525,7 +525,7 @@ static void sayLiteral(int literal) {
 	if (isANumeric(literal))
 		sayInteger(literals[literal - header->instanceMax].value);
 	else {
-		str = (char *)strdup((char *)fromAptr(literals[literal - header->instanceMax].value));
+		str = (char *)scumm_strdup((char *)fromAptr(literals[literal - header->instanceMax].value));
 		sayString(str);
 	}
 }
diff --git a/engines/glk/alan3/inter.cpp b/engines/glk/alan3/inter.cpp
index a123c8be87..6d35e2cc35 100644
--- a/engines/glk/alan3/inter.cpp
+++ b/engines/glk/alan3/inter.cpp
@@ -520,7 +520,7 @@ void interpret(CONTEXT, Aaddr adr) {
 			case I_DUPSTR:
 				if (traceInstructionOption)
 					printf("DUPSTR\t\t\t\t\t\t");
-				push(stack, toAptr(strdup((char *)fromAptr(top(stack)))));
+				push(stack, toAptr(scumm_strdup((char *)fromAptr(top(stack)))));
 				break;
 
 			case I_POP: {
diff --git a/engines/glk/alan3/literal.cpp b/engines/glk/alan3/literal.cpp
index 6040074c78..e6f97b66eb 100644
--- a/engines/glk/alan3/literal.cpp
+++ b/engines/glk/alan3/literal.cpp
@@ -56,7 +56,7 @@ void createStringLiteral(char *unquotedString) {
 	litCount++;
 	literals[litCount]._class = header->stringClassId;
 	literals[litCount].type = STRING_LITERAL;
-	literals[litCount].value = toAptr(strdup(unquotedString));
+	literals[litCount].value = toAptr(scumm_strdup(unquotedString));
 }
 
 /*----------------------------------------------------------------------*/
diff --git a/engines/glk/alan3/output.cpp b/engines/glk/alan3/output.cpp
index 1ac2cd69a7..7ebf5a5873 100644
--- a/engines/glk/alan3/output.cpp
+++ b/engines/glk/alan3/output.cpp
@@ -136,11 +136,11 @@ void printAndLog(const char *string) {
 	if (!g_io->onStatusLine && transcriptOption) {
 		// TODO Is this assuming only 70-char wide windows for GLK?
 		if ((int)strlen(string) > 70 - column) {
-			stringCopy = strdup(string);  /* Make sure we can write NULLs */
+			stringCopy = scumm_strdup(string);  /* Make sure we can write NULLs */
 			stringPart = stringCopy;
 			while ((int)strlen(stringPart) > 70 - column) {
 				int p;
-				for (p = 70 - column; p > 0 && !isspace((int)stringPart[p]); p--);
+				for (p = 70 - column; p > 0 && !Common::isSpace((int)stringPart[p]); p--);
 				stringPart[p] = '\0';
 				g_io->glk_put_string_stream(logFile, stringPart);
 				g_io->glk_put_char_stream(logFile, '\n');
@@ -242,7 +242,7 @@ static void sayParameter(CONTEXT, int p, int form) {
 
   str - The string starting with '$'
   */
-static char *printSymbol(CONTEXT, char str[]) { 
+static char *printSymbol(CONTEXT, char str[]) {
 	int advance = 2;
 
 	if (*str == '\0') printAndLog("$");
@@ -267,7 +267,7 @@ static char *printSymbol(CONTEXT, char str[]) {
 		case '-':
 		case '!':
 			space();
-			if (isdigit((int)str[2])) {
+			if (Common::isDigit((int)str[2])) {
 				int form;
 				switch (str[1]) {
 				case '+':
@@ -390,7 +390,7 @@ void output(const char *original) {
 	char *symptr;
 	Context ctx;
 
-	copy = strdup(original);
+	copy = scumm_strdup(original);
 	str = copy;
 
 	if (inhibitSpace(str) || punctuationNext(str))
diff --git a/engines/glk/alan3/scan.cpp b/engines/glk/alan3/scan.cpp
index 788e5ca90d..881f08178c 100644
--- a/engines/glk/alan3/scan.cpp
+++ b/engines/glk/alan3/scan.cpp
@@ -58,7 +58,7 @@ void forceNewPlayerInput() {
 
 /*----------------------------------------------------------------------*/
 static void unknown(CONTEXT, char tok[]) {
-	char *str = strdup(tok);
+	char *str = scumm_strdup(tok);
 	Parameter *messageParameters = newParameterArray();
 
 	addParameterForString(messageParameters, str);
@@ -94,7 +94,7 @@ static int lookup(CONTEXT, char wrd[]) {
 
 /*----------------------------------------------------------------------*/
 static bool isWordCharacter(int ch) {
-	return isISOLetter(ch) || isdigit(ch) || ch == '\'' || ch == '-' || ch == '_';
+	return isISOLetter(ch) || Common::isDigit(ch) || ch == '\'' || ch == '-' || ch == '_';
 }
 
 /*----------------------------------------------------------------------*/
@@ -112,8 +112,8 @@ static char *gettoken(char *txtBuf) {
 	if (isISOLetter(*marker))
 		while (*marker && isWordCharacter(*marker))
 			marker++;
-	else if (isdigit((int)*marker))
-		while (isdigit((int)*marker))
+	else if (Common::isDigit((int)*marker))
+		while (Common::isDigit((int)*marker))
 			marker++;
 	else if (*marker == '\"') {
 		marker++;
@@ -216,11 +216,11 @@ void scan(CONTEXT) {
 			FUNC1(lookup, w, token);
 			if (!isNoise(w))
 				playerWords[i++].code = w;
-		} else if (isdigit((int)token[0]) || token[0] == '\"') {
-			if (isdigit((int)token[0])) {
+		} else if (Common::isDigit((int)token[0]) || token[0] == '\"') {
+			if (Common::isDigit((int)token[0])) {
 				createIntegerLiteral(number(token));
 			} else {
-				char *unquotedString = strdup(token);
+				char *unquotedString = scumm_strdup(token);
 				unquotedString[strlen(token) - 1] = '\0';
 				createStringLiteral(&unquotedString[1]);
 				free(unquotedString);
diff --git a/engines/glk/alan3/state_stack.cpp b/engines/glk/alan3/state_stack.cpp
index fa5f9c683e..3c74913930 100644
--- a/engines/glk/alan3/state_stack.cpp
+++ b/engines/glk/alan3/state_stack.cpp
@@ -106,7 +106,7 @@ void pushGameState(StateStackP stateStack, void *gameState) {
 
 /*======================================================================*/
 void attachPlayerCommandsToLastState(StateStackP stateStack, char *playerCommands) {
-	stateStack->commands[stateStack->stackPointer - 1] = strdup(playerCommands);
+	stateStack->commands[stateStack->stackPointer - 1] = scumm_strdup(playerCommands);
 }
 
 
diff --git a/engines/glk/alan3/sysdep.h b/engines/glk/alan3/sysdep.h
index 1889a3ea00..7f6f756e83 100644
--- a/engines/glk/alan3/sysdep.h
+++ b/engines/glk/alan3/sysdep.h
@@ -44,24 +44,6 @@ namespace Alan3 {
 #define GLK
 #define HAVE_GLK
 
-#undef isspace
-#define isspace Common::isSpace
-#undef isdigit
-#define isdigit Common::isDigit
-#undef isalpha
-#define isalpha Common::isAlpha
-#undef stricmp
-#define stricmp scumm_stricmp
-#undef strdup
-#define strdup scumm_strdup
-#undef strcasecmp
-#define strcasecmp scumm_stricmp
-#undef strncasecmp
-#define strncasecmp scumm_strnicmp
-#undef rand
-#define rand() g_vm->getRandomNumber(0x7fffffff)
-
-
 /*----------------------------------------------------------------------
 
   Below follows OS and compiler dependent settings. They should not be




More information about the Scummvm-git-logs mailing list