diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-06-25 15:37:07 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-06-25 15:37:07 +0000 |
commit | 94f01bdd2fda575769f01f8072689fa6936af8f4 (patch) | |
tree | c2ffd2a36b7babe0b47335f407b3f20e71bb25ba /src/util/crypto_crc.c | |
parent | 2d4ae427e8d2a4bc305c42100d5cb35a75916879 (diff) | |
download | gnunet-94f01bdd2fda575769f01f8072689fa6936af8f4.tar.gz gnunet-94f01bdd2fda575769f01f8072689fa6936af8f4.zip |
cleaning argz mess
Diffstat (limited to 'src/util/crypto_crc.c')
-rw-r--r-- | src/util/crypto_crc.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/util/crypto_crc.c b/src/util/crypto_crc.c index a89b059c5..8f5cfc800 100644 --- a/src/util/crypto_crc.c +++ b/src/util/crypto_crc.c | |||
@@ -52,10 +52,16 @@ static uLong crc_table[256]; | |||
52 | * with the ccorrect final value. Thus, it is safe to call | 52 | * with the ccorrect final value. Thus, it is safe to call |
53 | * even on a table that someone else is using concurrently. | 53 | * even on a table that someone else is using concurrently. |
54 | */ | 54 | */ |
55 | void __attribute__ ((constructor)) GNUNET_CRYPTO_crc_init () | 55 | static void |
56 | crc_init () | ||
56 | { | 57 | { |
58 | static int once; | ||
57 | unsigned int i, j; | 59 | unsigned int i, j; |
58 | uLong h = 1; | 60 | uLong h = 1; |
61 | |||
62 | if (once) | ||
63 | return; | ||
64 | once = 1; | ||
59 | crc_table[0] = 0; | 65 | crc_table[0] = 0; |
60 | for (i = 128; i; i >>= 1) | 66 | for (i = 128; i; i >>= 1) |
61 | { | 67 | { |
@@ -79,6 +85,7 @@ void __attribute__ ((constructor)) GNUNET_CRYPTO_crc_init () | |||
79 | static uLong | 85 | static uLong |
80 | crc32 (uLong crc, const char *buf, size_t len) | 86 | crc32 (uLong crc, const char *buf, size_t len) |
81 | { | 87 | { |
88 | crc_init (); | ||
82 | GNUNET_assert (crc_table[255] != 0); | 89 | GNUNET_assert (crc_table[255] != 0); |
83 | crc ^= 0xffffffff; | 90 | crc ^= 0xffffffff; |
84 | while (len--) | 91 | while (len--) |