From: Dale Weiler Date: Sun, 23 Dec 2012 07:22:15 +0000 (+0000) Subject: Remove parser_compile_string_len, and make parser_compiler_string take an additional... X-Git-Tag: 0.2~8 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d35d953a91c86521e7d23814385b8762bd57baff;p=xonotic%2Fgmqcc.git Remove parser_compile_string_len, and make parser_compiler_string take an additional length argument. --- diff --git a/gmqcc.h b/gmqcc.h index 358b03c..3755a51 100644 --- a/gmqcc.h +++ b/gmqcc.h @@ -919,15 +919,11 @@ qcint prog_tempstring(qc_program *prog, const char *_str); /*===================================================================*/ bool parser_init (); -bool parser_compile_file (const char *filename); -bool parser_compile_string(const char *name, const char *str); -bool parser_finish (const char *output); +bool parser_compile_file (const char *); +bool parser_compile_string(const char *, const char *, size_t); +bool parser_finish (const char *); void parser_cleanup (); -/* TODO: make compile_string accept len and remove this */ -/* There's really no need to strlen() preprocessed files */ -bool parser_compile_string_len(const char *name, const char *str, size_t len); - /*===================================================================*/ /*====================== ftepp.c commandline ========================*/ /*===================================================================*/ diff --git a/main.c b/main.c index 107098a..916a95e 100644 --- a/main.c +++ b/main.c @@ -681,7 +681,7 @@ srcdone: } data = ftepp_get(); if (vec_size(data)) { - if (!parser_compile_string_len(items[itr].filename, data, vec_size(data))) { + if (!parser_compile_string(items[itr].filename, data, vec_size(data))) { retval = 1; goto cleanup; } diff --git a/parser.c b/parser.c index 16d783a..46f4291 100644 --- a/parser.c +++ b/parser.c @@ -4724,7 +4724,7 @@ bool parser_compile_file(const char *filename) return parser_compile(); } -bool parser_compile_string_len(const char *name, const char *str, size_t len) +bool parser_compile_string(const char *name, const char *str, size_t len) { parser->lex = lex_open_string(str, len, name); if (!parser->lex) { @@ -4734,16 +4734,6 @@ bool parser_compile_string_len(const char *name, const char *str, size_t len) return parser_compile(); } -bool parser_compile_string(const char *name, const char *str) -{ - parser->lex = lex_open_string(str, strlen(str), name); - if (!parser->lex) { - con_err("failed to create lexer for string \"%s\"\n", name); - return false; - } - return parser_compile(); -} - void parser_cleanup() { size_t i;