diff options
author | Volker Lendecke <vl@samba.org> | 2007-12-28 17:02:07 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2007-12-28 17:02:07 +0100 |
commit | 4cdce5b50e286aab457611d2c634cb79990795fd (patch) | |
tree | eb34fdb92de1af7ba9d8772f0f87a3b718f4f355 | |
parent | 3c99b7773ef62d13a7e3611be0603a5807315d9d (diff) | |
download | samba-4cdce5b50e286aab457611d2c634cb79990795fd.tar.gz samba-4cdce5b50e286aab457611d2c634cb79990795fd.tar.bz2 samba-4cdce5b50e286aab457611d2c634cb79990795fd.zip |
Remove a static array
This might be worth it, mangle_hash is hardly used these days
(This used to be commit 44775ea38bc320ac8e2208769a8cde2c6f44f640)
-rw-r--r-- | source3/smbd/mangle_hash.c | 12 |
1 files 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. */ |