2001-10-11 Dave Peticolas <dave@krondo.com>

* src/register/register-core/table-allgui.c
	(gnc_table_traverse_update): remove assert

	* src/import-export/binary-import/druid-commodity.c: use g_assert

	* src/guile/gnucash.c.in (gnc_main): use g_assert

	* src/gnome-utils/gnc-account-tree.c: remove asserts

	* src/gnome/dialog-fincalc.c (normalize_period): remove asserts

	* src/gnome/dialog-find-transactions.c: remove asserts

	* src/gnome/dialog-scheduledxaction.c: remove asserts

	* src/gnome/reconcile-list.c: remove asserts

	* src/gnome/window-register.c: remove asserts

	* src/engine/Account.c: remove asserts

	* src/engine/Group.c: remove asserts

	* src/engine/Query.c:remove asserts

	* src/engine/TransLog.c: remove asserts

	* src/engine/Transaction.c: remove asserts

	* src/engine/gnc-engine-util.h: don't include assert.h

	* src/engine/gnc-engine.c: remove asserts

	* src/engine/gnc-numeric.c: remove asserts

	* src/engine/gnc-pricedb.c (gnc_price_unref): remove asserts

	* src/engine/messages.c: remove asserts

	* src/backend/file/test/test-xml-account.c: fix text handling

	* src/backend/file/test/test-xml-commodity.c: fix text handling

	* src/backend/file/test/test-xml-transaction.c: fix text handling

	* src/backend/file/gnc-freqspec-xml-v2.c: fix text handling

	* src/backend/file/gnc-pricedb-xml-v2.c: fix text handling

	* src/backend/file/gnc-schedxaction-xml-v2.c: fix text handling

	* src/backend/file/gnc-transaction-xml-v2.c: fix text handling

	* src/backend/file/io-gncxml-v1.c: fix text handling

	* src/backend/file/sixtp-dom-parsers.c: fix text handling

	* src/backend/file/sixtp-to-dom-parser.c (dom_chars_handler): don't
	ignore whitespace. This fixes text handling for strings like "< <"

	* src/app-utils/gnc-ui-util.c: remove asserts

	* src/app-utils/option-util.c: remove asserts


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5576 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2001-10-11 11:35:50 +00:00
parent 3a4d567892
commit 2efd973550
31 changed files with 191 additions and 99 deletions

View File

@ -1,3 +1,69 @@
2001-10-11 Dave Peticolas <dave@krondo.com>
* src/register/register-core/table-allgui.c
(gnc_table_traverse_update): remove assert
* src/import-export/binary-import/druid-commodity.c: use g_assert
* src/guile/gnucash.c.in (gnc_main): use g_assert
* src/gnome-utils/gnc-account-tree.c: remove asserts
* src/gnome/dialog-fincalc.c (normalize_period): remove asserts
* src/gnome/dialog-find-transactions.c: remove asserts
* src/gnome/dialog-scheduledxaction.c: remove asserts
* src/gnome/reconcile-list.c: remove asserts
* src/gnome/window-register.c: remove asserts
* src/engine/Account.c: remove asserts
* src/engine/Group.c: remove asserts
* src/engine/Query.c:remove asserts
* src/engine/TransLog.c: remove asserts
* src/engine/Transaction.c: remove asserts
* src/engine/gnc-engine-util.h: don't include assert.h
* src/engine/gnc-engine.c: remove asserts
* src/engine/gnc-numeric.c: remove asserts
* src/engine/gnc-pricedb.c (gnc_price_unref): remove asserts
* src/engine/messages.c: remove asserts
* src/backend/file/test/test-xml-account.c: fix text handling
* src/backend/file/test/test-xml-commodity.c: fix text handling
* src/backend/file/test/test-xml-transaction.c: fix text handling
* src/backend/file/gnc-freqspec-xml-v2.c: fix text handling
* src/backend/file/gnc-pricedb-xml-v2.c: fix text handling
* src/backend/file/gnc-schedxaction-xml-v2.c: fix text handling
* src/backend/file/gnc-transaction-xml-v2.c: fix text handling
* src/backend/file/io-gncxml-v1.c: fix text handling
* src/backend/file/sixtp-dom-parsers.c: fix text handling
* src/backend/file/sixtp-to-dom-parser.c (dom_chars_handler): don't
ignore whitespace. This fixes text handling for strings like "< <"
* src/app-utils/gnc-ui-util.c: remove asserts
* src/app-utils/option-util.c: remove asserts
2001-10-11 Dave Peticolas <dave@krondo.com>
* src/test-core/test-stuff.c: allow option of including funky

