MEM_VEC_FUNCTIONS(token, char, value)
MEM_VEC_FUNCTIONS(lex_file, frame_macro, frames)
+VECTOR_MAKE(char*, lex_filenames);
+
void lexerror(lex_file *lex, const char *fmt, ...)
{
va_list ap;
lex->peekpos = 0;
+ lex_filenames_add(lex->name);
+
return lex;
}
+void lex_cleanup(void)
+{
+ size_t i;
+ for (i = 0; i < lex_filenames_elements; ++i)
+ mem_d(lex_filenames_data[i]);
+ mem_d(lex_filenames_data);
+}
+
void lex_close(lex_file *lex)
{
size_t i;
fclose(lex->file);
if (lex->tok)
token_delete(lex->tok);
- mem_d(lex->name);
+ /* mem_d(lex->name); collected in lex_filenames */
mem_d(lex);
}
lex_file* lex_open (const char *file);
void lex_close(lex_file *lex);
int lex_do (lex_file *lex);
+void lex_cleanup(void);
/* Parser
*
* SOFTWARE.
*/
#include "gmqcc.h"
+#include "lexer.h"
uint32_t opts_flags[1 + (COUNT_FLAGS / 32)];
uint32_t opts_warn [1 + (COUNT_WARNINGS / 32)];
if (opts_output_free)
mem_d((char*)opts_output);
+ lex_cleanup();
util_meminfo();
return retval;
}