diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2003-03-02 07:30:48 +0000 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2003-03-02 07:30:48 +0000 |
commit | ecd0e29dd0c08762c2a310b96a8a567ec29c5006 (patch) | |
tree | 4416f88f9ddaf9caf6b1b774f7640a39b915f1d1 | |
parent | ee602bd672a2667a581a636aeaaaab47517cef00 (diff) | |
download | gmime-ecd0e29dd0c08762c2a310b96a8a567ec29c5006.tar.gz |
If the current list of cache buckets is non-NULL, set list->prev to the
2003-03-02 Jeffrey Stedfast <fejj@ximian.com>
* gmime/gmime-iconv.c (iconv_cache_bucket_new): If the current
list of cache buckets is non-NULL, set list->prev to the new
bucket being prepended.
(g_mime_iconv_open): Only expire unused if the cache size is
greater than the max allowable size.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | gmime/gmime-iconv.c | 6 |
2 files changed, 12 insertions, 2 deletions
@@ -1,3 +1,11 @@ +2003-03-02 Jeffrey Stedfast <fejj@ximian.com> + + * gmime/gmime-iconv.c (iconv_cache_bucket_new): If the current + list of cache buckets is non-NULL, set list->prev to the new + bucket being prepended. + (g_mime_iconv_open): Only expire unused if the cache size is + greater than the max allowable size. + 2003-02-27 Jeffrey Stedfast <fejj@ximian.com> * gmime/gmime-stream-filter.c (stream_read): Set priv->flushed to diff --git a/gmime/gmime-iconv.c b/gmime/gmime-iconv.c index cd426e6d..40f6408f 100644 --- a/gmime/gmime-iconv.c +++ b/gmime/gmime-iconv.c @@ -82,7 +82,6 @@ iconv_cache_bucket_new (const char *key, iconv_t cd) struct _iconv_cache_bucket *bucket; bucket = memchunk_alloc (cache_chunk); - bucket->next = NULL; bucket->prev = NULL; bucket->key = g_strdup (key); bucket->refcount = 1; @@ -97,6 +96,8 @@ iconv_cache_bucket_new (const char *key, iconv_t cd) expire first? */ bucket->next = iconv_cache_buckets; iconv_cache_buckets = bucket; + if (bucket->next) + bucket->next->prev = bucket; iconv_cache_size++; @@ -273,7 +274,8 @@ g_mime_iconv_open (const char *to, const char *from) if (cd == (iconv_t) -1) goto exception; - iconv_cache_expire_unused (); + if (iconv_cache_size >= ICONV_CACHE_SIZE) + iconv_cache_expire_unused (); bucket = iconv_cache_bucket_new (key, cd); } |