diff options
author | Mika Lindqvist <postmaster@raasu.org> | 2017-05-03 20:14:57 +0300 |
---|---|---|
committer | Hans Kristian Rosbach <hk-github@circlestorm.org> | 2017-05-03 19:14:57 +0200 |
commit | 5adc2052ebdd2578fde4ee3ebc500d71e967b8ae (patch) | |
tree | aee917ad21a950e5f1d8616446d38682b55100de /adler32.c | |
parent | a7c7119009a65f2bf554faab19583650bf5fa0f7 (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.c | 4 |
1 files changed, 0 insertions, 4 deletions
@@ -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); } |