Remove misleading (char*) casts.

2005-10-08  Christian Stimming  <stimming@tuhh.de>

	* src/engine/Transaction.c: Remove misleading (char*) casts by
	Linas Vepstas from 2003-09-14, but nevertheless the code doesn't
	have any errorneous double-free's at this point.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@11414 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming 2005-10-08 15:28:26 +00:00
parent 16d548a9b7
commit 06e9c1cc71
2 changed files with 25 additions and 19 deletions

View File

@ -1,3 +1,9 @@
2005-10-08 Christian Stimming <stimming@tuhh.de>
* src/engine/Transaction.c: Remove misleading (char*) casts by
Linas Vepstas from 2003-09-14, but nevertheless the code doesn't
have any errorneous double-free's at this point.
2005-10-07 Christian Stimming <stimming@tuhh.de> 2005-10-07 Christian Stimming <stimming@tuhh.de>
* src/engine/iso-4217-currencies.scm: Fix spelling of TJS * src/engine/iso-4217-currencies.scm: Fix spelling of TJS

View File

@ -311,16 +311,16 @@ kvp_frame_get_frame_or_null_slash_trash (const KvpFrame *frame, char *key_path)
*/ */
static inline KvpFrame * static inline KvpFrame *
get_trailer_make (KvpFrame * frame, const char * key_path, char **end_key) get_trailer_make (KvpFrame * frame, const char * key_path, const char **end_key)
{ {
char *last_key; const char *last_key;
if (!frame || !key_path || (0 == key_path[0])) return NULL; if (!frame || !key_path || (0 == key_path[0])) return NULL;
last_key = strrchr (key_path, '/'); last_key = strrchr (key_path, '/');
if (NULL == last_key) if (NULL == last_key)
{ {
last_key = (char *) key_path; last_key = key_path;
} }
else if (last_key == key_path) else if (last_key == key_path)
{ {
@ -353,16 +353,16 @@ get_trailer_make (KvpFrame * frame, const char * key_path, char **end_key)
*/ */
static inline const KvpFrame * static inline const KvpFrame *
get_trailer_or_null (const KvpFrame * frame, const char * key_path, char **end_key) get_trailer_or_null (const KvpFrame * frame, const char * key_path, const char **end_key)
{ {
char *last_key; const char *last_key;
if (!frame || !key_path || (0 == key_path[0])) return NULL; if (!frame || !key_path || (0 == key_path[0])) return NULL;
last_key = strrchr (key_path, '/'); last_key = strrchr (key_path, '/');
if (NULL == last_key) if (NULL == last_key)
{ {
last_key = (char *) key_path; last_key = key_path;
} }
else if (last_key == key_path) else if (last_key == key_path)
{ {
@ -468,7 +468,7 @@ KvpFrame *
kvp_frame_set_value_nc (KvpFrame * frame, const char * key_path, kvp_frame_set_value_nc (KvpFrame * frame, const char * key_path,
KvpValue * value) KvpValue * value)
{ {
char *last_key; const char *last_key;
frame = get_trailer_make (frame, key_path, &last_key); frame = get_trailer_make (frame, key_path, &last_key);
if (!frame) return NULL; if (!frame) return NULL;
@ -481,7 +481,7 @@ kvp_frame_set_value (KvpFrame * frame, const char * key_path,
const KvpValue * value) const KvpValue * value)
{ {
KvpValue *new_value = NULL; KvpValue *new_value = NULL;
char *last_key; const char *last_key;
frame = get_trailer_make (frame, key_path, &last_key); frame = get_trailer_make (frame, key_path, &last_key);
if (!frame) return NULL; if (!frame) return NULL;
@ -496,7 +496,7 @@ kvp_frame_replace_value_nc (KvpFrame * frame, const char * key_path,
KvpValue * new_value) KvpValue * new_value)
{ {
KvpValue * old_value; KvpValue * old_value;
char *last_key; const char *last_key;
last_key = NULL; last_key = NULL;
if (new_value) if (new_value)
@ -518,7 +518,7 @@ kvp_frame_replace_value_nc (KvpFrame * frame, const char * key_path,
KvpFrame * KvpFrame *
kvp_frame_add_value_nc(KvpFrame * frame, const char * path, KvpValue *value) kvp_frame_add_value_nc(KvpFrame * frame, const char * path, KvpValue *value)
{ {
char *key = NULL; const char *key = NULL;
KvpValue *oldvalue; KvpValue *oldvalue;
frame = (KvpFrame *) get_trailer_or_null (frame, path, &key); frame = (KvpFrame *) get_trailer_or_null (frame, path, &key);
@ -854,7 +854,7 @@ kvp_frame_add_url_encoding (KvpFrame *frame, const char *enc)
gint64 gint64
kvp_frame_get_gint64(const KvpFrame *frame, const char *path) kvp_frame_get_gint64(const KvpFrame *frame, const char *path)
{ {
char *key = NULL; const char *key = NULL;
frame = get_trailer_or_null (frame, path, &key); frame = get_trailer_or_null (frame, path, &key);
return kvp_value_get_gint64(kvp_frame_get_slot (frame, key)); return kvp_value_get_gint64(kvp_frame_get_slot (frame, key));
} }
@ -862,7 +862,7 @@ kvp_frame_get_gint64(const KvpFrame *frame, const char *path)
double double
kvp_frame_get_double(const KvpFrame *frame, const char *path) kvp_frame_get_double(const KvpFrame *frame, const char *path)
{ {
char *key = NULL; const char *key = NULL;
frame = get_trailer_or_null (frame, path, &key); frame = get_trailer_or_null (frame, path, &key);
return kvp_value_get_double(kvp_frame_get_slot (frame, key)); return kvp_value_get_double(kvp_frame_get_slot (frame, key));
} }
@ -870,7 +870,7 @@ kvp_frame_get_double(const KvpFrame *frame, const char *path)
gnc_numeric gnc_numeric
kvp_frame_get_numeric(const KvpFrame *frame, const char *path) kvp_frame_get_numeric(const KvpFrame *frame, const char *path)
{ {
char *key = NULL; const char *key = NULL;
frame = get_trailer_or_null (frame, path, &key); frame = get_trailer_or_null (frame, path, &key);
return kvp_value_get_numeric(kvp_frame_get_slot (frame, key)); return kvp_value_get_numeric(kvp_frame_get_slot (frame, key));
} }
@ -878,7 +878,7 @@ kvp_frame_get_numeric(const KvpFrame *frame, const char *path)
char * char *
kvp_frame_get_string(const KvpFrame *frame, const char *path) kvp_frame_get_string(const KvpFrame *frame, const char *path)
{ {
char *key = NULL; const char *key = NULL;
frame = get_trailer_or_null (frame, path, &key); frame = get_trailer_or_null (frame, path, &key);
return kvp_value_get_string(kvp_frame_get_slot (frame, key)); return kvp_value_get_string(kvp_frame_get_slot (frame, key));
} }
@ -886,7 +886,7 @@ kvp_frame_get_string(const KvpFrame *frame, const char *path)
GUID * GUID *
kvp_frame_get_guid(const KvpFrame *frame, const char *path) kvp_frame_get_guid(const KvpFrame *frame, const char *path)
{ {
char *key = NULL; const char *key = NULL;
frame = get_trailer_or_null (frame, path, &key); frame = get_trailer_or_null (frame, path, &key);
return kvp_value_get_guid(kvp_frame_get_slot (frame, key)); return kvp_value_get_guid(kvp_frame_get_slot (frame, key));
} }
@ -895,7 +895,7 @@ void *
kvp_frame_get_binary(const KvpFrame *frame, const char *path, kvp_frame_get_binary(const KvpFrame *frame, const char *path,
guint64 * size_return) guint64 * size_return)
{ {
char *key = NULL; const char *key = NULL;
frame = get_trailer_or_null (frame, path, &key); frame = get_trailer_or_null (frame, path, &key);
return kvp_value_get_binary(kvp_frame_get_slot (frame, key), size_return); return kvp_value_get_binary(kvp_frame_get_slot (frame, key), size_return);
} }
@ -903,7 +903,7 @@ kvp_frame_get_binary(const KvpFrame *frame, const char *path,
Timespec Timespec
kvp_frame_get_timespec(const KvpFrame *frame, const char *path) kvp_frame_get_timespec(const KvpFrame *frame, const char *path)
{ {
char *key = NULL; const char *key = NULL;
frame = get_trailer_or_null (frame, path, &key); frame = get_trailer_or_null (frame, path, &key);
return kvp_value_get_timespec(kvp_frame_get_slot (frame, key)); return kvp_value_get_timespec(kvp_frame_get_slot (frame, key));
} }
@ -911,7 +911,7 @@ kvp_frame_get_timespec(const KvpFrame *frame, const char *path)
KvpFrame * KvpFrame *
kvp_frame_get_frame(const KvpFrame *frame, const char *path) kvp_frame_get_frame(const KvpFrame *frame, const char *path)
{ {
char *key = NULL; const char *key = NULL;
frame = get_trailer_or_null (frame, path, &key); frame = get_trailer_or_null (frame, path, &key);
return kvp_value_get_frame(kvp_frame_get_slot (frame, key)); return kvp_value_get_frame(kvp_frame_get_slot (frame, key));
} }
@ -919,7 +919,7 @@ kvp_frame_get_frame(const KvpFrame *frame, const char *path)
KvpValue * KvpValue *
kvp_frame_get_value(const KvpFrame *frame, const char *path) kvp_frame_get_value(const KvpFrame *frame, const char *path)
{ {
char *key = NULL; const char *key = NULL;
frame = get_trailer_or_null (frame, path, &key); frame = get_trailer_or_null (frame, path, &key);
return kvp_frame_get_slot (frame, key); return kvp_frame_get_slot (frame, key);
} }