summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-03-02 07:30:48 +0000
committerJeffrey Stedfast <fejj@src.gnome.org>2003-03-02 07:30:48 +0000
commitecd0e29dd0c08762c2a310b96a8a567ec29c5006 (patch)
tree4416f88f9ddaf9caf6b1b774f7640a39b915f1d1
parentee602bd672a2667a581a636aeaaaab47517cef00 (diff)
downloadgmime-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--ChangeLog8
-rw-r--r--gmime/gmime-iconv.c6
2 files changed, 12 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index fcb74e6f..86675456 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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);
}