summaryrefslogtreecommitdiff
path: root/src/deh_text.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/deh_text.c')
-rw-r--r--src/deh_text.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/src/deh_text.c b/src/deh_text.c
index 1fc91185..9e621b43 100644
--- a/src/deh_text.c
+++ b/src/deh_text.c
@@ -16,6 +16,7 @@
//
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include "doomtype.h"
@@ -51,7 +52,7 @@ static void *DEH_TextStart(deh_context_t *context, char *line)
char *from_text, *to_text;
int fromlen, tolen;
int i;
-
+
if (sscanf(line, "Text %i %i", &fromlen, &tolen) != 2)
{
DEH_Warning(context, "Parse error on section start");
@@ -68,36 +69,30 @@ static void *DEH_TextStart(deh_context_t *context, char *line)
return NULL;
}
- from_text = Z_Malloc(fromlen + 1, PU_STATIC, NULL);
- to_text = Z_Malloc(tolen + 1, PU_STATIC, NULL);
+ from_text = malloc(fromlen + 1);
+ to_text = malloc(tolen + 1);
// read in the "from" text
for (i=0; i<fromlen; ++i)
{
- int c;
-
- c = DEH_GetChar(context);
-
- from_text[i] = c;
+ from_text[i] = DEH_GetChar(context);
}
-
from_text[fromlen] = '\0';
// read in the "to" text
for (i=0; i<tolen; ++i)
{
- int c;
-
- c = DEH_GetChar(context);
-
- to_text[i] = c;
+ to_text[i] = DEH_GetChar(context);
}
to_text[tolen] = '\0';
DEH_AddStringReplacement(from_text, to_text);
-
+
+ free(from_text);
+ free(to_text);
+
return NULL;
}