From 4cdce5b50e286aab457611d2c634cb79990795fd Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 28 Dec 2007 17:02:07 +0100 Subject: Remove a static array This might be worth it, mangle_hash is hardly used these days (This used to be commit 44775ea38bc320ac8e2208769a8cde2c6f44f640) --- source3/smbd/mangle_hash.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source3/smbd/mangle_hash.c b/source3/smbd/mangle_hash.c index c369f6eda4..1dc9c67dcc 100644 --- a/source3/smbd/mangle_hash.c +++ b/source3/smbd/mangle_hash.c @@ -57,8 +57,7 @@ static char magic_char = '~'; static const char basechars[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_-!@#$%"; #define MANGLE_BASE (sizeof(basechars)/sizeof(char)-1) -static unsigned char chartest[256] = { 0 }; -static bool ct_initialized = False; +static unsigned char *chartest; #define mangle(V) ((char)(basechars[(V) % MANGLE_BASE])) #define BASECHAR_MASK 0xf0 @@ -334,13 +333,13 @@ static void init_chartest( void ) { const unsigned char *s; - memset( (char *)chartest, '\0', 256 ); + chartest = SMB_MALLOC_ARRAY(unsigned char, 256); + + SMB_ASSERT(chartest != NULL); for( s = (const unsigned char *)basechars; *s; s++ ) { chartest[*s] |= BASECHAR_MASK; } - - ct_initialized = True; } /* ************************************************************************** ** @@ -367,8 +366,9 @@ static bool is_mangled(const char *s, const struct share_params *p) magic_char = lp_magicchar(p); - if( !ct_initialized ) + if (chartest == NULL) { init_chartest(); + } magic = strchr_m( s, magic_char ); while( magic && magic[1] && magic[2] ) { /* 3 chars, 1st is magic. */ -- cgit