]> git.ipfire.org Git - pakfire.git/commitdiff
parser: Do not use pakfire's own memory allocation functions any more
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 14 Feb 2021 16:25:28 +0000 (16:25 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 14 Feb 2021 16:25:28 +0000 (16:25 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/parser/scanner.l

index 1a7aac769e1b213d3ba76c17967f29cbb407fd16..d6d973d4f434eb2a305eb2cd84dbcf8930cfb0c2 100644 (file)
@@ -45,7 +45,10 @@ static char* find_name(const char* s, const char* prefix) {
        size_t length = strlen(prefix) + strlen(name);
 
        // Allocate a new buffer and write the string into it
-       char* buffer = pakfire_malloc(length + 1);
+       char* buffer = malloc(length + 1);
+       if (!buffer)
+               abort();
+
        snprintf(buffer, length + 1, "%s%s", prefix, name);
 
        return buffer;
@@ -134,7 +137,10 @@ template2          {whitespace}template.*
                                        size_t length = strlen("define ") + yyleng;
 
                                        // Make a copy because unput touches yytext
-                                       char* buffer = pakfire_malloc(length + 1);
+                                       char* buffer = malloc(length + 1);
+                                       if (!buffer)
+                                               abort();
+
                                        snprintf(buffer, length + 1, "define %s", yytext);
 
                                        // Put the whole string back onto the stack (backwards)
@@ -174,12 +180,12 @@ template2         {whitespace}template.*
                                        size_t len = strlen(yytext);
                                        yytext[len-1] = '\0';
 
-                                       yylval.string = pakfire_strdup(yytext + 1);
+                                       yylval.string = strdup(yytext + 1);
                                        return T_WORD;
                                }
 
 {word}                 {
-                                       yylval.string = pakfire_strdup(yytext);
+                                       yylval.string = strdup(yytext);
                                        return T_WORD;
                                }