View File

@ -1336,7 +1336,7 @@ PrintAmountInternal(char *buf, gnc_numeric val, const GNCPrintAmountInfo *info)
char temp_buf[64];
gnc_numeric whole;
g_assert (info != NULL);
g_return_val_if_fail (info != NULL, 0);
if (gnc_numeric_check (val))
{

View File

@ -1258,7 +1258,7 @@ compare_option_names(gconstpointer a, gconstpointer b)
gboolean
gnc_option_db_dirty(GNCOptionDB *odb)
{
assert(odb != NULL);
g_return_val_if_fail (odb, FALSE);
return odb->options_dirty;
}
@ -1272,7 +1272,7 @@ gnc_option_db_dirty(GNCOptionDB *odb)
void
gnc_option_db_clean(GNCOptionDB *odb)
{
assert(odb != NULL);
g_return_if_fail (odb);
odb->options_dirty = FALSE;
}
@ -1620,7 +1620,7 @@ gnc_option_db_commit(GNCOptionDB *odb)
GNCOption *option;
gboolean changed_something = FALSE;
assert(odb != NULL);
g_return_if_fail (odb);
section_node = odb->option_sections;
while (section_node != NULL)

View File

@ -270,13 +270,13 @@ gnc_freqSpec_dom_tree_create( FreqSpec *fs )
return ret;
}
static struct dom_tree_handler fs_dom_handlers[];
static
gboolean
gnc_fs_handler( xmlNodePtr node, gpointer d )
{
/* we ignore the wrapper... we were just called at the wrong
level. */
return TRUE;
return dom_tree_generic_parse( node, fs_dom_handlers, d );
}
static
@ -530,7 +530,7 @@ fs_composite_handler( xmlNodePtr node, gpointer data)
return TRUE;
}
struct dom_tree_handler fs_dom_handlers[] = {
static struct dom_tree_handler fs_dom_handlers[] = {
{ "gnc:freqspec", gnc_fs_handler, 0, 0 },
{ "fs:ui_type", fs_uift_handler, 1, 0 },
{ "fs:id", fs_guid_handler, 1, 0 },
@ -598,6 +598,7 @@ dom_tree_to_freqSpec(xmlNodePtr node, GNCSession *session)
fspd.fs = xaccFreqSpecMalloc(session);
successful = dom_tree_generic_parse( node, fs_dom_handlers, &fspd );
if ( !successful ) {
xmlElemDump(stdout, NULL, node);
xaccFreqSpecFree( fspd.fs );
fspd.fs = NULL;
}

View File

@ -162,6 +162,7 @@ price_parse_xml_end_handler(gpointer data_for_children,
for(child = price_xml->xmlChildrenNode; child; child = child->next) {
switch(child->type) {
case XML_COMMENT_NODE:
case XML_TEXT_NODE:
break;
case XML_ELEMENT_NODE:
if(!price_parse_xml_sub_node(p, child, session)) {

View File

@ -358,7 +358,7 @@ sx_freqspec_handler( xmlNodePtr node, gpointer sx_pdata )
g_return_val_if_fail( node, FALSE );
fs = dom_tree_to_freqSpec( xmlGetLastChild( node ), pdata->session );
fs = dom_tree_to_freqSpec( node, pdata->session );
xaccSchedXactionSetFreqSpec( sx, fs );
return TRUE;

View File

@ -468,11 +468,14 @@ trn_splits_handler(xmlNodePtr node, gpointer trans_pdata)
{
Split *spl;
if(safe_strcmp("text", mark->name) == 0)
continue;
if(safe_strcmp("trn:split", mark->name))
{
return FALSE;
}
spl = dom_tree_to_split(mark, pdata->session);
if(spl)

View File

@ -3638,6 +3638,7 @@ price_parse_xml_end_handler(gpointer data_for_children,
for(child = price_xml->xmlChildrenNode; child; child = child->next) {
switch(child->type) {
case XML_COMMENT_NODE:
case XML_TEXT_NODE:
break;
case XML_ELEMENT_NODE:
if(!price_parse_xml_sub_node(p, child, pstatus->session)) {

View File

@ -259,6 +259,10 @@ dom_tree_to_list_kvp_value(xmlNodePtr node)
for(mark = node->xmlChildrenNode; mark; mark = mark->next)
{
kvp_value *new_val;
if (safe_strcmp (mark->name, "text") == 0)
continue;
new_val = dom_tree_to_kvp_value(mark);
if(new_val)
{
@ -266,11 +270,8 @@ dom_tree_to_list_kvp_value(xmlNodePtr node)
}
}
if(list)
{
ret = kvp_value_new_glist_nc(list);
}
ret = kvp_value_new_glist_nc(list);
return ret;
}
@ -326,9 +327,7 @@ dom_tree_to_kvp_value(xmlNodePtr node)
xmlFree (xml_type);
}
else
{
type = g_strdup_printf("string");
}
type = NULL;
for(mark = val_converters; mark->tag; mark++)
{
@ -376,7 +375,8 @@ dom_tree_to_kvp_frame_given(xmlNodePtr node, kvp_frame *frame)
}
else
{
/* FIXME: should put some error here */
/* FIXME: should put some error here.
* But ignore text type! */
}
}
@ -509,6 +509,7 @@ dom_tree_to_timespec(xmlNodePtr node)
for(n = node->xmlChildrenNode; n; n = n->next) {
switch(n->type) {
case XML_COMMENT_NODE:
case XML_TEXT_NODE:
break;
case XML_ELEMENT_NODE:
if(safe_strcmp("ts:date", n->name) == 0) {
@ -591,6 +592,7 @@ dom_tree_to_gdate(xmlNodePtr node)
for(n = node->xmlChildrenNode; n; n = n->next) {
switch(n->type) {
case XML_COMMENT_NODE:
case XML_TEXT_NODE:
break;
case XML_ELEMENT_NODE:
if(safe_strcmp("gdate", n->name) == 0) {
@ -659,6 +661,7 @@ dom_tree_to_commodity_ref_no_engine(xmlNodePtr node)
for(n = node->xmlChildrenNode; n; n = n->next) {
switch(n->type) {
case XML_COMMENT_NODE:
case XML_TEXT_NODE:
break;
case XML_ELEMENT_NODE:
if(safe_strcmp("cmdty:space", n->name) == 0) {
@ -680,7 +683,7 @@ dom_tree_to_commodity_ref_no_engine(xmlNodePtr node)
}
break;
default:
PERR("dom_tree_to_timespec: unexpected sub-node.");
PERR("unexpected sub-node.");
return NULL;
break;
}
@ -787,6 +790,10 @@ dom_tree_generic_parse(xmlNodePtr node, struct dom_tree_handler *handlers,
for(achild = node->xmlChildrenNode; achild; achild = achild->next)
{
/* ignore stray text nodes */
if (safe_strcmp (achild->name, "text") == 0)
continue;
if(!gnc_xml_set_data(achild->name, achild, data, handlers))
{
PERR("gnc_xml_set_data failed");

View File

@ -100,7 +100,7 @@ static gboolean dom_chars_handler(
GSList *sibling_data, gpointer parent_data, gpointer global_data,
gpointer *result, const char *text, int length)
{
if(length > 0 && !isspace_str(text, length))
if(length > 0)
{
xmlNodeAddContentLen((xmlNodePtr)parent_data, text, length);
}

View File

@ -30,6 +30,9 @@ node_and_account_equal(xmlNodePtr node, Account *act)
{
xmlNodePtr mark;
while (safe_strcmp (node->name, "text") == 0)
node = node->next;
if(!check_dom_tree_version(node, "2.0.0"))
{
return g_strdup("version wrong. Not 2.0.0 or not there");
@ -42,7 +45,10 @@ node_and_account_equal(xmlNodePtr node, Account *act)
for(mark = node->xmlChildrenNode; mark; mark = mark->next)
{
if(safe_strcmp(mark->name, "act:name") == 0)
if(safe_strcmp(mark->name, "text") == 0)
{
}
else if(safe_strcmp(mark->name, "act:name") == 0)
{
if(!equals_node_val_vs_string(mark, xaccAccountGetName(act)))
{

View File

@ -29,6 +29,9 @@ node_and_commodity_equal(xmlNodePtr node, const gnc_commodity *com)
{
xmlNodePtr mark;
while (safe_strcmp (node->name, "text") == 0)
node = node->next;
if(!check_dom_tree_version(node, "2.0.0"))
{
return "version wrong. Not 2.0.0 or not there";
@ -41,7 +44,10 @@ node_and_commodity_equal(xmlNodePtr node, const gnc_commodity *com)
for(mark = node->xmlChildrenNode; mark; mark = mark->next)
{
if(safe_strcmp(mark->name, "cmdty:space") == 0)
if(safe_strcmp(mark->name, "text") == 0)
{
}
else if(safe_strcmp(mark->name, "cmdty:space") == 0)
{
if(!equals_node_val_vs_string(
mark, gnc_commodity_get_namespace(com)))

View File

@ -192,6 +192,9 @@ node_and_transaction_equal(xmlNodePtr node, Transaction *trn)
{
xmlNodePtr mark;
while (safe_strcmp (node->name, "text") == 0)
node = node->next;
if(!check_dom_tree_version(node, "2.0.0"))
{
return "version wrong. Not 2.0.0 or not there";
@ -204,7 +207,10 @@ node_and_transaction_equal(xmlNodePtr node, Transaction *trn)
for(mark = node->xmlChildrenNode; mark; mark = mark->next)
{
if(safe_strcmp(mark->name, "trn:id") == 0)
if(safe_strcmp(mark->name, "text") == 0)
{
}
else if(safe_strcmp(mark->name, "trn:id") == 0)
{
if(!equals_node_val_vs_guid(mark, xaccTransGetGUID(trn)))
{
@ -281,6 +287,7 @@ really_get_rid_of_transaction(Transaction *trn)
struct tran_data_struct
{
Transaction *trn;
Transaction *new_trn;
gnc_commodity *com;
int value;
};
@ -301,7 +308,7 @@ test_add_transaction(const char *tag, gpointer globaldata, gpointer data)
__FILE__, __LINE__,
"%d", gdata->value);
really_get_rid_of_transaction(trans);
gdata->new_trn = trans;
return TRUE;
}
@ -310,6 +317,7 @@ static void
test_transaction(void)
{
int i;
for(i = 0; i < 20; i++)
{
Transaction *ran_trn;
@ -375,6 +383,8 @@ test_transaction(void)
failure_args("gnc_xml_parse_file returned FALSE",
__FILE__, __LINE__, "%d", i);
}
else
really_get_rid_of_transaction (data.new_trn);
/* no handling of circular data structures. We'll do that later */
/* sixtp_destroy(parser); */

View File

@ -24,7 +24,6 @@
#include "config.h"
#include <assert.h>
#include <glib.h>
#include <string.h>

View File

@ -24,7 +24,6 @@
#include "config.h"
#include <assert.h>
#include <glib.h>
#include <string.h>

View File

@ -32,8 +32,6 @@
#include <sys/time.h>
#include <unistd.h>
#include <assert.h>
#include "gnc-engine-util.h"
#include "gnc-numeric.h"
#include "AccountP.h"
@ -706,8 +704,8 @@ acct_query_matches(QueryTerm * qt, Account * acct) {
gboolean account_in_set = FALSE;
gboolean first_account = TRUE;
assert(qt && acct);
assert(qt->data.type == PD_ACCOUNT);
g_return_val_if_fail(qt && acct, FALSE);
g_return_val_if_fail(qt->data.type == PD_ACCOUNT, FALSE);
for(node = qt->data.acct.accounts; node ; node = node->next) {
if(acct == node->data) {
@ -922,8 +920,7 @@ static int
split_sort_func(gconstpointer a, gconstpointer b) {
int retval;
assert(split_sort_query);
g_return_val_if_fail (split_sort_query, 0);
retval = split_cmp_func(split_sort_query->primary_sort, a, b);
if((retval == 0) &&
@ -2227,7 +2224,7 @@ string_match_predicate(const char * s, PredicateData * pd)
{
regmatch_t match;
assert(s && pd && (pd->type == PD_STRING));
g_return_val_if_fail(s && pd && (pd->type == PD_STRING), FALSE);
if(!pd->str.matchstring) return 0;
@ -2285,16 +2282,15 @@ xaccAccountMatchPredicate(Split * s, PredicateData * pd) {
int i;
int numsplits;
assert(s && pd);
assert(pd->type == PD_ACCOUNT);
g_return_val_if_fail(s && pd, FALSE);
g_return_val_if_fail(pd->type == PD_ACCOUNT, FALSE);
switch(pd->acct.how) {
case ACCT_MATCH_ALL:
/* there must be a split in parent that matches each of the
* accounts listed in pd. */
parent = xaccSplitGetParent(s);
assert(parent);
g_return_val_if_fail(parent, FALSE);
numsplits = xaccTransCountSplits(parent);
for(acct_node=pd->acct.accounts; acct_node; acct_node=acct_node->next) {
for(i=0; i < numsplits; i++) {
@ -2341,11 +2337,11 @@ xaccDescriptionMatchPredicate(Split * s, PredicateData * pd) {
Transaction * parent;
const char * descript;
assert(s && pd);
assert(pd->type == PD_STRING);
g_return_val_if_fail(s && pd, FALSE);
g_return_val_if_fail(pd->type == PD_STRING, FALSE);
parent = xaccSplitGetParent(s);
assert(parent);
g_return_val_if_fail(parent, FALSE);
descript = xaccTransGetDescription(parent);
return string_match_predicate(descript, pd);
@ -2394,11 +2390,11 @@ xaccNumberMatchPredicate(Split * s, PredicateData * pd) {
Transaction * parent;
const char * number;
assert(s && pd);
assert(pd->type == PD_STRING);
g_return_val_if_fail(s && pd, FALSE);
g_return_val_if_fail(pd->type == PD_STRING, FALSE);
parent = xaccSplitGetParent(s);
assert(parent);
g_return_val_if_fail(parent, FALSE);
number = xaccTransGetNum(parent);
return string_match_predicate(number, pd);
@ -2412,8 +2408,8 @@ static int
xaccActionMatchPredicate(Split * s, PredicateData * pd) {
const char * action;
assert(s && pd);
assert(pd->type == PD_STRING);
g_return_val_if_fail(s && pd, FALSE);
g_return_val_if_fail(pd->type == PD_STRING, FALSE);
action = xaccSplitGetAction(s);
return string_match_predicate(action, pd);
@ -2427,7 +2423,7 @@ static int
xaccMemoMatchPredicate(Split * s, PredicateData * pd) {
const char * memo;
assert(s && pd);
g_return_val_if_fail(s && pd, FALSE);
memo = xaccSplitGetMemo(s);
return string_match_predicate(memo, pd);
@ -2441,8 +2437,8 @@ static int
xaccAmountMatchPredicate(Split * s, PredicateData * pd) {
double splitamt;
assert(s && pd);
assert(pd->type == PD_AMOUNT);
g_return_val_if_fail(s && pd, FALSE);
g_return_val_if_fail(pd->type == PD_AMOUNT, FALSE);
splitamt = DxaccSplitGetValue(s);
@ -2469,8 +2465,8 @@ xaccSharePriceMatchPredicate(Split * s, PredicateData * pd) {
Account * acct;
int type;
assert(s && pd);
assert(pd->type == PD_AMOUNT);
g_return_val_if_fail(s && pd, FALSE);
g_return_val_if_fail(pd->type == PD_AMOUNT, FALSE);
acct = xaccSplitGetAccount(s);
type = xaccAccountGetType(acct);
@ -2493,8 +2489,8 @@ xaccSharesMatchPredicate(Split * s, PredicateData * pd) {
Account * acct;
int type;
assert(s && pd);
assert(pd->type == PD_AMOUNT);
g_return_val_if_fail(s && pd, FALSE);
g_return_val_if_fail(pd->type == PD_AMOUNT, FALSE);
acct = xaccSplitGetAccount(s);
type = xaccAccountGetType(acct);
@ -2516,8 +2512,8 @@ static int
xaccDateMatchPredicate(Split * s, PredicateData * pd) {
Timespec transtime;
assert(s && pd);
assert(pd->type == PD_DATE);
g_return_val_if_fail(s && pd, FALSE);
g_return_val_if_fail(pd->type == PD_DATE, FALSE);
xaccTransGetDatePostedTS(xaccSplitGetParent(s), &transtime);
@ -2543,8 +2539,8 @@ static int
xaccClearedMatchPredicate(Split * s, PredicateData * pd) {
int cstate;
assert(s && pd);
assert(pd->type == PD_CLEARED);
g_return_val_if_fail(s && pd, FALSE);
g_return_val_if_fail(pd->type == PD_CLEARED, FALSE);
cstate = xaccSplitGetReconcile(s);
switch(cstate) {
@ -2576,8 +2572,8 @@ static int
xaccBalanceMatchPredicate(Split * s, PredicateData * pd) {
gboolean balanced;
assert(s && pd);
assert(pd->type == PD_BALANCE);
g_return_val_if_fail(s && pd, FALSE);
g_return_val_if_fail(pd->type == PD_BALANCE, FALSE);
if ((pd->balance.how & BALANCE_BALANCED) &&
(pd->balance.how & BALANCE_UNBALANCED))

View File

@ -24,7 +24,6 @@
#define _GNU_SOURCE
#include "config.h"
#include <assert.h>
#include <stdio.h>
#include <string.h>
@ -264,7 +263,7 @@ xaccSplitAsString(Split *split, const char prefix[]) {
const char *dest_name =
split_dest ? xaccAccountGetName(split_dest) : NULL;
assert(stream);
g_return_val_if_fail (stream, NULL);
fputc('\n', stream);
fputs(prefix, stream);
@ -303,7 +302,7 @@ xaccTransAsString(Transaction *txn, const char prefix[]) {
const char *memo = xaccSplitGetMemo(xaccTransGetSplit(txn, 0));
const double total = DxaccSplitGetValue(xaccTransGetSplit(txn, 0));
assert(stream);
g_return_val_if_fail (stream, NULL);
fputs(prefix, stream);
if(date) {

View File

@ -25,7 +25,6 @@
#include "config.h"
#include <assert.h>
#include <string.h>
#include <sys/time.h>
#include <time.h>
@ -85,7 +84,6 @@ check_open (Transaction *trans)
if (trans && 0 >= trans->editlevel)
{
PERR ("transaction %p not open for editing\n", trans);
// assert (trans->editlevel);
PERR ("\t%s:%d \n", __FILE__, __LINE__);
}
}
@ -1056,7 +1054,7 @@ xaccSplitSetBaseValue (Split *s, gnc_numeric value,
if (!xaccSplitGetAccount(s)) {
if (force_double_entry) {
PERR ("split must have a parent\n");
assert (xaccSplitGetAccount(s));
g_return_if_fail (xaccSplitGetAccount(s));
}
else {
/* this is a change in semantics. previously, calling
@ -1122,7 +1120,7 @@ xaccSplitGetBaseValue (Split *s, const gnc_commodity * base_currency)
*/
if (!xaccSplitGetAccount(s)) {
if (force_double_entry) {
assert (xaccSplitGetAccount(s));
g_return_val_if_fail (xaccSplitGetAccount(s), gnc_numeric_zero ());
}
else {
return s->value;
@ -1180,7 +1178,7 @@ xaccSplitsComputeValue (GList *splits, Split * skip_me,
* go with the flow. */
if (!xaccSplitGetAccount(s)) {
if (force_double_entry) {
assert (xaccSplitGetAccount(s));
g_return_val_if_fail (xaccSplitGetAccount(s), gnc_numeric_zero ());
}
else {
value = gnc_numeric_add(value, s->value,
@ -1218,7 +1216,7 @@ xaccSplitsComputeValue (GList *splits, Split * skip_me,
gnc_commodity_get_printname(base_currency),
gnc_commodity_get_printname(currency),
gnc_commodity_get_printname(commodity));
assert (0);
g_return_val_if_fail (FALSE, gnc_numeric_zero ());
}
}
}
@ -1870,8 +1868,13 @@ xaccSplitDestroy (Split *split)
if (trans)
{
gboolean ismember = (g_list_find (trans->splits, split) != NULL);
assert (ismember);
xaccTransRemoveSplit (trans, split);
if (!ismember)
{
PERR ("split not in transaction");
}
else
xaccTransRemoveSplit (trans, split);
}
xaccAccountRemoveSplit (xaccSplitGetAccount(split), split);

View File

@ -27,7 +27,6 @@
#ifndef GNC_ENGINE_UTIL_H
#define GNC_ENGINE_UTIL_H
#include <assert.h>
#include <errno.h>
#include <glib.h>
#include <stddef.h>

View File

@ -23,7 +23,6 @@
#include "config.h"
#include <assert.h>
#include <glib.h>
#include "GNCIdP.h"

View File

@ -29,7 +29,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>
#include "gnc-engine-util.h"
#include "gnc-numeric.h"

View File

@ -99,7 +99,7 @@ gnc_price_unref(GNCPrice *p)
ENTER("pr=%p refcount=%d", p, p->refcount);
if(p->refcount == 0) {
PERR("refcount == 0 !!!!");
assert(p->refcount != 0);
return;
}
p->refcount--;

View File

@ -40,7 +40,7 @@
gchar *
gnc_qualifier_prefix_gettext (const gchar *string)
{
g_assert (string != NULL);
g_return_val_if_fail (string, NULL);
if (*string != Q_PREFIX_START) {
return gettext (string);
@ -83,7 +83,7 @@ gnc_qualifier_prefix_gettext (const gchar *string)
gchar *
gnc_qualifier_prefix_noop (const gchar *string)
{
g_assert (string != NULL);
g_return_val_if_fail (string, NULL);
if (*string != Q_PREFIX_START) {
return (gchar *) string;

View File

@ -403,8 +403,8 @@ gnc_account_tree_refresh(GNCAccountTree * tree)
void
gnc_account_tree_set_view_info(GNCAccountTree *tree, AccountViewInfo *info)
{
assert(IS_GNC_ACCOUNT_TREE(tree));
assert(info != NULL);
g_return_if_fail(IS_GNC_ACCOUNT_TREE(tree));
g_return_if_fail(info != NULL);
tree->avi = *info;
@ -423,8 +423,8 @@ gnc_account_tree_set_view_info(GNCAccountTree *tree, AccountViewInfo *info)
void
gnc_account_tree_get_view_info(GNCAccountTree *tree, AccountViewInfo *info)
{
assert(IS_GNC_ACCOUNT_TREE(tree));
assert(info != NULL);
g_return_if_fail(IS_GNC_ACCOUNT_TREE(tree));
g_return_if_fail(info != NULL);
*info = tree->avi;
}

View File

@ -104,7 +104,7 @@ normalize_period(unsigned int *period)
{
int i;
assert(period != NULL);
g_return_val_if_fail (period, 0);
for (i = (sizeof(periods) / sizeof(unsigned int)) - 1; i >= 0; i--)
if (*period >= periods[i])

View File

@ -24,7 +24,6 @@
#include "config.h"
#include <assert.h>
#include <gnome.h>
#include <guile/gh.h>
#include <stdio.h>
@ -508,7 +507,7 @@ gnc_ui_find_transactions_dialog_ok_cb(GtkButton * button,
ftd->q = xaccMallocQuery();
}
assert(ftd->q);
g_assert(ftd->q);
q = xaccMallocQuery();
xaccQuerySetGroup(q, gnc_get_current_group ());

View File

@ -1251,7 +1251,7 @@ sxed_reg_deleteCB( GtkWidget *w, gpointer d )
return;
}
assert(cursor_class == CURSOR_CLASS_TRANS);
g_return_if_fail (cursor_class == CURSOR_CLASS_TRANS);
/* On a transaction cursor with 2 or fewer splits in single or double
* mode, we just delete the whole transaction, kerblooie */

View File

@ -100,8 +100,9 @@ gnc_reconcile_list_new(Account *account, GNCReconcileListType type)
GNCReconcileList *list;
gboolean include_children;
g_assert(account != NULL);
g_assert((type == RECLIST_DEBIT) || (type == RECLIST_CREDIT));
g_return_val_if_fail(account, NULL);
g_return_val_if_fail((type == RECLIST_DEBIT) ||
(type == RECLIST_CREDIT), NULL);
list = GNC_RECONCILE_LIST(gtk_type_new(gnc_reconcile_list_get_type()));
@ -261,8 +262,8 @@ gnc_reconcile_list_toggle_row(GNCReconcileList *list, gint row)
{
Split *split, *current;
g_assert (IS_GNC_RECONCILE_LIST(list));
g_assert (list->reconciled != NULL);
g_return_if_fail (IS_GNC_RECONCILE_LIST(list));
g_return_if_fail (list->reconciled != NULL);
if (list->no_toggle)
return;
@ -338,8 +339,8 @@ gnc_reconcile_list_toggle (GNCReconcileList *list)
Account * account;
gboolean include_children;
g_assert (IS_GNC_RECONCILE_LIST(list));
g_assert (list->reconciled != NULL);
g_return_if_fail (IS_GNC_RECONCILE_LIST(list));
g_return_if_fail (list->reconciled != NULL);
if (list->no_toggle)
return;

View File

@ -386,7 +386,7 @@ gnc_register_sort (RegWindow *regData, sort_type_t sort_code)
xaccQuerySetSortOrder(query, BY_DESC, BY_STANDARD, BY_NONE);
break;
default:
assert(0); /* we should never be here */
g_return_if_fail (FALSE);
}
reg = gnc_ledger_display_get_split_register (regData->ledger);
@ -608,7 +608,7 @@ show_all_cb(GtkWidget *widget, gpointer data)
RegDateWindow *regDateData;
GtkToggleButton *toggle;
assert(regData != NULL);
g_return_if_fail(regData != NULL);
regDateData = regData->date_window;
if (regDateData == NULL)
@ -629,7 +629,7 @@ gnc_register_today_cb(GtkWidget *widget, gpointer data)
RegWindow *regData = data;
RegDateWindow *regDateData;
assert(regData != NULL);
g_return_if_fail(regData != NULL);
regDateData = regData->date_window;
gnc_date_edit_set_time(GNC_DATE_EDIT(regDateData->end_date), time(NULL));
@ -3073,7 +3073,7 @@ deleteCB(GtkWidget *widget, gpointer data)
return;
}
assert(cursor_class == CURSOR_CLASS_TRANS);
g_return_if_fail(cursor_class == CURSOR_CLASS_TRANS);
/* On a transaction cursor with 2 or fewer splits in single or double
* mode, we just delete the whole transaction, kerblooie */

View File

@ -29,7 +29,6 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <glib.h>
#include <assert.h>
#include "Scrub.h"
#include "dialog-commodity.h"
@ -426,8 +425,8 @@ gnc_ui_commodity_druid_comm_check_cb(GnomeDruidPage * page, gpointer druid,
return TRUE;
}
new_comm = g_hash_table_lookup(cd->new_map, dpage->old_name);
assert(new_comm);
g_assert(new_comm);
/* fill in the commodity structure info */
gnc_commodity_set_fullname(new_comm, new_name);
gnc_commodity_set_namespace(new_comm, new_type);

View File

@ -1661,8 +1661,7 @@ gnc_table_traverse_update(Table *table,
break;
default:
/* shouldn't be reached */
assert(0);
g_return_val_if_fail (FALSE, TRUE);
break;
}