diff options
author | Ulrich Drepper <drepper@redhat.com> | 2008-05-18 03:57:19 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2008-05-18 03:57:19 +0000 |
commit | 8884028c8e09ebcfb61634f212b62349606784aa (patch) | |
tree | 8121c35a6b5b766dd7bf656b12efdfe29bb11586 /nscd/mem.c | |
parent | b21595750e4feda0c0478579070d98f41b4f845f (diff) | |
download | glibc-8884028c8e09ebcfb61634f212b62349606784aa.tar.gz glibc-8884028c8e09ebcfb61634f212b62349606784aa.tar.xz glibc-8884028c8e09ebcfb61634f212b62349606784aa.zip |
* nscd/nscd.h (mem_in_flight): Replace blockaddr field with
blockoff of type nscd_ssize_t. * nscd/mem.c (gc): Simplify markrange call for on-flight blocks. (mempoll_alloc): Record block offset and not address.
Diffstat (limited to 'nscd/mem.c')
-rw-r--r-- | nscd/mem.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/nscd/mem.c b/nscd/mem.c index 21f2ae821d..903f91f18b 100644 --- a/nscd/mem.c +++ b/nscd/mem.c @@ -212,11 +212,12 @@ gc (struct database_dyn *db) for (enum in_flight idx = IDX_result_data; idx < IDX_last && mrunp->block[idx].dbidx == db - dbs; ++idx) { - assert ((char *) mrunp->block[idx].blockaddr > db->data); - assert ((char *) mrunp->block[idx].blockaddr - + mrunp->block[0].blocklen <= db->data + db->memsize); - markrange (mark, (char *) mrunp->block[idx].blockaddr - db->data, - mrunp->block[idx].blocklen); + assert (mrunp->block[idx].blockoff >= 0); + assert (mrunp->block[idx].blocklen < db->memsize); + assert (mrunp->block[idx].blockoff + + mrunp->block[0].blocklen <= db->memsize); + markrange (mark, mrunp->block[idx].blockoff, + mrunp->block[idx].blocklen); } mrunp = mrunp->next; @@ -589,15 +590,16 @@ mempool_alloc (struct database_dyn *db, size_t len, enum in_flight idx) } else { - db->head->first_free += len; - - db->last_alloc_failed = false; - /* Remember that we have allocated this memory. */ assert (idx >= 0 && idx < IDX_last); mem_in_flight.block[idx].dbidx = db - dbs; mem_in_flight.block[idx].blocklen = len; - mem_in_flight.block[idx].blockaddr = res; + mem_in_flight.block[idx].blockoff = db->head->first_free; + + db->head->first_free += len; + + db->last_alloc_failed = false; + } pthread_mutex_unlock (&db->memlock); |