From a8f0f08c68fbcf3143efa71de1946aea915bd45e Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Mon, 26 Nov 2001 07:23:34 +0000 Subject: [PATCH] move some bogus kvp utility to its own file git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6066 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/engine/Account.c | 61 +++--------------------------------------- src/engine/Makefile.am | 3 +++ 2 files changed, 6 insertions(+), 58 deletions(-) diff --git a/src/engine/Account.c b/src/engine/Account.c index b312442a8d..5e8a5fa95a 100644 --- a/src/engine/Account.c +++ b/src/engine/Account.c @@ -39,6 +39,7 @@ #include "gnc-engine-util.h" #include "gnc-event-p.h" #include "kvp_frame.h" +#include "kvp-util-p.h" #include "messages.h" static short module = MOD_ENGINE; @@ -52,7 +53,6 @@ static short module = MOD_ENGINE; \********************************************************************/ static void xaccAccountBringUpToDate (Account *); -static void gemini (kvp_frame *, const GUID *, const GUID *, time_t); /********************************************************************\ \********************************************************************/ @@ -184,8 +184,8 @@ xaccCloneAccount (const Account *from, GNCBook *book) xaccAccountSetCommodity (ret, from->commodity); /* make a note of where the copy came from */ - gemini (ret->kvp_data, &from->guid, &from->book->guid, now); - gemini (from->kvp_data, &ret->guid, &book->guid, now); + gnc_kvp_gemini (ret->kvp_data, &from->guid, &from->book->guid, now); + gnc_kvp_gemini (from->kvp_data, &ret->guid, &book->guid, now); gnc_engine_generate_event (&ret->guid, GNC_EVENT_CREATE); @@ -194,61 +194,6 @@ xaccCloneAccount (const Account *from, GNCBook *book) return ret; } -/********************************************************************\ -\********************************************************************/ -/* mark the guid and date of the copy, using kvp. The info will be - * places in /gemini/ncopies, /gemini//acct_guid, /gemini//book_guid, - * /gemini//date, where = ncopies-1. - */ - -static void -gemini (kvp_frame *kvp_root, const GUID *acct_guid, - const GUID *book_guid, time_t secs) -{ - char buff[80]; - kvp_frame *cwd, *pwd; - kvp_value *v_ncopies, *vvv; - gint64 ncopies = 0; - Timespec ts; - - /* cwd == 'current working directory' */ - pwd = kvp_frame_get_frame (kvp_root, "gemini"); - if (!pwd) - { - pwd = kvp_frame_new(); - kvp_frame_set_slot_nc (kvp_root, - "gemini", kvp_value_new_frame(pwd)); - } - - /* find, increment, store number of copies */ - v_ncopies = kvp_frame_get_slot (pwd, "ncopies"); - if (v_ncopies) - { - ncopies = kvp_value_get_gint64 (v_ncopies); - } - - ncopies ++; - v_ncopies = kvp_value_new_gint64 (ncopies); - kvp_frame_set_slot_nc (pwd, "ncopies", v_ncopies); - - /* OK, now create subdirectory and put the actual data */ - --ncopies; - sprintf (buff, "%lld", ncopies); - cwd = kvp_frame_new(); - kvp_frame_set_slot_nc(pwd, buff, kvp_value_new_frame(cwd)); - - vvv = kvp_value_new_guid (acct_guid); - kvp_frame_set_slot_nc (cwd, "acct_guid", vvv); - - vvv = kvp_value_new_guid (book_guid); - kvp_frame_set_slot_nc (cwd, "book_guid", vvv); - - ts.tv_sec = secs; - ts.tv_nsec = 0; - vvv = kvp_value_new_timespec (ts); - kvp_frame_set_slot_nc (cwd, "date", vvv); -} - /* ================================================================ */ Account * diff --git a/src/engine/Makefile.am b/src/engine/Makefile.am index fe018eb45f..a977dff9b7 100644 --- a/src/engine/Makefile.am +++ b/src/engine/Makefile.am @@ -12,6 +12,7 @@ libgncmod_engine_la_SOURCES = \ FreqSpec.c \ GNCId.c \ Group.c \ + Period.c \ Query.c \ SchedXaction.c \ SX-ttinfo.c \ @@ -31,6 +32,7 @@ libgncmod_engine_la_SOURCES = \ gncmod-engine.c \ guid.c \ kvp_frame.c \ + kvp-util.c \ md5.c \ messages.c @@ -78,6 +80,7 @@ noinst_HEADERS = \ gnc-event-p.h \ gnc-pricedb-p.h \ gnc-session-p.h \ + kvp-util-p.h \ md5.h libgncmod_engine_la_LDFLAGS = -module