diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2018-06-23 13:38:05 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2018-06-23 13:38:05 +0300 |
commit | c458171c6deaa9a8eb70d2f9c2c21a129daeb32d (patch) | |
tree | 56f55c7d84851327c5cd9a244a9e58662264feb6 /src | |
parent | 551d394440d820e877e73c048f8ea4ba1d27bf17 (diff) | |
download | gdbm-c458171c6deaa9a8eb70d2f9c2c21a129daeb32d.tar.gz gdbm-c458171c6deaa9a8eb70d2f9c2c21a129daeb32d.tar.bz2 |
Bugfixes. Consistently use the coalesce_blocks flag.
* src/bucket.c (_gdbm_split_bucket): Take into account coalesce_blocks
* src/falloc.c (_gdbm_put_av_elem): Change to void return. All uses changed.
* src/proto.h: Likewise.
Diffstat (limited to 'src')
-rw-r--r-- | src/bucket.c | 9 | ||||
-rw-r--r-- | src/falloc.c | 21 | ||||
-rw-r--r-- | src/proto.h | 2 |
3 files changed, 15 insertions, 17 deletions
diff --git a/src/bucket.c b/src/bucket.c index 4b69bbe..0597965 100644 --- a/src/bucket.c +++ b/src/bucket.c @@ -363,3 +363,4 @@ _gdbm_split_bucket (GDBM_FILE dbf, int next_insert) bucket[1]->bucket_avail, - &bucket[1]->av_count, FALSE); + &bucket[1]->av_count, + dbf->coalesce_blocks); index = 1; @@ -406,3 +407,4 @@ _gdbm_split_bucket (GDBM_FILE dbf, int next_insert) bucket[1]->bucket_avail, - &bucket[1]->av_count, FALSE); + &bucket[1]->av_count, + dbf->coalesce_blocks); } @@ -414,3 +416,4 @@ _gdbm_split_bucket (GDBM_FILE dbf, int next_insert) bucket[0]->bucket_avail, - &bucket[0]->av_count, FALSE); + &bucket[0]->av_count, + dbf->coalesce_blocks); } diff --git a/src/falloc.c b/src/falloc.c index 2fb8ea1..a2b3fd9 100644 --- a/src/falloc.c +++ b/src/falloc.c @@ -94,4 +94,2 @@ _gdbm_alloc (GDBM_FILE dbf, int num_bytes) - - /* Free space of size NUM_BYTES in the file DBF at file address FILE_ADR. Make @@ -390,3 +388,3 @@ get_elem (int size, avail_elem av_table[], int *av_count) -int +void _gdbm_put_av_elem (avail_elem new_el, avail_elem av_table[], int *av_count, @@ -399,3 +397,3 @@ _gdbm_put_av_elem (avail_elem new_el, avail_elem av_table[], int *av_count, if (new_el.av_size <= IGNORE_SIZE) - return FALSE; + return; @@ -442,3 +440,3 @@ _gdbm_put_av_elem (avail_elem new_el, avail_elem av_table[], int *av_count, /* we're done. */ - return TRUE; + return; } @@ -465,5 +463,3 @@ _gdbm_put_av_elem (avail_elem new_el, avail_elem av_table[], int *av_count, /* Increment the number of elements. */ - *av_count += 1; - - return TRUE; + ++*av_count; } @@ -518,3 +514,2 @@ adjust_bucket_avail (GDBM_FILE dbf) { - //FIXME: what if _gdbm_put_av_elem return FALSE? dbf->header->avail.count -= 1; @@ -533,6 +528,3 @@ adjust_bucket_avail (GDBM_FILE dbf) av_el = get_elem (0, dbf->bucket->bucket_avail, &dbf->bucket->av_count); - if (av_el.av_size == 0 - || _gdbm_put_av_elem (av_el, dbf->header->avail.av_table, - &dbf->header->avail.count, - dbf->coalesce_blocks) == FALSE) + if (av_el.av_size == 0) { @@ -541,2 +533,5 @@ adjust_bucket_avail (GDBM_FILE dbf) } + _gdbm_put_av_elem (av_el, dbf->header->avail.av_table, + &dbf->header->avail.count, + dbf->coalesce_blocks); dbf->bucket_changed = TRUE; diff --git a/src/proto.h b/src/proto.h index e543506..22f29e4 100644 --- a/src/proto.h +++ b/src/proto.h @@ -32,3 +32,3 @@ off_t _gdbm_alloc (GDBM_FILE, int); int _gdbm_free (GDBM_FILE, off_t, int); -int _gdbm_put_av_elem (avail_elem, avail_elem [], int *, int); +void _gdbm_put_av_elem (avail_elem, avail_elem [], int *, int); |