diff options
Diffstat (limited to 'xdelta3/xdelta3-djw.h')
-rw-r--r-- | xdelta3/xdelta3-djw.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/xdelta3/xdelta3-djw.h b/xdelta3/xdelta3-djw.h index deff7cb..385775a 100644 --- a/xdelta3/xdelta3-djw.h +++ b/xdelta3/xdelta3-djw.h | |||
@@ -911,8 +911,15 @@ xd3_real_encode_huff (xd3_stream *stream, | |||
911 | DJW_SECTORSZ_BITS, (sector_size/DJW_SECTORSZ_MULT)-1))) { goto failure; } | 911 | DJW_SECTORSZ_BITS, (sector_size/DJW_SECTORSZ_MULT)-1))) { goto failure; } |
912 | 912 | ||
913 | /* Dynamic allocation. */ | 913 | /* Dynamic allocation. */ |
914 | if (gbest == NULL) { gbest = xd3_alloc (stream, gbest_max, 1); } | 914 | if (gbest == NULL) |
915 | if (gbest_mtf == NULL) { gbest_mtf = xd3_alloc (stream, gbest_max, 1); } | 915 | { |
916 | if ((gbest = xd3_alloc (stream, gbest_max, 1)) == NULL) { ret = ENOMEM; goto failure; } | ||
917 | } | ||
918 | |||
919 | if (gbest_mtf == NULL) | ||
920 | { | ||
921 | if ((gbest_mtf = xd3_alloc (stream, gbest_max, 1)) == NULL) { ret = ENOMEM; goto failure; } | ||
922 | } | ||
916 | 923 | ||
917 | /* OPT: Some of the inner loops can be optimized, as shown in bzip2 */ | 924 | /* OPT: Some of the inner loops can be optimized, as shown in bzip2 */ |
918 | 925 | ||
@@ -1005,6 +1012,7 @@ xd3_real_encode_huff (xd3_stream *stream, | |||
1005 | if (gcost[gp] < best) { best = gcost[gp]; winner = gp; } | 1012 | if (gcost[gp] < best) { best = gcost[gp]; winner = gp; } |
1006 | } | 1013 | } |
1007 | 1014 | ||
1015 | XD3_ASSERT(gbest_no < gbest_max); | ||
1008 | gbest[gbest_no++] = winner; | 1016 | gbest[gbest_no++] = winner; |
1009 | IF_DEBUG1 (gcount[winner] += 1); | 1017 | IF_DEBUG1 (gcount[winner] += 1); |
1010 | 1018 | ||