gnumeric r16599 - branches/gnumeric-1-8/plugins/fn-lookup
- From: mortenw svn gnome org
- To: svn-commits-list gnome org
- Subject: gnumeric r16599 - branches/gnumeric-1-8/plugins/fn-lookup
- Date: Thu, 22 May 2008 20:16:45 +0000 (UTC)
Author: mortenw
Date: Thu May 22 20:16:44 2008
New Revision: 16599
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16599&view=rev
Log:
2008-05-22 Morten Welinder <terra gnome org>
* functions.c (get_cache): Properly split caches for floats and
strings as intended.
Modified:
branches/gnumeric-1-8/plugins/fn-lookup/ChangeLog
branches/gnumeric-1-8/plugins/fn-lookup/functions.c
Modified: branches/gnumeric-1-8/plugins/fn-lookup/functions.c
==============================================================================
--- branches/gnumeric-1-8/plugins/fn-lookup/functions.c (original)
+++ branches/gnumeric-1-8/plugins/fn-lookup/functions.c Thu May 22 20:16:44 2008
@@ -70,7 +70,7 @@
get_cache (GnmFuncEvalInfo *ei, GnmValue const *data, gboolean stringp)
{
GnmSheetRange sr;
- GHashTable *h;
+ GHashTable *h, *cache;
Sheet *end_sheet;
GnmRangeRef const *rr;
@@ -88,9 +88,16 @@
(GEqualFunc)gnm_sheet_range_equal,
(GDestroyNotify)gnm_sheet_range_free,
(GDestroyNotify)g_hash_table_destroy);
+ lookup_float_cache = g_hash_table_new_full
+ ((GHashFunc)gnm_sheet_range_hash,
+ (GEqualFunc)gnm_sheet_range_equal,
+ (GDestroyNotify)gnm_sheet_range_free,
+ (GDestroyNotify)g_hash_table_destroy);
}
- h = g_hash_table_lookup (lookup_string_cache, &sr);
+ cache = stringp ? lookup_string_cache : lookup_float_cache;
+
+ h = g_hash_table_lookup (cache, &sr);
if (!h) {
if (stringp)
h = g_hash_table_new_full (g_str_hash,
@@ -100,8 +107,7 @@
h = g_hash_table_new_full ((GHashFunc)gnm_float_hash,
(GEqualFunc)gnm_float_equal,
g_free, NULL);
- g_hash_table_insert (lookup_string_cache,
- gnm_sheet_range_dup (&sr), h);
+ g_hash_table_insert (cache, gnm_sheet_range_dup (&sr), h);
}
return h;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]