The kvp_frame_get_string() function returns a pointer to an internal

string.  Mark it 'const' to prevent callers from trying to free it.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13786 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton 2006-04-15 16:40:03 +00:00
parent 39fad14808
commit dc28af130f
8 changed files with 23 additions and 12 deletions

View File

@ -1,3 +1,14 @@
2006-04-15 David Hampton <hampton@employees.org>
* src/engine/Account.c:
* src/engine/gw-engine-spec.scm:
* src/engine/Transaction.c:
* src/engine/Transaction.h:
* src/engine/Split.c:
* lib/libqof/qof/kvp_frame.[ch]: The kvp_frame_get_string()
function returns a pointer to an internal string. Mark it 'const'
to prevent callers from trying to free it.
2006-04-14 David Hampton <hampton@employees.org>
* src/register/ledger-core/split-register-load.c:

View File

@ -868,7 +868,7 @@ kvp_frame_get_numeric(const KvpFrame *frame, const char *path)
return kvp_value_get_numeric(kvp_frame_get_slot (frame, key));
}
char *
const char *
kvp_frame_get_string(const KvpFrame *frame, const char *path)
{
char *key = NULL;

View File

@ -183,7 +183,7 @@ Use kvp_frame_set_string instead of kvp_frame_set_str
* The kvp_frame_set_frame_nc() routine works as above, but does
* *NOT* copy the frame.
*/
void kvp_frame_set_string(KvpFrame * frame, const gchar * path, const char* str);
void kvp_frame_set_string(KvpFrame * frame, const gchar * path, const gchar* str);
void kvp_frame_set_guid(KvpFrame * frame, const gchar * path, const GUID *guid);
void kvp_frame_set_frame(KvpFrame *frame, const gchar *path, KvpFrame *chld);
@ -348,7 +348,7 @@ KvpFrame * kvp_frame_add_value_nc(KvpFrame * frame, const gchar * path, KvpValue
gint64 kvp_frame_get_gint64(const KvpFrame *frame, const gchar *path);
double kvp_frame_get_double(const KvpFrame *frame, const gchar *path);
gnc_numeric kvp_frame_get_numeric(const KvpFrame *frame, const gchar *path);
gchar * kvp_frame_get_string(const KvpFrame *frame, const gchar *path);
const gchar * kvp_frame_get_string(const KvpFrame *frame, const gchar *path);
GUID * kvp_frame_get_guid(const KvpFrame *frame, const gchar *path);
void * kvp_frame_get_binary(const KvpFrame *frame, const gchar *path,
guint64 * size_return);
@ -677,7 +677,7 @@ gboolean kvp_value_binary_append(KvpValue *v, void *data, guint64 size);
slot values. You must handle that in proc, with a suitable
recursive call if desired. */
void kvp_frame_for_each_slot(KvpFrame *f,
void (*proc)(const char *key,
void (*proc)(const gchar *key,
KvpValue *value,
gpointer data),
gpointer data);

View File

@ -1918,7 +1918,7 @@ xaccAccountSetTaxUSPayerNameSource (Account *acc, const char *source)
gboolean
xaccAccountGetPlaceholder (const Account *acc)
{
char *str;
const char *str;
if (!acc) return FALSE;
str = kvp_frame_get_string(acc->inst.kvp_data, "placeholder");
@ -1963,7 +1963,7 @@ xaccAccountGetDescendantPlaceholder (const Account *acc)
gboolean
xaccAccountGetHidden (const Account *acc)
{
char *str;
const char *str;
if (!acc) return FALSE;
str = kvp_frame_get_string(acc->inst.kvp_data, "hidden");
@ -2396,7 +2396,7 @@ xaccAccountClearReconcilePostpone (Account *acc)
gboolean
xaccAccountGetAutoInterestXfer (const Account *acc, gboolean default_value)
{
char *str = NULL;
const char *str = NULL;
if (!acc) return default_value;
str = kvp_frame_get_string(acc->inst.kvp_data,

View File

@ -1595,7 +1595,7 @@ xaccSplitGetBook (const Split *split)
const char *
xaccSplitGetType(const Split *s)
{
char *split_type;
const char *split_type;
if (!s) return NULL;
split_type = kvp_frame_get_string(s->inst.kvp_data, "split-type");

View File

@ -1747,7 +1747,7 @@ xaccTransGetVoidStatus(const Transaction *trans)
return (kvp_frame_get_slot(trans->inst.kvp_data, void_reason_str) != NULL);
}
char *
const char *
xaccTransGetVoidReason(const Transaction *trans)
{
g_return_val_if_fail(trans, NULL);
@ -1757,7 +1757,7 @@ xaccTransGetVoidReason(const Transaction *trans)
Timespec
xaccTransGetVoidTime(const Transaction *tr)
{
char *val;
const char *val;
Timespec void_time = {0,0};
g_return_val_if_fail(tr, void_time);

View File

@ -505,7 +505,7 @@ gboolean xaccTransGetVoidStatus(const Transaction *transaction);
*
* @return A pointer to the user supplied reason for voiding.
*/
char *xaccTransGetVoidReason(const Transaction *transaction);
const char *xaccTransGetVoidReason(const Transaction *transaction);
/** Returns the time that a transaction was voided.
*

View File

@ -566,7 +566,7 @@ value. It is meant to be a short descriptive phrase.")
(gw:wrap-function
ws
'gnc:transaction-get-void-reason
'(<gw:mchars> callee-owned)
'(<gw:mchars> callee-owned const)
"xaccTransGetVoidReason"
'((<gnc:Transaction*> transaction))
"return a string indicating reason for voiding")