Fix usage of string cache.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3189 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2000-11-21 22:04:47 +00:00
parent 67c7c0d2a6
commit 878bfc048a

View File

@ -167,7 +167,7 @@ xaccCloneSplit (Split *s)
\********************************************************************/ \********************************************************************/
void void
xaccFreeSplit( Split *split ) xaccFreeSplit (Split *split)
{ {
if (!split) return; if (!split) return;
@ -1179,6 +1179,9 @@ xaccSplitRebalance (Split *split)
gnc_numeric value; gnc_numeric value;
const gnc_commodity * base_currency = NULL; const gnc_commodity * base_currency = NULL;
/* let's see how we do without all this stuff */
return;
trans = split->parent; trans = split->parent;
/* We might have gotten here if someone is manipulating /* We might have gotten here if someone is manipulating
@ -1273,13 +1276,13 @@ xaccSplitRebalance (Split *split)
xaccAccountInsertSplit (split->acc, s); xaccAccountInsertSplit (split->acc, s);
g_cache_remove(gnc_string_cache, s->memo); g_cache_remove(gnc_string_cache, s->memo);
s->memo = g_cache_insert(gnc_string_cache, split->memo);
g_cache_remove(gnc_string_cache, s->action); g_cache_remove(gnc_string_cache, s->action);
s->action = g_cache_insert(gnc_string_cache, split->action);
xaccSplitSetValue(s, gnc_numeric_neg(split->value)); xaccSplitSetValue(s, gnc_numeric_neg(split->value));
xaccSplitSetShareAmount(s, gnc_numeric_neg(split->value)); xaccSplitSetShareAmount(s, gnc_numeric_neg(split->value));
s->memo = g_cache_insert(gnc_string_cache, split->memo);
s->action = g_cache_insert(gnc_string_cache, split->action);
} }
} }
} }
@ -1476,13 +1479,13 @@ xaccTransRollbackEdit (Transaction *trans)
* the guid would have been unlisted. Restore that */ * the guid would have been unlisted. Restore that */
xaccStoreEntity(trans, &trans->guid, GNC_ID_TRANS); xaccStoreEntity(trans, &trans->guid, GNC_ID_TRANS);
#define PUT_BACK(val) { g_free(trans->val); \ g_cache_remove (gnc_string_cache, trans->num);
trans->val=orig->val; orig->val=NULL; } trans->num = orig->num;
#define PUT_BACK_CACHE(val) { g_cache_remove(gnc_string_cache, trans->val); \ orig->num = g_cache_insert(gnc_string_cache, "");
trans->val=orig->val; orig->val=NULL; }
PUT_BACK (num); g_cache_remove (gnc_string_cache, trans->description);
PUT_BACK_CACHE (description); trans->description = orig->description;
orig->description = g_cache_insert(gnc_string_cache, "");
trans->date_entered.tv_sec = orig->date_entered.tv_sec; trans->date_entered.tv_sec = orig->date_entered.tv_sec;
trans->date_entered.tv_nsec = orig->date_entered.tv_nsec; trans->date_entered.tv_nsec = orig->date_entered.tv_nsec;
@ -1517,10 +1520,13 @@ xaccTransRollbackEdit (Transaction *trans)
if (so->acc != s->acc) { force_it = 1; mismatch=i; break; } if (so->acc != s->acc) { force_it = 1; mismatch=i; break; }
#define HONKY_CAT(val) { g_free(s->val); s->val=so->val; so->val=NULL; } g_cache_remove (gnc_string_cache, s->action);
s->action = so->action;
so->action = g_cache_insert(gnc_string_cache, "");
HONKY_CAT (action); g_cache_remove (gnc_string_cache, s->memo);
HONKY_CAT (memo); s->memo = so->memo;
so->memo = g_cache_insert(gnc_string_cache, "");
s->reconciled = so->reconciled; s->reconciled = so->reconciled;
s->damount = so->damount; s->damount = so->damount;
@ -1944,7 +1950,7 @@ xaccTransSetDateToday (Transaction *trans)
trans->date_posted.tv_nsec = 1000 * tv.tv_usec; trans->date_posted.tv_nsec = 1000 * tv.tv_usec;
PINFO ("addr=%p set date to %lu %s \n", PINFO ("addr=%p set date to %lu %s \n",
trans, tv.tv_sec, ctime ((time_t *)&tv.tv_sec)); trans, tv.tv_sec, ctime ((time_t *)&tv.tv_sec));
} }