winedbg: Make lexeme_alloc() static in debug.l.

This commit is contained in:
Francois Gouget 2009-01-20 09:13:55 +01:00 committed by Alexandre Julliard
parent 5012a57268
commit 4061d1f8d8
2 changed files with 28 additions and 29 deletions

View File

@ -36,6 +36,34 @@
#undef YY_INPUT
static char** local_lexemes /* = NULL */;
static int next_lexeme /* = 0 */;
static int alloc_lexeme /* = 0 */;
char* lexeme_alloc_size(int size)
{
assert(0 <= next_lexeme && next_lexeme < alloc_lexeme + 1);
if (next_lexeme >= alloc_lexeme)
{
alloc_lexeme += 32;
local_lexemes = dbg_heap_realloc(local_lexemes, alloc_lexeme * sizeof(local_lexemes[0]));
assert(local_lexemes);
}
return local_lexemes[next_lexeme++] = HeapAlloc(GetProcessHeap(), 0, size + 1);
}
static char* lexeme_alloc(const char* lexeme)
{
char* ptr = lexeme_alloc_size(strlen(lexeme) + 1);
return strcpy(ptr, lexeme);
}
void lexeme_flush(void)
{
while (--next_lexeme >= 0) HeapFree(GetProcessHeap(), 0, local_lexemes[next_lexeme]);
next_lexeme = 0;
}
static int read_input(const char* pfx, char* buf, int size)
{
int len;
@ -234,31 +262,3 @@ all { return tALL; }
#ifndef dbg_wrap
int dbg_wrap(void) { return 1; }
#endif
static char** local_lexemes /* = NULL */;
static int next_lexeme /* = 0 */;
static int alloc_lexeme /* = 0 */;
char* lexeme_alloc_size(int size)
{
assert(0 <= next_lexeme && next_lexeme < alloc_lexeme + 1);
if (next_lexeme >= alloc_lexeme)
{
alloc_lexeme += 32;
local_lexemes = dbg_heap_realloc(local_lexemes, alloc_lexeme * sizeof(local_lexemes[0]));
assert(local_lexemes);
}
return local_lexemes[next_lexeme++] = HeapAlloc(GetProcessHeap(), 0, size + 1);
}
char* lexeme_alloc(const char* lexeme)
{
char* ptr = lexeme_alloc_size(strlen(lexeme) + 1);
return strcpy(ptr, lexeme);
}
void lexeme_flush(void)
{
while (--next_lexeme >= 0) HeapFree(GetProcessHeap(), 0, local_lexemes[next_lexeme]);
next_lexeme = 0;
}

View File

@ -308,7 +308,6 @@ extern HANDLE parser_generate_command_file(const char*, ...);
/* debug.l */
extern void lexeme_flush(void);
extern char* lexeme_alloc(const char*);
extern char* lexeme_alloc_size(int);
/* display.c */