]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Improve dictionary handling.
authorHans Kristian Rosbach <hk-git@circlestorm.org>
Thu, 11 Jun 2015 15:05:30 +0000 (17:05 +0200)
committerHans Kristian Rosbach <hk-git@circlestorm.org>
Mon, 22 Jun 2015 21:15:45 +0000 (23:15 +0200)
Based on commit e07ac7d8 from Cloudflare's fork, by Vlad Krasnov.

deflate.c

index 65ea7537f6a5d8a3137ae49cbc020998e32a353a..395fd46d14de4521579fe2174cf5fe20e726b9c7 100644 (file)
--- a/deflate.c
+++ b/deflate.c
@@ -386,13 +386,8 @@ int ZEXPORT deflateSetDictionary(z_stream *strm, const unsigned char *dictionary
     while (s->lookahead >= MIN_MATCH) {
         str = s->strstart;
         n = s->lookahead - (MIN_MATCH-1);
-        do {
-            UPDATE_HASH(s, s->ins_h, str);
-            s->prev[str & s->w_mask] = s->head[s->ins_h];
-            s->head[s->ins_h] = (Pos)str;
-            str++;
-        } while (--n);
-        s->strstart = str;
+        bulk_insert_str(s, str, n);
+        s->strstart = str + n;
         s->lookahead = MIN_MATCH-1;
         fill_window(s);
     }