summaryrefslogtreecommitdiff
path: root/adler32.c
diff options
context:
space:
mode:
authorMika Lindqvist <postmaster@raasu.org>2017-05-03 20:14:57 +0300
committerHans Kristian Rosbach <hk-github@circlestorm.org>2017-05-03 19:14:57 +0200
commit5adc2052ebdd2578fde4ee3ebc500d71e967b8ae (patch)
treeaee917ad21a950e5f1d8616446d38682b55100de /adler32.c
parenta7c7119009a65f2bf554faab19583650bf5fa0f7 (diff)
Lazily initialize functable members. (#108)
- Split functableInit() function as separate functions for each functable member, so we don't need to initialize full functable in multiple places in the zlib-ng code, or to check for NULL on every invocation. - Optimized function for each functable member is detected on first invocation and the functable item is updated for subsequent invocations. - Remove NULL check in adler32() and adler32_z() as it is no longer needed.
Diffstat (limited to 'adler32.c')
-rw-r--r--adler32.c4
1 files changed, 0 insertions, 4 deletions
diff --git a/adler32.c b/adler32.c
index dcfeecd..f84c73c 100644
--- a/adler32.c
+++ b/adler32.c
@@ -145,15 +145,11 @@ uint32_t adler32_c(uint32_t adler, const unsigned char *buf, size_t len) {
}
uint32_t ZEXPORT adler32_z(uint32_t adler, const unsigned char *buf, size_t len) {
- if (functable.adler32 == NULL)
- functableInit();
return functable.adler32(adler, buf, len);
}
/* ========================================================================= */
uint32_t ZEXPORT adler32(uint32_t adler, const unsigned char *buf, uint32_t len) {
- if (functable.adler32 == NULL)
- functableInit();
return functable.adler32(adler, buf, len);
}