diff --git a/src/engine/Account.c b/src/engine/Account.c index fcb09ff9fc..86aa2b2c60 100644 --- a/src/engine/Account.c +++ b/src/engine/Account.c @@ -2411,8 +2411,9 @@ xaccAccountSetReconcileLastInterval (Account *account, int months, int days) xaccAccountBeginEdit (account); - frame = kvp_frame_get_frame (account->inst.kvp_data, + frame = kvp_frame_get_frame_slash (account->inst.kvp_data, "/reconcile-info/last-interval"); + g_assert(frame); kvp_frame_set_gint64 (frame, "months", months); kvp_frame_set_gint64 (frame, "days", days); diff --git a/src/engine/kvp_frame.h b/src/engine/kvp_frame.h index 7d42ba5c5c..e67adbfbd8 100644 --- a/src/engine/kvp_frame.h +++ b/src/engine/kvp_frame.h @@ -286,7 +286,7 @@ KvpFrame * kvp_frame_add_value_nc(KvpFrame * frame, const char * path, KvpValue are "non-copying" -- the returned item is the actual item stored. Do not delete this item unless you take the required care to avoid possible bad pointer derefrences (i.e. core dumps). Also, be - careful anging on to those references if you are also storing + careful hanging on to those references if you are also storing at the same path names: the referenced item will be freed during the store. @@ -305,22 +305,49 @@ void * kvp_frame_get_binary(const KvpFrame *frame, const char *path, guint64 * size_return); Timespec kvp_frame_get_timespec(const KvpFrame *frame, const char *path); KvpValue * kvp_frame_get_value(const KvpFrame *frame, const char *path); +/** Value accessor. Takes a unix-style slash-separated path as an + * argument, and return the KvpFrame stored at that location. If the + * KvpFrame does not exist, then a NULL is returned. + * + * @note The semantics here have changed: In gnucash-1.8, if the + * KvpFrame did not exist, this function automatically created one + * and returned it. However, now this function will return NULL in + * this case and the caller has to create a KvpFrame on his own. The + * old functionality is now implemented by + * kvp_frame_get_frame_path(). This happened on 2003-09-14, revision + * 1.31. FIXME: Is it really a good idea to change the semantics of + * an existing function and move the old semantics to a new + * function??! It would save us a lot of trouble if the new semantics + * would have been available in a new function! + * + * @return The KvpFrame at the specified path, or NULL if it doesn't + * exist. +*/ KvpFrame * kvp_frame_get_frame(const KvpFrame *frame, const char *path); /** This routine returns the last frame of the path. * If the frame path doesn't exist, it is created. * Note that this is *VERY DIFFERENT FROM* like kvp_frame_get_frame() + * + * @note The semantics of this function implemented the gnucash-1.8 + * behaviour of kvp_frame_get_frame: In gnucash-1.8, if the KvpFrame + * did not exist, kvp_frame_get_frame automatically created one and + * returned it. However, now that one will return NULL in this case + * and the caller has to create a KvpFrame on his own. The old + * functionality is implemented by this + * kvp_frame_get_frame_path(). This happened on 2003-09-14, revision + * 1.31. */ KvpFrame * kvp_frame_get_frame_path (KvpFrame *frame, const char *,...); -/** This routine return the last frame of the path. +/** This routine returns the last frame of the path. * If the frame path doesn't exist, it is created. * Note that this is *VERY DIFFERENT FROM* like kvp_frame_get_frame() */ KvpFrame * kvp_frame_get_frame_gslist (KvpFrame *frame, GSList *key_path); -/** This routine return the last frame of the path. +/** This routine returns the last frame of the path. * If the frame path doesn't exist, it is created. * Note that this is *VERY DIFFERENT FROM* like kvp_frame_get_frame() *