Module: wine Branch: master Commit: 4061d1f8d87682d05168590dfe78f0c7e98cf1c4 URL: http://source.winehq.org/git/wine.git/?a=commit;h=4061d1f8d87682d05168590dfe...
Author: Francois Gouget fgouget@free.fr Date: Tue Jan 20 09:13:55 2009 +0100
winedbg: Make lexeme_alloc() static in debug.l.
---
programs/winedbg/debug.l | 56 +++++++++++++++++++++--------------------- programs/winedbg/debugger.h | 1 - 2 files changed, 28 insertions(+), 29 deletions(-)
diff --git a/programs/winedbg/debug.l b/programs/winedbg/debug.l index 3a47a17..4332989 100644 --- a/programs/winedbg/debug.l +++ b/programs/winedbg/debug.l @@ -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; -} diff --git a/programs/winedbg/debugger.h b/programs/winedbg/debugger.h index 2c7ef4e..0d34ddf 100644 --- a/programs/winedbg/debugger.h +++ b/programs/winedbg/debugger.h @@ -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 */