Remove parser_compile_string_len, and make parser_compiler_string take an additional length argument.

This commit is contained in:
Dale Weiler 2012-12-23 07:22:15 +00:00
parent 6951f3dfcc
commit d35d953a91
3 changed files with 5 additions and 19 deletions

10
gmqcc.h
View file

@ -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 ========================*/
/*===================================================================*/

2
main.c
View file

@ -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;
}

View file

@ -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;