Refactor safe_strcmp into the glib standard g_strcmp0

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22290 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Geert Janssens
2012-08-07 17:24:55 +00:00
parent a54e7149bf
commit c5e2adcb7a
109 changed files with 587 additions and 625 deletions

View File

@@ -275,7 +275,7 @@ gnc_find_state_file (const gchar *url,
STATE_FILE_TOP, STATE_FILE_BOOK_GUID,
NULL);
DEBUG("File GncGUID is %s", file_guid ? file_guid : "<not found>");
if (safe_strcmp(guid, file_guid) == 0)
if (g_strcmp0(guid, file_guid) == 0)
{
DEBUG("Matched !!!");
g_free(file_guid);

View File

@@ -559,7 +559,7 @@ gnc_unregister_gui_component_by_data (const char *component_class,
ComponentInfo *ci = node->data;
if (component_class &&
safe_strcmp (component_class, ci->component_class) != 0)
g_strcmp0 (component_class, ci->component_class) != 0)
continue;
gnc_unregister_gui_component (ci->component_id);
@@ -791,7 +791,7 @@ gnc_close_gui_component_by_data (const char *component_class,
ComponentInfo *ci = node->data;
if (component_class &&
safe_strcmp (component_class, ci->component_class) != 0)
g_strcmp0 (component_class, ci->component_class) != 0)
continue;
gnc_close_gui_component (ci->component_id);
@@ -848,7 +848,7 @@ gnc_find_gui_components (const char *component_class,
{
ComponentInfo *ci = node->data;
if (safe_strcmp (component_class, ci->component_class) != 0)
if (g_strcmp0 (component_class, ci->component_class) != 0)
continue;
if (find_handler && !find_handler (find_data, ci->user_data))
@@ -900,7 +900,7 @@ find_component_ids_by_class (const char *component_class)
ComponentInfo *ci = node->data;
if (component_class &&
safe_strcmp (component_class, ci->component_class) != 0)
g_strcmp0 (component_class, ci->component_class) != 0)
continue;
list = g_list_prepend (list, GINT_TO_POINTER (ci->component_id));

View File

@@ -85,15 +85,15 @@ gnc_configure_account_separator (void)
string = gnc_gconf_get_string(GCONF_GENERAL, KEY_ACCOUNT_SEPARATOR, NULL);
if (!string || !*string || safe_strcmp(string, "colon") == 0)
if (!string || !*string || g_strcmp0(string, "colon") == 0)
separator = ":";
else if (safe_strcmp(string, "slash") == 0)
else if (g_strcmp0(string, "slash") == 0)
separator = "/";
else if (safe_strcmp(string, "backslash") == 0)
else if (g_strcmp0(string, "backslash") == 0)
separator = "\\";
else if (safe_strcmp(string, "dash") == 0)
else if (g_strcmp0(string, "dash") == 0)
separator = "-";
else if (safe_strcmp(string, "period") == 0)
else if (g_strcmp0(string, "period") == 0)
separator = ".";
else
separator = string;
@@ -116,17 +116,17 @@ gnc_configure_reverse_balance (void)
choice = gnc_gconf_get_string(GCONF_GENERAL, KEY_REVERSED_ACCOUNTS, NULL);
if (safe_strcmp (choice, "none") == 0)
if (g_strcmp0 (choice, "none") == 0)
{
}
else if (safe_strcmp (choice, "income_expense") == 0)
else if (g_strcmp0 (choice, "income_expense") == 0)
{
reverse_type[ACCT_TYPE_INCOME] = TRUE;
reverse_type[ACCT_TYPE_EXPENSE] = TRUE;
}
else
{
if (safe_strcmp (choice, "credit") != 0)
if (g_strcmp0 (choice, "credit") != 0)
PERR("bad value '%s'", choice ? choice : "(null)");
reverse_type[ACCT_TYPE_LIABILITY] = TRUE;
reverse_type[ACCT_TYPE_PAYABLE] = TRUE;
@@ -303,7 +303,7 @@ gnc_ui_account_get_tax_info_string (const Account *account)
gchar *return_string = NULL;
tax_type = gnc_get_current_book_tax_type ();
if (tax_type == NULL || (safe_strcmp (tax_type, "") == 0))
if (tax_type == NULL || (g_strcmp0 (tax_type, "") == 0))
return g_strdup (_("Tax entity type not specified"));
atype = xaccAccountGetType (account);
@@ -463,7 +463,7 @@ gnc_ui_account_get_tax_info_string (const Account *account)
(gint) copy_number);
if (tax_related)
{
if (safe_strcmp (form, "") == 0)
if (g_strcmp0 (form, "") == 0)
return_string = g_strdup_printf ("%s", desc);
else
return_string = g_strdup_printf ("%s%s: %s",

View File

@@ -1319,7 +1319,7 @@ compare_sections(gconstpointer a, gconstpointer b)
const GNCOptionSection *sa = a;
const GNCOptionSection *sb = b;
return safe_strcmp(sa->section_name, sb->section_name);
return g_strcmp0(sa->section_name, sb->section_name);
}
static gint
@@ -1331,7 +1331,7 @@ compare_option_tags(gconstpointer a, gconstpointer b)
char *tag_b = gnc_option_sort_tag(ob);
gint result;
result = safe_strcmp(tag_a, tag_b);
result = g_strcmp0(tag_a, tag_b);
if (tag_a != NULL)
free(tag_a);
@@ -1545,7 +1545,7 @@ gnc_option_db_get_option_by_name(GNCOptionDB *odb, const char *section_name,
option = option_node->data;
node_name = gnc_option_name(option);
result = safe_strcmp(name, node_name);
result = g_strcmp0(name, node_name);
free(node_name);
if (result == 0)
@@ -2152,7 +2152,7 @@ gnc_option_db_lookup_date_option(GNCOptionDB *odb,
symbol = gnc_date_option_value_get_type (value);
if (safe_strcmp(symbol, "relative") == 0)
if (g_strcmp0(symbol, "relative") == 0)
{
SCM relative = gnc_date_option_value_get_relative (value);

View File

@@ -288,7 +288,7 @@ compare_namespaces(gconstpointer a, gconstpointer b)
const gchar *sa = (const gchar *) a;
const gchar *sb = (const gchar *) b;
return( safe_strcmp( sa, sb ) );
return( g_strcmp0( sa, sb ) );
}
static gint
@@ -297,7 +297,7 @@ compare_commodity_ids(gconstpointer a, gconstpointer b)
const gnc_commodity *ca = (const gnc_commodity *) a;
const gnc_commodity *cb = (const gnc_commodity *) b;
return( safe_strcmp( gnc_commodity_get_mnemonic( ca ),
return( g_strcmp0( gnc_commodity_get_mnemonic( ca ),
gnc_commodity_get_mnemonic( cb ) ) );
}

View File

@@ -957,7 +957,7 @@ convert_query_term_to_sql( const GncSqlBackend* be, const gchar* fieldName, QofQ
pPredData = qof_query_term_get_pred_data( pTerm );
isInverted = qof_query_term_is_inverted( pTerm );
if ( safe_strcmp( pPredData->type_name, QOF_TYPE_GUID ) == 0 )
if ( g_strcmp0( pPredData->type_name, QOF_TYPE_GUID ) == 0 )
{
query_guid_t guid_data = (query_guid_t)pPredData;
GList* guid_entry;
@@ -992,7 +992,7 @@ convert_query_term_to_sql( const GncSqlBackend* be, const gchar* fieldName, QofQ
g_string_append( sql, "))" );
}
else if ( safe_strcmp( pPredData->type_name, QOF_TYPE_CHAR ) == 0 )
else if ( g_strcmp0( pPredData->type_name, QOF_TYPE_CHAR ) == 0 )
{
query_char_t char_data = (query_char_t)pPredData;
int i;
@@ -1024,7 +1024,7 @@ convert_query_term_to_sql( const GncSqlBackend* be, const gchar* fieldName, QofQ
}
}
else if ( safe_strcmp( pPredData->type_name, QOF_TYPE_STRING ) == 0 )
else if ( g_strcmp0( pPredData->type_name, QOF_TYPE_STRING ) == 0 )
{
query_string_t string_data = (query_string_t)pPredData;
sqlEscape* escape = sqlEscape_new();
@@ -1077,7 +1077,7 @@ convert_query_term_to_sql( const GncSqlBackend* be, const gchar* fieldName, QofQ
g_string_append_printf( sql, "%f", d );
}
else if ( safe_strcmp( pPredData->type_name, QOF_TYPE_DATE ) == 0 )
else if ( g_strcmp0( pPredData->type_name, QOF_TYPE_DATE ) == 0 )
{
query_date_t date_data = (query_date_t)pPredData;
gchar* datebuf;

View File

@@ -426,7 +426,7 @@ account_lots_handler(xmlNodePtr node, gpointer act_pdata)
{
GNCLot *lot;
if (safe_strcmp("text", (char*) mark->name) == 0)
if (g_strcmp0("text", (char*) mark->name) == 0)
continue;
lot = dom_tree_to_lot(mark, pdata->book);

View File

@@ -593,7 +593,7 @@ gnc_determine_file_type (const char *uri)
}
filename = gnc_uri_get_path ( uri );
if (0 == safe_strcmp(filename, QOF_STDOUT))
if (0 == g_strcmp0(filename, QOF_STDOUT))
{
result = FALSE;
goto det_exit;
@@ -731,7 +731,7 @@ gnc_xml_be_write_to_file(FileBackend *fbe,
if (rc == 0)
{
/* We must never chmod the file /dev/null */
g_assert(safe_strcmp(tmp_name, "/dev/null") != 0);
g_assert(g_strcmp0(tmp_name, "/dev/null") != 0);
/* Use the permissions from the original data file */
if (g_chmod(tmp_name, statbuf.st_mode) != 0)
@@ -1243,13 +1243,13 @@ retain_type_changed_cb(GConfEntry *entry, gpointer user_data)
if (!choice)
choice = g_strdup("days");
if (safe_strcmp (choice, "never") == 0)
if (g_strcmp0 (choice, "never") == 0)
be->file_retention_type = XML_RETAIN_NONE;
else if (safe_strcmp (choice, "forever") == 0)
else if (g_strcmp0 (choice, "forever") == 0)
be->file_retention_type = XML_RETAIN_ALL;
else
{
if (safe_strcmp (choice, "days") != 0)
if (g_strcmp0 (choice, "days") != 0)
PERR("bad value '%s'", choice ? choice : "(null)");
be->file_retention_type = XML_RETAIN_DAYS;
}

View File

@@ -141,7 +141,7 @@ struct com_char_handler com_handlers[] =
static void
set_commodity_value(xmlNodePtr node, gnc_commodity* com)
{
if (safe_strcmp((char*) node->name, cmdty_fraction) == 0)
if (g_strcmp0((char*) node->name, cmdty_fraction) == 0)
{
gint64 val;
char *string;
@@ -153,11 +153,11 @@ set_commodity_value(xmlNodePtr node, gnc_commodity* com)
}
xmlFree (string);
}
else if (safe_strcmp((char*)node->name, cmdty_get_quotes) == 0)
else if (g_strcmp0((char*)node->name, cmdty_get_quotes) == 0)
{
gnc_commodity_set_quote_flag(com, TRUE);
}
else if (safe_strcmp((char*)node->name, cmdty_quote_source) == 0)
else if (g_strcmp0((char*)node->name, cmdty_quote_source) == 0)
{
gnc_quote_source *source;
char *string;
@@ -169,7 +169,7 @@ set_commodity_value(xmlNodePtr node, gnc_commodity* com)
gnc_commodity_set_quote_source(com, source);
xmlFree (string);
}
else if (safe_strcmp((char*)node->name, cmdty_slots) == 0)
else if (g_strcmp0((char*)node->name, cmdty_slots) == 0)
{
/* We ignore the results here */
dom_tree_to_kvp_frame_given(node,
@@ -181,7 +181,7 @@ set_commodity_value(xmlNodePtr node, gnc_commodity* com)
for (mark = com_handlers; mark->tag; mark++)
{
if (safe_strcmp(mark->tag, (char*)node->name) == 0)
if (g_strcmp0(mark->tag, (char*)node->name) == 0)
{
gchar* val = dom_tree_to_text(node);
g_strstrip(val);
@@ -224,9 +224,9 @@ gnc_commodity_find_currency (QofBook *book, xmlNodePtr tree)
for (node = tree->xmlChildrenNode; node; node = node->next)
{
if (safe_strcmp((char*) node->name, cmdty_namespace) == 0)
if (g_strcmp0((char*) node->name, cmdty_namespace) == 0)
exchange = (gchar*) xmlNodeGetContent (node->xmlChildrenNode);
if (safe_strcmp((char*) node->name, cmdty_id) == 0)
if (g_strcmp0((char*) node->name, cmdty_id) == 0)
mnemonic = (gchar*) xmlNodeGetContent (node->xmlChildrenNode);
}

View File

@@ -145,7 +145,7 @@ fs_uift_handler( xmlNodePtr node, gpointer data)
g_return_val_if_fail( nodeTxt, FALSE );
for ( i = 0; (tmp = uiFreqTypeStrs[i].str) != NULL; i++ )
{
if ( safe_strcmp( nodeTxt, tmp ) == 0 )
if ( g_strcmp0( nodeTxt, tmp ) == 0 )
{
fspd->uift = uiFreqTypeStrs[i].uift;
g_free( nodeTxt );

View File

@@ -105,13 +105,13 @@ owner_type_handler (xmlNodePtr node, gpointer owner_pdata)
char* txt = dom_tree_to_text(node);
g_return_val_if_fail(txt, FALSE);
if (!safe_strcmp (txt, GNC_ID_CUSTOMER))
if (!g_strcmp0 (txt, GNC_ID_CUSTOMER))
gncOwnerInitCustomer (pdata->owner, NULL);
else if (!safe_strcmp (txt, GNC_ID_JOB))
else if (!g_strcmp0 (txt, GNC_ID_JOB))
gncOwnerInitJob (pdata->owner, NULL);
else if (!safe_strcmp (txt, GNC_ID_VENDOR))
else if (!g_strcmp0 (txt, GNC_ID_VENDOR))
gncOwnerInitVendor (pdata->owner, NULL);
else if (!safe_strcmp (txt, GNC_ID_EMPLOYEE))
else if (!g_strcmp0 (txt, GNC_ID_EMPLOYEE))
gncOwnerInitEmployee (pdata->owner, NULL);
else
{

View File

@@ -90,46 +90,46 @@ price_parse_xml_sub_node(GNCPrice *p, xmlNodePtr sub_node, QofBook *book)
if (!p || !sub_node) return FALSE;
gnc_price_begin_edit (p);
if (safe_strcmp("price:id", (char*)sub_node->name) == 0)
if (g_strcmp0("price:id", (char*)sub_node->name) == 0)
{
GncGUID *c = dom_tree_to_guid(sub_node);
if (!c) return FALSE;
gnc_price_set_guid(p, c);
g_free(c);
}
else if (safe_strcmp("price:commodity", (char*)sub_node->name) == 0)
else if (g_strcmp0("price:commodity", (char*)sub_node->name) == 0)
{
gnc_commodity *c = dom_tree_to_commodity_ref(sub_node, book);
if (!c) return FALSE;
gnc_price_set_commodity(p, c);
}
else if (safe_strcmp("price:currency", (char*)sub_node->name) == 0)
else if (g_strcmp0("price:currency", (char*)sub_node->name) == 0)
{
gnc_commodity *c = dom_tree_to_commodity_ref(sub_node, book);
if (!c) return FALSE;
gnc_price_set_currency(p, c);
}
else if (safe_strcmp("price:time", (char*)sub_node->name) == 0)
else if (g_strcmp0("price:time", (char*)sub_node->name) == 0)
{
Timespec t = dom_tree_to_timespec(sub_node);
if (!dom_tree_valid_timespec(&t, sub_node->name)) return FALSE;
gnc_price_set_time(p, t);
}
else if (safe_strcmp("price:source", (char*)sub_node->name) == 0)
else if (g_strcmp0("price:source", (char*)sub_node->name) == 0)
{
char *text = dom_tree_to_text(sub_node);
if (!text) return FALSE;
gnc_price_set_source(p, text);
g_free(text);
}
else if (safe_strcmp("price:type", (char*)sub_node->name) == 0)
else if (g_strcmp0("price:type", (char*)sub_node->name) == 0)
{
char *text = dom_tree_to_text(sub_node);
if (!text) return FALSE;
gnc_price_set_typestr(p, text);
g_free(text);
}
else if (safe_strcmp("price:value", (char*)sub_node->name) == 0)
else if (g_strcmp0("price:value", (char*)sub_node->name) == 0)
{
gnc_numeric *value = dom_tree_to_gnc_numeric(sub_node);
if (!value) return FALSE;

View File

@@ -248,7 +248,7 @@ sx_enabled_handler( xmlNodePtr node, gpointer sx_pdata )
SchedXaction *sx = pdata->sx;
gchar *tmp = dom_tree_to_text( node );
sx->enabled = (safe_strcmp( tmp, "y" ) == 0 ? TRUE : FALSE );
sx->enabled = (g_strcmp0( tmp, "y" ) == 0 ? TRUE : FALSE );
return TRUE;
}
@@ -260,7 +260,7 @@ sx_autoCreate_handler( xmlNodePtr node, gpointer sx_pdata )
SchedXaction *sx = pdata->sx;
gchar *tmp = dom_tree_to_text( node );
sx->autoCreateOption = (safe_strcmp( tmp, "y" ) == 0 ? TRUE : FALSE );
sx->autoCreateOption = (g_strcmp0( tmp, "y" ) == 0 ? TRUE : FALSE );
return TRUE;
}
@@ -272,7 +272,7 @@ sx_notify_handler( xmlNodePtr node, gpointer sx_pdata )
SchedXaction *sx = pdata->sx;
gchar *tmp = dom_tree_to_text( node );
sx->autoCreateNotify = (safe_strcmp( tmp, "y" ) == 0 ? TRUE : FALSE );
sx->autoCreateNotify = (g_strcmp0( tmp, "y" ) == 0 ? TRUE : FALSE );
return TRUE;
}

View File

@@ -348,10 +348,10 @@ taxtable_entries_handler (xmlNodePtr node, gpointer taxtable_pdata)
{
GncTaxTableEntry *entry;
if (safe_strcmp ("text", (char*)mark->name) == 0)
if (g_strcmp0 ("text", (char*)mark->name) == 0)
continue;
if (safe_strcmp (gnc_taxtableentry_string, (char*)mark->name))
if (g_strcmp0 (gnc_taxtableentry_string, (char*)mark->name))
return FALSE;
entry = dom_tree_to_ttentry (mark, pdata->book);

View File

@@ -76,7 +76,7 @@ split_to_dom_tree(const gchar *tag, Split *spl)
{
const char *memo = xaccSplitGetMemo(spl);
if (memo && safe_strcmp(memo, "") != 0)
if (memo && g_strcmp0(memo, "") != 0)
{
xmlNewTextChild(ret, NULL, BAD_CAST "split:memo", (xmlChar*)memo);
}
@@ -85,7 +85,7 @@ split_to_dom_tree(const gchar *tag, Split *spl)
{
const char *action = xaccSplitGetAction(spl);
if (action && safe_strcmp(action, "") != 0)
if (action && g_strcmp0(action, "") != 0)
{
xmlNewTextChild(ret, NULL, BAD_CAST "split:action", (xmlChar*)action);
}
@@ -163,7 +163,7 @@ gnc_transaction_dom_tree_create(Transaction *trn)
xmlAddChild(ret, commodity_ref_to_dom_tree("trn:currency",
xaccTransGetCurrency(trn)));
if (xaccTransGetNum(trn) && (safe_strcmp(xaccTransGetNum(trn), "") != 0))
if (xaccTransGetNum(trn) && (g_strcmp0(xaccTransGetNum(trn), "") != 0))
{
xmlNewTextChild(ret, NULL, BAD_CAST "trn:num", (xmlChar*)xaccTransGetNum(trn));
}
@@ -537,10 +537,10 @@ trn_splits_handler(xmlNodePtr node, gpointer trans_pdata)
{
Split *spl;
if (safe_strcmp("text", (char*)mark->name) == 0)
if (g_strcmp0("text", (char*)mark->name) == 0)
continue;
if (safe_strcmp("trn:split", (char*)mark->name))
if (g_strcmp0("trn:split", (char*)mark->name))
{
return FALSE;
}

View File

@@ -173,7 +173,7 @@ generic_callback(const char *tag, gpointer globaldata, gpointer data)
{
GncExampleAccount *gea = (GncExampleAccount*)globaldata;
if (safe_strcmp(tag, "gnc:account") == 0)
if (g_strcmp0(tag, "gnc:account") == 0)
{
add_account_local(gea, (Account*)data);
}

View File

@@ -3631,46 +3631,46 @@ price_parse_xml_sub_node(GNCPrice *p, xmlNodePtr sub_node, QofBook *book)
gnc_price_begin_edit (p);
if (safe_strcmp("price:id", (char*)sub_node->name) == 0)
if (g_strcmp0("price:id", (char*)sub_node->name) == 0)
{
GncGUID *c = dom_tree_to_guid(sub_node);
if (!c) return FALSE;
gnc_price_set_guid(p, c);
g_free(c);
}
else if (safe_strcmp("price:commodity", (char*)sub_node->name) == 0)
else if (g_strcmp0("price:commodity", (char*)sub_node->name) == 0)
{
gnc_commodity *c = dom_tree_to_commodity_ref(sub_node, book);
if (!c) return FALSE;
gnc_price_set_commodity(p, c);
}
else if (safe_strcmp("price:currency", (char*)sub_node->name) == 0)
else if (g_strcmp0("price:currency", (char*)sub_node->name) == 0)
{
gnc_commodity *c = dom_tree_to_commodity_ref(sub_node, book);
if (!c) return FALSE;
gnc_price_set_currency(p, c);
}
else if (safe_strcmp("price:time", (char*)sub_node->name) == 0)
else if (g_strcmp0("price:time", (char*)sub_node->name) == 0)
{
Timespec t = dom_tree_to_timespec(sub_node);
if (!dom_tree_valid_timespec(&t, sub_node->name)) return FALSE;
gnc_price_set_time(p, t);
}
else if (safe_strcmp("price:source", (char*)sub_node->name) == 0)
else if (g_strcmp0("price:source", (char*)sub_node->name) == 0)
{
char *text = dom_tree_to_text(sub_node);
if (!text) return FALSE;
gnc_price_set_source(p, text);
g_free(text);
}
else if (safe_strcmp("price:type", (char*)sub_node->name) == 0)
else if (g_strcmp0("price:type", (char*)sub_node->name) == 0)
{
char *text = dom_tree_to_text(sub_node);
if (!text) return FALSE;
gnc_price_set_typestr(p, text);
g_free(text);
}
else if (safe_strcmp("price:value", (char*)sub_node->name) == 0)
else if (g_strcmp0("price:value", (char*)sub_node->name) == 0)
{
gnc_numeric *value = dom_tree_to_gnc_numeric(sub_node);
if (!value) return FALSE;

View File

@@ -352,7 +352,7 @@ do_counter_cb (const char *type, gpointer data_p, gpointer be_data_p)
if (be_data->ok == TRUE)
return;
if (!safe_strcmp (be_data->tag, data->type_name))
if (!g_strcmp0 (be_data->tag, data->type_name))
be_data->ok = TRUE;
/* XXX: should we do anything with this counter? */
@@ -394,27 +394,27 @@ gnc_counter_end_handler(gpointer data_for_children,
strval ? strval : "(null)");
ret = FALSE;
}
else if (safe_strcmp(type, "transaction") == 0)
else if (g_strcmp0(type, "transaction") == 0)
{
sixdata->counter.transactions_total = val;
}
else if (safe_strcmp(type, "account") == 0)
else if (g_strcmp0(type, "account") == 0)
{
sixdata->counter.accounts_total = val;
}
else if (safe_strcmp(type, "book") == 0)
else if (g_strcmp0(type, "book") == 0)
{
sixdata->counter.books_total = val;
}
else if (safe_strcmp(type, "commodity") == 0)
else if (g_strcmp0(type, "commodity") == 0)
{
sixdata->counter.commodities_total = val;
}
else if (safe_strcmp(type, "schedxaction") == 0)
else if (g_strcmp0(type, "schedxaction") == 0)
{
sixdata->counter.schedXactions_total = val;
}
else if (safe_strcmp(type, "budget") == 0)
else if (g_strcmp0(type, "budget") == 0)
{
sixdata->counter.budgets_total = val;
}
@@ -534,7 +534,7 @@ add_item_cb (const char *type, gpointer data_p, gpointer be_data_p)
if (be_data->ok)
return;
if (!safe_strcmp (be_data->tag, data->type_name))
if (!g_strcmp0 (be_data->tag, data->type_name))
{
if (data->add_item)
(data->add_item)(be_data->gd, be_data->data);
@@ -548,31 +548,31 @@ book_callback(const char *tag, gpointer globaldata, gpointer data)
{
sixtp_gdv2 *gd = (sixtp_gdv2*)globaldata;
if (safe_strcmp(tag, ACCOUNT_TAG) == 0)
if (g_strcmp0(tag, ACCOUNT_TAG) == 0)
{
add_account_local(gd, (Account*)data);
}
else if (safe_strcmp(tag, PRICEDB_TAG) == 0)
else if (g_strcmp0(tag, PRICEDB_TAG) == 0)
{
add_pricedb_local(gd, (GNCPriceDB*)data);
}
else if (safe_strcmp(tag, COMMODITY_TAG) == 0)
else if (g_strcmp0(tag, COMMODITY_TAG) == 0)
{
add_commodity_local(gd, (gnc_commodity*)data);
}
else if (safe_strcmp(tag, TRANSACTION_TAG) == 0)
else if (g_strcmp0(tag, TRANSACTION_TAG) == 0)
{
add_transaction_local(gd, (Transaction*)data);
}
else if (safe_strcmp(tag, SCHEDXACTION_TAG) == 0)
else if (g_strcmp0(tag, SCHEDXACTION_TAG) == 0)
{
add_schedXaction_local(gd, (SchedXaction*)data);
}
else if (safe_strcmp(tag, TEMPLATE_TRANSACTION_TAG) == 0)
else if (g_strcmp0(tag, TEMPLATE_TRANSACTION_TAG) == 0)
{
add_template_transaction_local( gd, (gnc_template_xaction_data*)data );
}
else if (safe_strcmp(tag, BUDGET_TAG) == 0)
else if (g_strcmp0(tag, BUDGET_TAG) == 0)
{
// Nothing needed here.
}
@@ -600,7 +600,7 @@ generic_callback(const char *tag, gpointer globaldata, gpointer data)
{
sixtp_gdv2 *gd = (sixtp_gdv2*)globaldata;
if (safe_strcmp(tag, BOOK_TAG) == 0)
if (g_strcmp0(tag, BOOK_TAG) == 0)
{
add_book_local(gd, (QofBook*)data);
book_callback(tag, globaldata, data);
@@ -900,7 +900,7 @@ compare_namespaces(gconstpointer a, gconstpointer b)
{
const gchar *sa = (const gchar *) a;
const gchar *sb = (const gchar *) b;
return(safe_strcmp(sa, sb));
return(g_strcmp0(sa, sb));
}
static gint
@@ -908,7 +908,7 @@ compare_commodity_ids(gconstpointer a, gconstpointer b)
{
const gnc_commodity *ca = (const gnc_commodity *) a;
const gnc_commodity *cb = (const gnc_commodity *) b;
return(safe_strcmp(gnc_commodity_get_mnemonic(ca),
return(g_strcmp0(gnc_commodity_get_mnemonic(ca),
gnc_commodity_get_mnemonic(cb)));
}

View File

@@ -55,7 +55,7 @@ dom_tree_to_guid(xmlNodePtr node)
type = (char*)xmlNodeGetContent (node->properties->xmlAttrPropertyValue);
/* handle new and guid the same for the moment */
if ((safe_strcmp("guid", type) == 0) || (safe_strcmp("new", type) == 0))
if ((g_strcmp0("guid", type) == 0) || (g_strcmp0("new", type) == 0))
{
GncGUID *gid = g_new(GncGUID, 1);
char *guid_str;
@@ -338,7 +338,7 @@ dom_tree_to_list_kvp_value(xmlNodePtr node)
{
kvp_value *new_val;
if (safe_strcmp ((char*)mark->name, "text") == 0)
if (g_strcmp0 ((char*)mark->name, "text") == 0)
continue;
new_val = dom_tree_to_kvp_value(mark);
@@ -412,7 +412,7 @@ dom_tree_to_kvp_value(xmlNodePtr node)
for (mark = val_converters; mark->tag; mark++)
{
if (safe_strcmp(type, mark->tag) == 0)
if (g_strcmp0(type, mark->tag) == 0)
{
ret = (mark->converter)(node);
}
@@ -438,7 +438,7 @@ dom_tree_to_kvp_frame_given(xmlNodePtr node, kvp_frame *frame)
for (mark = node->xmlChildrenNode; mark; mark = mark->next)
{
if (safe_strcmp((char*)mark->name, "slot") == 0)
if (g_strcmp0((char*)mark->name, "slot") == 0)
{
xmlNodePtr mark2;
gchar *key = NULL;
@@ -446,11 +446,11 @@ dom_tree_to_kvp_frame_given(xmlNodePtr node, kvp_frame *frame)
for (mark2 = mark->xmlChildrenNode; mark2; mark2 = mark2->next)
{
if (safe_strcmp((char*)mark2->name, "slot:key") == 0)
if (g_strcmp0((char*)mark2->name, "slot:key") == 0)
{
key = dom_tree_to_text(mark2);
}
else if (safe_strcmp((char*)mark2->name, "slot:value") == 0)
else if (g_strcmp0((char*)mark2->name, "slot:value") == 0)
{
val = dom_tree_to_kvp_value(mark2);
}
@@ -597,7 +597,7 @@ dom_tree_to_timespec(xmlNodePtr node)
case XML_TEXT_NODE:
break;
case XML_ELEMENT_NODE:
if (safe_strcmp("ts:date", (char*)n->name) == 0)
if (g_strcmp0("ts:date", (char*)n->name) == 0)
{
if (seen_s)
{
@@ -620,7 +620,7 @@ dom_tree_to_timespec(xmlNodePtr node)
seen_s = TRUE;
}
}
else if (safe_strcmp("ts:ns", (char*)n->name) == 0)
else if (g_strcmp0("ts:ns", (char*)n->name) == 0)
{
if (seen_ns)
{
@@ -686,7 +686,7 @@ dom_tree_to_gdate(xmlNodePtr node)
case XML_TEXT_NODE:
break;
case XML_ELEMENT_NODE:
if (safe_strcmp("gdate", (char*)n->name) == 0)
if (g_strcmp0("gdate", (char*)n->name) == 0)
{
if (seen_date)
{
@@ -765,7 +765,7 @@ dom_tree_to_commodity_ref_no_engine(xmlNodePtr node, QofBook *book)
case XML_TEXT_NODE:
break;
case XML_ELEMENT_NODE:
if (safe_strcmp("cmdty:space", (char*)n->name) == 0)
if (g_strcmp0("cmdty:space", (char*)n->name) == 0)
{
if (space_str)
{
@@ -778,7 +778,7 @@ dom_tree_to_commodity_ref_no_engine(xmlNodePtr node, QofBook *book)
space_str = content;
}
}
else if (safe_strcmp("cmdty:id", (char*)n->name) == 0)
else if (g_strcmp0("cmdty:id", (char*)n->name) == 0)
{
if (id_str)
{
@@ -874,7 +874,7 @@ gnc_xml_set_data(const gchar* tag, xmlNodePtr node, gpointer item,
{
for (; handlers->tag != NULL; handlers++)
{
if (safe_strcmp(tag, handlers->tag) == 0)
if (g_strcmp0(tag, handlers->tag) == 0)
{
(handlers->handler)(node, item);
handlers->gotten = TRUE;
@@ -904,7 +904,7 @@ 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 ((char*)achild->name, "text") == 0)
if (g_strcmp0 ((char*)achild->name, "text") == 0)
continue;
if (!gnc_xml_set_data((char*)achild->name, achild, data, handlers))

View File

@@ -49,7 +49,7 @@ is_child_result_from_node_named(sixtp_child_result *cr, const char *tag)
{
return((cr->type == SIXTP_CHILD_RESULT_NODE)
&&
(safe_strcmp(cr->tag, tag) == 0));
(g_strcmp0(cr->tag, tag) == 0));
}
void
@@ -511,13 +511,13 @@ sixtp_sax_end_handler(void *user_data, const xmlChar *name)
/* time to make sure we got the right closing tag. Is this really
necessary? */
if (safe_strcmp(current_frame->tag, (gchar*) name) != 0)
if (g_strcmp0(current_frame->tag, (gchar*) name) != 0)
{
g_warning("bad closing tag (start <%s>, end <%s>)", current_frame->tag, name);
pdata->parsing_ok = FALSE;
/* See if we're just off by one and try to recover */
if (safe_strcmp(parent_frame->tag, (gchar*) name) == 0)
if (g_strcmp0(parent_frame->tag, (gchar*) name) == 0)
{
pdata->stack = sixtp_pop_and_destroy_frame(pdata->stack);
current_frame = (sixtp_stack_frame *) pdata->stack->data;

View File

@@ -106,7 +106,7 @@ test_dom_tree_to_text(void)
"null return from dom_tree_to_text");
xmlElemDump(stdout, NULL, test_node);
}
else if (safe_strcmp(test_string1, test_string2) == 0)
else if (g_strcmp0(test_string1, test_string2) == 0)
{
success_args("dom_tree_to_text", __FILE__, __LINE__, "with string %s",
test_string1);

View File

@@ -122,7 +122,7 @@ check_dom_tree_version(xmlNodePtr node, gchar *verstr)
FALSE);
verteststr = (char*) node->properties->xmlAttrPropertyValue->content;
if (safe_strcmp(verstr, verteststr) == 0)
if (g_strcmp0(verstr, verteststr) == 0)
{
return TRUE;
}
@@ -146,7 +146,7 @@ equals_node_val_vs_string(xmlNodePtr node, const gchar* str)
{
return FALSE;
}
else if (safe_strcmp(cmp1, str) == 0)
else if (g_strcmp0(cmp1, str) == 0)
{
g_free(cmp1);
return TRUE;

View File

@@ -90,7 +90,7 @@ test_load_file(const char *filename)
remove_locks(filename);
ignore_lock = (safe_strcmp(g_getenv("SRCDIR"), ".") != 0);
ignore_lock = (g_strcmp0(g_getenv("SRCDIR"), ".") != 0);
qof_session_begin(session, filename, ignore_lock, FALSE, TRUE);
qof_session_load(session, NULL);

View File

@@ -98,7 +98,7 @@ test_string_converters(void)
backout = dom_tree_to_text(test_node);
do_test_args(
safe_strcmp(backout, mark) == 0,
g_strcmp0(backout, mark) == 0,
"string converting", __FILE__, __LINE__, "with string %s", mark);
}
}

View File

@@ -54,7 +54,7 @@ node_and_account_equal(xmlNodePtr node, Account *act)
{
xmlNodePtr mark;
while (safe_strcmp ((char*)node->name, "text") == 0)
while (g_strcmp0 ((char*)node->name, "text") == 0)
{
node = node->next;
}
@@ -64,31 +64,31 @@ node_and_account_equal(xmlNodePtr node, Account *act)
return g_strdup("version wrong. Not 2.0.0 or not there");
}
if (!node->name || safe_strcmp((char*)node->name, "gnc:account"))
if (!node->name || g_strcmp0((char*)node->name, "gnc:account"))
{
return g_strdup("Name of toplevel node is bad");
}
for (mark = node->xmlChildrenNode; mark; mark = mark->next)
{
if (safe_strcmp((char*)mark->name, "text") == 0)
if (g_strcmp0((char*)mark->name, "text") == 0)
{
}
else if (safe_strcmp((char*)mark->name, "act:name") == 0)
else if (g_strcmp0((char*)mark->name, "act:name") == 0)
{
if (!equals_node_val_vs_string(mark, xaccAccountGetName(act)))
{
return g_strdup("names differ");
}
}
else if (safe_strcmp((char*)mark->name, "act:id") == 0)
else if (g_strcmp0((char*)mark->name, "act:id") == 0)
{
if (!equals_node_val_vs_guid(mark, xaccAccountGetGUID(act)))
{
return g_strdup("ids differ");
}
}
else if (safe_strcmp((char*)mark->name, "act:type") == 0)
else if (g_strcmp0((char*)mark->name, "act:type") == 0)
{
gchar *txt;
int type;
@@ -114,7 +114,7 @@ node_and_account_equal(xmlNodePtr node, Account *act)
g_free(txt);
}
}
else if (safe_strcmp((char*)mark->name, "act:commodity") == 0)
else if (g_strcmp0((char*)mark->name, "act:commodity") == 0)
{
/* This is somewhat BS, because if the commodity isn't a
currency (and therefore built in) there isn't a
@@ -128,14 +128,14 @@ node_and_account_equal(xmlNodePtr node, Account *act)
return g_strdup("commodities differ");
}
}
else if (safe_strcmp((char*)mark->name, "act:code") == 0)
else if (g_strcmp0((char*)mark->name, "act:code") == 0)
{
if (!equals_node_val_vs_string(mark, xaccAccountGetCode(act)))
{
return g_strdup("codes differ");
}
}
else if (safe_strcmp((char*)mark->name, "act:description") == 0)
else if (g_strcmp0((char*)mark->name, "act:description") == 0)
{
if (!equals_node_val_vs_string(
mark, xaccAccountGetDescription(act)))
@@ -143,7 +143,7 @@ node_and_account_equal(xmlNodePtr node, Account *act)
return g_strdup("descriptions differ");
}
}
else if (safe_strcmp((char*)mark->name, "act:slots") == 0)
else if (g_strcmp0((char*)mark->name, "act:slots") == 0)
{
/* xaccAccountDeleteOldData (act); */
@@ -152,7 +152,7 @@ node_and_account_equal(xmlNodePtr node, Account *act)
return g_strdup("slots differ");
}
}
else if (safe_strcmp((char*)mark->name, "act:parent") == 0)
else if (g_strcmp0((char*)mark->name, "act:parent") == 0)
{
if (!equals_node_val_vs_guid(
mark, xaccAccountGetGUID(gnc_account_get_parent(act))))
@@ -160,28 +160,28 @@ node_and_account_equal(xmlNodePtr node, Account *act)
return g_strdup("parent ids differ");
}
}
else if (safe_strcmp((char*)mark->name, "act:commodity-scu") == 0)
else if (g_strcmp0((char*)mark->name, "act:commodity-scu") == 0)
{
if (!equals_node_val_vs_int(mark, xaccAccountGetCommoditySCU(act)))
{
return g_strdup("commodity scus differ");
}
}
else if (safe_strcmp((char*)mark->name, "act:hidden") == 0)
else if (g_strcmp0((char*)mark->name, "act:hidden") == 0)
{
if (!equals_node_val_vs_boolean(mark, xaccAccountGetHidden(act)))
{
return g_strdup("Hidden flags differ");
}
}
else if (safe_strcmp((char*)mark->name, "act:placeholder") == 0)
else if (g_strcmp0((char*)mark->name, "act:placeholder") == 0)
{
if (!equals_node_val_vs_boolean(mark, xaccAccountGetPlaceholder(act)))
{
return g_strdup("Placeholder flags differ");
}
}
else if (safe_strcmp((char*)mark->name, "act:security") == 0)
else if (g_strcmp0((char*)mark->name, "act:security") == 0)
{
return NULL; // This tag is ignored.
}

View File

@@ -34,7 +34,7 @@ node_and_commodity_equal(xmlNodePtr node, const gnc_commodity *com)
{
xmlNodePtr mark;
while (safe_strcmp ((char*)node->name, "text") == 0)
while (g_strcmp0 ((char*)node->name, "text") == 0)
node = node->next;
if (!check_dom_tree_version(node, "2.0.0"))
@@ -42,17 +42,17 @@ node_and_commodity_equal(xmlNodePtr node, const gnc_commodity *com)
return "version wrong. Not 2.0.0 or not there";
}
if (!node->name || safe_strcmp((char*)node->name, "gnc:commodity"))
if (!node->name || g_strcmp0((char*)node->name, "gnc:commodity"))
{
return "Name of toplevel node is bad";
}
for (mark = node->xmlChildrenNode; mark; mark = mark->next)
{
if (safe_strcmp((char*)mark->name, "text") == 0)
if (g_strcmp0((char*)mark->name, "text") == 0)
{
}
else if (safe_strcmp((char*)mark->name, "cmdty:space") == 0)
else if (g_strcmp0((char*)mark->name, "cmdty:space") == 0)
{
if (!equals_node_val_vs_string(
mark, gnc_commodity_get_namespace_compat(com)))
@@ -60,7 +60,7 @@ node_and_commodity_equal(xmlNodePtr node, const gnc_commodity *com)
return "namespaces differ";
}
}
else if (safe_strcmp((char*)mark->name, "cmdty:id") == 0)
else if (g_strcmp0((char*)mark->name, "cmdty:id") == 0)
{
if (!equals_node_val_vs_string(
mark, gnc_commodity_get_mnemonic(com)))
@@ -68,7 +68,7 @@ node_and_commodity_equal(xmlNodePtr node, const gnc_commodity *com)
return "mnemonic differ";
}
}
else if (safe_strcmp((char*)mark->name, "cmdty:name") == 0)
else if (g_strcmp0((char*)mark->name, "cmdty:name") == 0)
{
if (!equals_node_val_vs_string(
mark, gnc_commodity_get_fullname(com)))
@@ -76,7 +76,7 @@ node_and_commodity_equal(xmlNodePtr node, const gnc_commodity *com)
return "names differ";
}
}
else if (safe_strcmp((char*)mark->name, "cmdty:xcode") == 0)
else if (g_strcmp0((char*)mark->name, "cmdty:xcode") == 0)
{
if (!equals_node_val_vs_string(
mark, gnc_commodity_get_cusip(com)))
@@ -84,7 +84,7 @@ node_and_commodity_equal(xmlNodePtr node, const gnc_commodity *com)
return "exchange codes differ";
}
}
else if (safe_strcmp((char*)mark->name, "cmdty:fraction") == 0)
else if (g_strcmp0((char*)mark->name, "cmdty:fraction") == 0)
{
gchar *txt;
gint64 type;
@@ -112,9 +112,9 @@ node_and_commodity_equal(xmlNodePtr node, const gnc_commodity *com)
}
}
/* Legitimate tags which we don't yet have tests */
else if (safe_strcmp((char*)mark->name, "cmdty:get_quotes") == 0 ||
safe_strcmp((char*)mark->name, "cmdty:quote_source") == 0 ||
safe_strcmp((char*)mark->name, "cmdty:quote_tz") == 0)
else if (g_strcmp0((char*)mark->name, "cmdty:get_quotes") == 0 ||
g_strcmp0((char*)mark->name, "cmdty:quote_source") == 0 ||
g_strcmp0((char*)mark->name, "cmdty:quote_tz") == 0)
{
continue;
}

View File

@@ -69,7 +69,7 @@ find_appropriate_node(xmlNodePtr node, Split *spl)
for (mark2 = mark->xmlChildrenNode; mark2; mark2 = mark2->next)
{
if (safe_strcmp((char*)mark2->name, "split:value") == 0)
if (g_strcmp0((char*)mark2->name, "split:value") == 0)
{
gnc_numeric *num = dom_tree_to_gnc_numeric(mark2);
@@ -80,7 +80,7 @@ find_appropriate_node(xmlNodePtr node, Split *spl)
g_free(num);
}
else if (safe_strcmp((char*)mark2->name, "split:account") == 0)
else if (g_strcmp0((char*)mark2->name, "split:account") == 0)
{
GncGUID *accid = dom_tree_to_guid(mark2);
Account *account = xaccSplitGetAccount (spl);
@@ -109,7 +109,7 @@ equals_node_val_vs_split_internal(xmlNodePtr node, Split* spl)
for (mark = node->children; mark != NULL; mark = mark->next)
{
if (safe_strcmp((char*)mark->name, "split:id") == 0)
if (g_strcmp0((char*)mark->name, "split:id") == 0)
{
GncGUID *id = dom_tree_to_guid(mark);
@@ -120,18 +120,18 @@ equals_node_val_vs_split_internal(xmlNodePtr node, Split* spl)
}
g_free(id);
}
else if (safe_strcmp((char*)mark->name, "split:memo") == 0)
else if (g_strcmp0((char*)mark->name, "split:memo") == 0)
{
char *memo = dom_tree_to_text(mark);
if (safe_strcmp(memo, xaccSplitGetMemo(spl)) != 0)
if (g_strcmp0(memo, xaccSplitGetMemo(spl)) != 0)
{
g_free(memo);
return "memos differ";
}
g_free(memo);
}
else if (safe_strcmp((char*)mark->name, "split:reconciled-state") == 0)
else if (g_strcmp0((char*)mark->name, "split:reconciled-state") == 0)
{
char *rs = dom_tree_to_text(mark);
@@ -142,7 +142,7 @@ equals_node_val_vs_split_internal(xmlNodePtr node, Split* spl)
}
g_free(rs);
}
else if (safe_strcmp((char*)mark->name, "split:value") == 0)
else if (g_strcmp0((char*)mark->name, "split:value") == 0)
{
gnc_numeric *num = dom_tree_to_gnc_numeric(mark);
gnc_numeric val = xaccSplitGetValue(spl);
@@ -158,7 +158,7 @@ equals_node_val_vs_split_internal(xmlNodePtr node, Split* spl)
}
g_free(num);
}
else if (safe_strcmp((char*)mark->name, "split:quantity") == 0)
else if (g_strcmp0((char*)mark->name, "split:quantity") == 0)
{
gnc_numeric *num = dom_tree_to_gnc_numeric(mark);
gnc_numeric val = xaccSplitGetAmount(spl);
@@ -183,7 +183,7 @@ equals_node_val_vs_split_internal(xmlNodePtr node, Split* spl)
}
g_free(num);
}
else if (safe_strcmp((char*)mark->name, "split:account") == 0)
else if (g_strcmp0((char*)mark->name, "split:account") == 0)
{
GncGUID *id = dom_tree_to_guid(mark);
Account *account = xaccSplitGetAccount (spl);
@@ -237,7 +237,7 @@ node_and_transaction_equal(xmlNodePtr node, Transaction *trn)
{
xmlNodePtr mark;
while (safe_strcmp ((char*)node->name, "text") == 0)
while (g_strcmp0 ((char*)node->name, "text") == 0)
node = node->next;
if (!check_dom_tree_version(node, "2.0.0"))
@@ -245,17 +245,17 @@ node_and_transaction_equal(xmlNodePtr node, Transaction *trn)
return "version wrong. Not 2.0.0 or not there";
}
if (!node->name || safe_strcmp((char*)node->name, "gnc:transaction"))
if (!node->name || g_strcmp0((char*)node->name, "gnc:transaction"))
{
return "Name of toplevel node is bad";
}
for (mark = node->xmlChildrenNode; mark; mark = mark->next)
{
if (safe_strcmp((char*)mark->name, "text") == 0)
if (g_strcmp0((char*)mark->name, "text") == 0)
{
}
else if (safe_strcmp((char*)mark->name, "trn:id") == 0)
else if (g_strcmp0((char*)mark->name, "trn:id") == 0)
{
if (!equals_node_val_vs_guid(mark, xaccTransGetGUID(trn)))
{
@@ -266,7 +266,7 @@ node_and_transaction_equal(xmlNodePtr node, Transaction *trn)
/* This test will fail for many splits where the transaction has
* splits in different commodities -- eg, buying or selling a
* stock. jralls 2010-11-02 */
else if (safe_strcmp((char*)mark->name, "trn:currency") == 0)
else if (g_strcmp0((char*)mark->name, "trn:currency") == 0)
{
#if 0
if (!equals_node_val_vs_commodity(
@@ -276,42 +276,42 @@ node_and_transaction_equal(xmlNodePtr node, Transaction *trn)
}
#endif
}
else if (safe_strcmp((char*)mark->name, "trn:num") == 0)
else if (g_strcmp0((char*)mark->name, "trn:num") == 0)
{
if (!equals_node_val_vs_string(mark, xaccTransGetNum(trn)))
{
return "nums differ";
}
}
else if (safe_strcmp((char*)mark->name, "trn:date-posted") == 0)
else if (g_strcmp0((char*)mark->name, "trn:date-posted") == 0)
{
if (!equals_node_val_vs_date(mark, xaccTransRetDatePostedTS(trn)))
{
return "posted dates differ";
}
}
else if (safe_strcmp((char*)mark->name, "trn:date-entered") == 0)
else if (g_strcmp0((char*)mark->name, "trn:date-entered") == 0)
{
if (!equals_node_val_vs_date(mark, xaccTransRetDateEnteredTS(trn)))
{
return "entered dates differ";
}
}
else if (safe_strcmp((char*)mark->name, "trn:description") == 0)
else if (g_strcmp0((char*)mark->name, "trn:description") == 0)
{
if (!equals_node_val_vs_string(mark, xaccTransGetDescription(trn)))
{
return "descriptions differ";
}
}
else if (safe_strcmp((char*)mark->name, "trn:slots") == 0)
else if (g_strcmp0((char*)mark->name, "trn:slots") == 0)
{
if (!equals_node_val_vs_kvp_frame(mark, xaccTransGetSlots(trn)))
{
return "slots differ";
}
}
else if (safe_strcmp((char*)mark->name, "trn:splits") == 0)
else if (g_strcmp0((char*)mark->name, "trn:splits") == 0)
{
char *msg = equals_node_val_vs_splits (mark, trn);
if (msg != NULL)

View File

@@ -308,7 +308,7 @@ static gboolean check_entry_nonempty (GtkWidget *dialog, GtkWidget *entry,
const char * error_message)
{
const char *res = gtk_entry_get_text (GTK_ENTRY (entry));
if (safe_strcmp (res, "") == 0)
if (g_strcmp0 (res, "") == 0)
{
if (error_message)
gnc_error_dialog (dialog, "%s", error_message);
@@ -358,7 +358,7 @@ gnc_customer_window_ok_cb (GtkWidget *widget, gpointer data)
return;
/* Set the customer id if one has not been chosen */
if (safe_strcmp (gtk_entry_get_text (GTK_ENTRY (cw->id_entry)), "") == 0)
if (g_strcmp0 (gtk_entry_get_text (GTK_ENTRY (cw->id_entry)), "") == 0)
{
string = gncCustomerNextID (cw->book);
gtk_entry_set_text (GTK_ENTRY (cw->id_entry), string);

View File

@@ -205,7 +205,7 @@ static gboolean check_entry_nonempty (GtkWidget *dialog, GtkWidget *entry,
const char * error_message)
{
const char *res = gtk_entry_get_text (GTK_ENTRY (entry));
if (safe_strcmp (res, "") == 0)
if (g_strcmp0 (res, "") == 0)
{
if (error_message)
gnc_error_dialog (dialog, "%s", error_message);
@@ -242,7 +242,7 @@ gnc_employee_window_ok_cb (GtkWidget *widget, gpointer data)
}
/* Set the employee id if one has not been chosen */
if (safe_strcmp (gtk_entry_get_text (GTK_ENTRY (ew->id_entry)), "") == 0)
if (g_strcmp0 (gtk_entry_get_text (GTK_ENTRY (ew->id_entry)), "") == 0)
{
string = gncEmployeeNextID (ew->book);
gtk_entry_set_text (GTK_ENTRY (ew->id_entry), string);

View File

@@ -369,7 +369,7 @@ gnc_invoice_window_verify_ok (InvoiceWindow *iw)
/* Check the Owner */
gnc_owner_get_owner (iw->owner_choice, &(iw->owner));
res = gncOwnerGetName (&(iw->owner));
if (res == NULL || safe_strcmp (res, "") == 0)
if (res == NULL || g_strcmp0 (res, "") == 0)
{
gnc_error_dialog (iw_get_window(iw), "%s",
/* Translators: In this context,
@@ -383,7 +383,7 @@ gnc_invoice_window_verify_ok (InvoiceWindow *iw)
/* Check the ID; set one if necessary */
res = gtk_entry_get_text (GTK_ENTRY (iw->id_entry));
if (safe_strcmp (res, "") == 0)
if (g_strcmp0 (res, "") == 0)
{
/* Invoices and bills have separate counters.
Therefore we pass the GncOwer to gncInvoiceNextID

View File

@@ -130,7 +130,7 @@ gnc_job_verify_ok (JobWindow *jw)
/* Check for valid name */
res = gtk_entry_get_text (GTK_ENTRY (jw->name_entry));
if (safe_strcmp (res, "") == 0)
if (g_strcmp0 (res, "") == 0)
{
const char *message = _("The Job must be given a name.");
gnc_error_dialog(jw->dialog, "%s", message);
@@ -140,7 +140,7 @@ gnc_job_verify_ok (JobWindow *jw)
/* Check for owner */
gnc_owner_get_owner (jw->cust_edit, &(jw->owner));
res = gncOwnerGetName (&(jw->owner));
if (res == NULL || safe_strcmp (res, "") == 0)
if (res == NULL || g_strcmp0 (res, "") == 0)
{
const char *message = _("You must choose an owner for this job.");
gnc_error_dialog(jw->dialog, "%s", message);
@@ -149,7 +149,7 @@ gnc_job_verify_ok (JobWindow *jw)
/* Set a valid id if one was not created */
res = gtk_entry_get_text (GTK_ENTRY (jw->id_entry));
if (safe_strcmp (res, "") == 0)
if (g_strcmp0 (res, "") == 0)
{
string = gncJobNextID(jw->book);
gtk_entry_set_text (GTK_ENTRY (jw->id_entry), string);

View File

@@ -165,7 +165,7 @@ gnc_order_window_verify_ok (OrderWindow *ow)
/* Check the ID */
res = gtk_entry_get_text (GTK_ENTRY (ow->id_entry));
if (safe_strcmp (res, "") == 0)
if (g_strcmp0 (res, "") == 0)
{
gnc_error_dialog (ow->dialog, "%s",
_("The Order must be given an ID."));
@@ -175,7 +175,7 @@ gnc_order_window_verify_ok (OrderWindow *ow)
/* Check the Owner */
gnc_owner_get_owner (ow->owner_choice, &(ow->owner));
res = gncOwnerGetName (&(ow->owner));
if (res == NULL || safe_strcmp (res, "") == 0)
if (res == NULL || g_strcmp0 (res, "") == 0)
{
gnc_error_dialog (ow->dialog, "%s",
_("You need to supply Billing Information."));

View File

@@ -899,7 +899,7 @@ new_payment_window (GncOwner *owner, QofBook *book, GncInvoice *invoice)
text = gtk_entry_get_text(GTK_ENTRY (gtk_bin_get_child(GTK_BIN (GTK_COMBO_BOX(pw->post_combo)))));
if (!text || safe_strcmp (text, "") == 0)
if (!text || g_strcmp0 (text, "") == 0)
{
/* The code below assumes there will only be one account type.

View File

@@ -194,7 +194,7 @@ static gboolean check_entry_nonempty (GtkWidget *dialog, GtkWidget *entry,
const char * error_message)
{
const char *res = gtk_entry_get_text (GTK_ENTRY (entry));
if (safe_strcmp (res, "") == 0)
if (g_strcmp0 (res, "") == 0)
{
if (error_message)
gnc_error_dialog (dialog, "%s", error_message);
@@ -229,7 +229,7 @@ gnc_vendor_window_ok_cb (GtkWidget *widget, gpointer data)
}
/* Check for valid id and set one if necessary */
if (safe_strcmp (gtk_entry_get_text (GTK_ENTRY (vw->id_entry)), "") == 0)
if (g_strcmp0 (gtk_entry_get_text (GTK_ENTRY (vw->id_entry)), "") == 0)
{
string = gncVendorNextID(vw->book);
gtk_entry_set_text (GTK_ENTRY (vw->id_entry), string);

View File

@@ -1130,7 +1130,7 @@ gnc_plugin_business_gconf_changed (GConfClient *client,
if (!entry_key)
return;
if (safe_strcmp(entry_key, full_gconf_path) == 0)
if (g_strcmp0(entry_key, full_gconf_path) == 0)
{
update_extra_toolbuttons(mainwindow);
}

View File

@@ -364,7 +364,7 @@ gnc_find_entry_in_reg_by_desc(GncEntryLedger *reg, const char* desc)
if (entry == last_entry)
continue;
if (safe_strcmp (desc, gncEntryGetDescription (entry)) == 0)
if (g_strcmp0 (desc, gncEntryGetDescription (entry)) == 0)
return entry;
last_entry = entry;
@@ -378,7 +378,7 @@ static void set_value_combo_cell(BasicCell *cell, const char *new_value)
{
if (!cell || !new_value)
return;
if (safe_strcmp (new_value, gnc_basic_cell_get_value (cell)) == 0)
if (g_strcmp0 (new_value, gnc_basic_cell_get_value (cell)) == 0)
return;
gnc_combo_cell_set_value ((ComboCell *) cell, new_value);

View File

@@ -28,7 +28,7 @@
#include "Account.h"
#include "gnc-ui-util.h"
#include "qof.h" /* for safe_strcmp */
#include "qof.h" /* for g_strcmp0 */
#include "datecell.h"
#include "checkboxcell.h"
@@ -1092,9 +1092,9 @@ static void gnc_entry_ledger_save_cells (gpointer save_data,
value = gnc_table_layout_get_cell_value (ledger->table->layout,
ENTRY_PAYMENT_CELL);
if (!safe_strcmp (value, _("Cash")))
if (!g_strcmp0 (value, _("Cash")))
gncEntrySetBillPayment (entry, GNC_PAYMENT_CASH);
else if (!safe_strcmp (value, _("Charge")))
else if (!g_strcmp0 (value, _("Charge")))
gncEntrySetBillPayment (entry, GNC_PAYMENT_CARD);
else
g_warning ("Invalid Payment cell: %s", value ? value : "(null)");

View File

@@ -214,11 +214,11 @@ main(int argc, char **argv)
gnc_uri_get_components( strs[i].uri, &tprotocol, &thostname,
&tport, &tusername, &tpassword, &tpath );
testresult = ( safe_strcmp ( tprotocol, strs[i].protocol ) == 0 ) &
( safe_strcmp ( thostname, strs[i].hostname ) == 0 ) &
( safe_strcmp ( tusername, strs[i].username ) == 0 ) &
( safe_strcmp ( tpassword, strs[i].password ) == 0 ) &
( safe_strcmp ( tpath, strs[i].path ) == 0 ) &
testresult = ( g_strcmp0 ( tprotocol, strs[i].protocol ) == 0 ) &
( g_strcmp0 ( thostname, strs[i].hostname ) == 0 ) &
( g_strcmp0 ( tusername, strs[i].username ) == 0 ) &
( g_strcmp0 ( tpassword, strs[i].password ) == 0 ) &
( g_strcmp0 ( tpath, strs[i].path ) == 0 ) &
( tport == strs[i].port );
do_test_args(testresult,
"gnc_uri_get_components",
@@ -243,7 +243,7 @@ main(int argc, char **argv)
gboolean testresult;
tprotocol = gnc_uri_get_protocol( strs[i].uri );
testresult = ( safe_strcmp ( tprotocol, strs[i].protocol ) == 0 );
testresult = ( g_strcmp0 ( tprotocol, strs[i].protocol ) == 0 );
do_test_args(testresult,
"gnc_uri_get_protocol",
__FILE__, __LINE__,
@@ -261,7 +261,7 @@ main(int argc, char **argv)
gboolean testresult;
tpath = gnc_uri_get_path( strs[i].uri );
testresult = ( safe_strcmp ( tpath, strs[i].path ) == 0 );
testresult = ( g_strcmp0 ( tpath, strs[i].path ) == 0 );
do_test_args(testresult,
"gnc_uri_get_path",
__FILE__, __LINE__,
@@ -280,7 +280,7 @@ main(int argc, char **argv)
turi = gnc_uri_create_uri( strs[i].protocol, strs[i].hostname, strs[i].port,
strs[i].username, strs[i].password, strs[i].path );
testresult = ( safe_strcmp ( turi, strs[i].created_uri ) == 0 );
testresult = ( g_strcmp0 ( turi, strs[i].created_uri ) == 0 );
do_test_args(testresult,
"gnc_uri_create_uri",
__FILE__, __LINE__,
@@ -300,7 +300,7 @@ main(int argc, char **argv)
gboolean testresult;
turi = gnc_uri_normalize_uri( strs[i].uri, strs[i].want_password );
testresult = ( safe_strcmp ( turi, strs[i].normalized_uri ) == 0 );
testresult = ( g_strcmp0 ( turi, strs[i].normalized_uri ) == 0 );
do_test_args(testresult,
"gnc_uri_normalize_uri",
__FILE__, __LINE__,

View File

@@ -87,7 +87,7 @@ main(int argc, char **argv)
}
daout = gnc_resolve_file_path(dain);
do_test_args(safe_strcmp(daout, wantout) == 0,
do_test_args(g_strcmp0(daout, wantout) == 0,
"gnc_resolve_file_path",
__FILE__, __LINE__,
"%s (%s) vs %s", daout, dain, wantout);

View File

@@ -1309,19 +1309,19 @@ xaccAccountEqual(const Account *aa, const Account *ab, gboolean check_guids)
return FALSE;
}
if (safe_strcmp(priv_aa->accountName, priv_ab->accountName) != 0)
if (g_strcmp0(priv_aa->accountName, priv_ab->accountName) != 0)
{
PWARN ("names differ: %s vs %s", priv_aa->accountName, priv_ab->accountName);
return FALSE;
}
if (safe_strcmp(priv_aa->accountCode, priv_ab->accountCode) != 0)
if (g_strcmp0(priv_aa->accountCode, priv_ab->accountCode) != 0)
{
PWARN ("codes differ: %s vs %s", priv_aa->accountCode, priv_ab->accountCode);
return FALSE;
}
if (safe_strcmp(priv_aa->description, priv_ab->description) != 0)
if (g_strcmp0(priv_aa->description, priv_ab->description) != 0)
{
PWARN ("descriptions differ: %s vs %s", priv_aa->description, priv_ab->description);
return FALSE;
@@ -1981,7 +1981,7 @@ xaccAccountOrder (const Account *aa, const Account *ab)
}
/* Otherwise do a string sort */
result = safe_strcmp (da, db);
result = g_strcmp0 (da, db);
if (result)
return result;
@@ -2056,7 +2056,7 @@ xaccAccountSetName (Account *acc, const char *str)
/* optimizations */
priv = GET_PRIVATE(acc);
if (safe_strcmp(str, priv->accountName) == 0)
if (g_strcmp0(str, priv->accountName) == 0)
return;
xaccAccountBeginEdit(acc);
@@ -2075,7 +2075,7 @@ xaccAccountSetCode (Account *acc, const char *str)
/* optimizations */
priv = GET_PRIVATE(acc);
if (safe_strcmp(str, priv->accountCode) == 0)
if (g_strcmp0(str, priv->accountCode) == 0)
return;
xaccAccountBeginEdit(acc);
@@ -2094,7 +2094,7 @@ xaccAccountSetDescription (Account *acc, const char *str)
/* optimizations */
priv = GET_PRIVATE(acc);
if (safe_strcmp(str, priv->description) == 0)
if (g_strcmp0(str, priv->description) == 0)
return;
xaccAccountBeginEdit(acc);
@@ -2635,7 +2635,7 @@ gnc_account_lookup_by_name (const Account *parent, const char * name)
{
child = node->data;
cpriv = GET_PRIVATE(child);
if (safe_strcmp(cpriv->accountName, name) == 0)
if (g_strcmp0(cpriv->accountName, name) == 0)
return child;
}
@@ -2668,7 +2668,7 @@ gnc_account_lookup_by_code (const Account *parent, const char * code)
{
child = node->data;
cpriv = GET_PRIVATE(child);
if (safe_strcmp(cpriv->accountCode, code) == 0)
if (g_strcmp0(cpriv->accountCode, code) == 0)
return child;
}
@@ -2707,7 +2707,7 @@ gnc_account_lookup_by_full_name_helper (const Account *parent,
Account *account = node->data;
priv = GET_PRIVATE(account);
if (safe_strcmp(priv->accountName, names[0]) == 0)
if (g_strcmp0(priv->accountName, names[0]) == 0)
{
/* We found an account. If the next entry is NULL, there is
* nothing left in the name, so just return the account. */
@@ -3825,7 +3825,7 @@ xaccAccountTypeEnumAsString(GNCAccountType type)
#undef GNC_RETURN_ENUM_AS_STRING
#define GNC_RETURN_ON_MATCH(x) \
if(safe_strcmp(#x, (str)) == 0) { *type = ACCT_TYPE_ ## x; return(TRUE); }
if(g_strcmp0(#x, (str)) == 0) { *type = ACCT_TYPE_ ## x; return(TRUE); }
gboolean
xaccAccountStringToType(const char* str, GNCAccountType *type)
@@ -4355,7 +4355,7 @@ finder_help_function(const Account *acc, const char *description,
Split *lsplit = slp->data;
Transaction *ltrans = xaccSplitGetParent(lsplit);
if (safe_strcmp (description, xaccTransGetDescription (ltrans)) == 0)
if (g_strcmp0 (description, xaccTransGetDescription (ltrans)) == 0)
{
if (split) *split = lsplit;
if (trans) *trans = ltrans;

View File

@@ -551,11 +551,11 @@ xaccQueryAddGUIDMatch(QofQuery * q, const GncGUID *guid,
if (!q || !guid || !id_type)
return;
if (!safe_strcmp (id_type, GNC_ID_SPLIT))
if (!g_strcmp0 (id_type, GNC_ID_SPLIT))
param_list = qof_query_build_param_list (QOF_PARAM_GUID, NULL);
else if (!safe_strcmp (id_type, GNC_ID_TRANS))
else if (!g_strcmp0 (id_type, GNC_ID_TRANS))
param_list = qof_query_build_param_list (SPLIT_TRANS, QOF_PARAM_GUID, NULL);
else if (!safe_strcmp (id_type, GNC_ID_ACCOUNT))
else if (!g_strcmp0 (id_type, GNC_ID_ACCOUNT))
param_list = qof_query_build_param_list (SPLIT_ACCOUNT, QOF_PARAM_GUID, NULL);
else
PERR ("Invalid match type: %s", id_type);
@@ -578,11 +578,11 @@ xaccQueryAddKVPMatch(QofQuery *q, GSList *path, const KvpValue *value,
if (!pred_data)
return;
if (!safe_strcmp (id_type, GNC_ID_SPLIT))
if (!g_strcmp0 (id_type, GNC_ID_SPLIT))
param_list = qof_query_build_param_list (SPLIT_KVP, NULL);
else if (!safe_strcmp (id_type, GNC_ID_TRANS))
else if (!g_strcmp0 (id_type, GNC_ID_TRANS))
param_list = qof_query_build_param_list (SPLIT_TRANS, TRANS_KVP, NULL);
else if (!safe_strcmp (id_type, GNC_ID_ACCOUNT))
else if (!g_strcmp0 (id_type, GNC_ID_ACCOUNT))
param_list = qof_query_build_param_list (SPLIT_ACCOUNT, ACCOUNT_KVP, NULL);
else
PERR ("Invalid match type: %s", id_type);

View File

@@ -506,7 +506,7 @@ recurrencePeriodTypeFromString(const gchar *str)
int i;
for (i = 0; i < NUM_PERIOD_TYPES; i++)
if (safe_strcmp(period_type_strings[i], str) == 0)
if (g_strcmp0(period_type_strings[i], str) == 0)
return i;
return -1;
}
@@ -523,7 +523,7 @@ recurrenceWeekendAdjustFromString(const gchar *str)
int i;
for (i = 0; i < NUM_WEEKEND_ADJS; i++)
if (safe_strcmp(weekend_adj_strings[i], str) == 0)
if (g_strcmp0(weekend_adj_strings[i], str) == 0)
return i;
return -1;
}

View File

@@ -564,14 +564,14 @@ xaccSplitEqual(const Split *sa, const Split *sb,
}
/* If the same book, since these strings are cached we can just use pointer equality */
if ((same_book && sa->memo != sb->memo) || (!same_book && safe_strcmp(sa->memo, sb->memo) != 0))
if ((same_book && sa->memo != sb->memo) || (!same_book && g_strcmp0(sa->memo, sb->memo) != 0))
{
PWARN ("memos differ: (%p)%s vs (%p)%s",
sa->memo, sa->memo, sb->memo, sb->memo);
return FALSE;
}
if ((same_book && sa->action != sb->action) || (!same_book && safe_strcmp(sa->action, sb->action) != 0))
if ((same_book && sa->action != sb->action) || (!same_book && g_strcmp0(sa->action, sb->action) != 0))
{
PWARN ("actions differ: %s vs %s", sa->action, sb->action);
return FALSE;
@@ -1456,7 +1456,7 @@ xaccSplitCompareAccountCodes(const Split *sa, const Split *sb)
aa = sa->acc;
ab = sb->acc;
return safe_strcmp(xaccAccountGetCode(aa), xaccAccountGetCode(ab));
return g_strcmp0(xaccAccountGetCode(aa), xaccAccountGetCode(ab));
}
int
@@ -1474,7 +1474,7 @@ xaccSplitCompareOtherAccountFullNames(const Split *sa, const Split *sb)
ca = xaccSplitGetCorrAccountFullName(sa);
cb = xaccSplitGetCorrAccountFullName(sb);
retval = safe_strcmp(ca, cb);
retval = g_strcmp0(ca, cb);
g_free(ca);
g_free(cb);
return retval;
@@ -1490,7 +1490,7 @@ xaccSplitCompareOtherAccountCodes(const Split *sa, const Split *sb)
ca = xaccSplitGetCorrAccountCode(sa);
cb = xaccSplitGetCorrAccountCode(sb);
return safe_strcmp(ca, cb);
return g_strcmp0(ca, cb);
}
static void

View File

@@ -705,14 +705,14 @@ xaccTransEqual(const Transaction *ta, const Transaction *tb,
/* If the same book, since we use cached strings, we can just compare pointer
* equality for num and description
*/
if ((same_book && ta->num != tb->num) || (!same_book && safe_strcmp(ta->num, tb->num) != 0))
if ((same_book && ta->num != tb->num) || (!same_book && g_strcmp0(ta->num, tb->num) != 0))
{
PWARN ("num differs: %s vs %s", ta->num, tb->num);
return FALSE;
}
if ((same_book && ta->description != tb->description)
|| (!same_book && safe_strcmp(ta->description, tb->description)))
|| (!same_book && g_strcmp0(ta->description, tb->description)))
{
PWARN ("descriptions differ: %s vs %s", ta->description, tb->description);
return FALSE;

View File

@@ -732,7 +732,7 @@ xaccSplitComputeCapGains(Split *split, Account *gain_acc)
return;
}
if (safe_strcmp ("stock-split", xaccSplitGetType (split)) == 0)
if (g_strcmp0 ("stock-split", xaccSplitGetType (split)) == 0)
{
LEAVE ("Stock split split, returning.");
return;

View File

@@ -250,11 +250,11 @@ gnc_scm2acct_match_how (SCM how_scm)
QofGuidMatch res;
const gchar *how = SCM_SYMBOL_CHARS (how_scm);
if (!safe_strcmp (how, "acct-match-all"))
if (!g_strcmp0 (how, "acct-match-all"))
res = QOF_GUID_MATCH_ALL;
else if (!safe_strcmp (how, "acct-match-any"))
else if (!g_strcmp0 (how, "acct-match-any"))
res = QOF_GUID_MATCH_ANY;
else if (!safe_strcmp (how, "acct-match-none"))
else if (!g_strcmp0 (how, "acct-match-none"))
res = QOF_GUID_MATCH_NONE;
else
{
@@ -270,11 +270,11 @@ gnc_scm2amt_match_how (SCM how_scm)
QofQueryCompare res;
const gchar *how = SCM_SYMBOL_CHARS (how_scm);
if (!safe_strcmp (how, "amt-match-atleast"))
if (!g_strcmp0 (how, "amt-match-atleast"))
res = QOF_COMPARE_GTE;
else if (!safe_strcmp (how, "amt-match-atmost"))
else if (!g_strcmp0 (how, "amt-match-atmost"))
res = QOF_COMPARE_LTE;
else if (!safe_strcmp (how, "amt-match-exactly"))
else if (!g_strcmp0 (how, "amt-match-exactly"))
res = QOF_COMPARE_EQUAL;
else
{
@@ -291,15 +291,15 @@ gnc_scm2kvp_match_how (SCM how_scm)
QofQueryCompare res;
const gchar *how = SCM_SYMBOL_CHARS (how_scm);
if (!safe_strcmp (how, "kvp-match-lt"))
if (!g_strcmp0 (how, "kvp-match-lt"))
res = QOF_COMPARE_LT;
else if (!safe_strcmp (how, "kvp-match-lte"))
else if (!g_strcmp0 (how, "kvp-match-lte"))
res = QOF_COMPARE_LTE;
else if (!safe_strcmp (how, "kvp-match-eq"))
else if (!g_strcmp0 (how, "kvp-match-eq"))
res = QOF_COMPARE_EQUAL;
else if (!safe_strcmp (how, "kvp-match-gte"))
else if (!g_strcmp0 (how, "kvp-match-gte"))
res = QOF_COMPARE_GTE;
else if (!safe_strcmp (how, "kvp-match-gt"))
else if (!g_strcmp0 (how, "kvp-match-gt"))
res = QOF_COMPARE_GT;
else
{
@@ -355,7 +355,7 @@ gnc_scm2balance_match_how (SCM how_scm, gboolean *resp)
how = SCM_SYMBOL_CHARS (SCM_CAR(how_scm));
if (!safe_strcmp (how, "balance-match-balanced"))
if (!g_strcmp0 (how, "balance-match-balanced"))
*resp = TRUE;
else
*resp = FALSE;
@@ -374,11 +374,11 @@ gnc_scm2kvp_match_where (SCM where_scm)
where = SCM_SYMBOL_CHARS (SCM_CAR(where_scm));
if (!safe_strcmp (where, "kvp-match-split"))
if (!g_strcmp0 (where, "kvp-match-split"))
res = GNC_ID_SPLIT;
else if (!safe_strcmp (where, "kvp-match-trans"))
else if (!g_strcmp0 (where, "kvp-match-trans"))
res = GNC_ID_TRANS;
else if (!safe_strcmp (where, "kvp-match-account"))
else if (!g_strcmp0 (where, "kvp-match-account"))
res = GNC_ID_ACCOUNT;
else
{
@@ -829,7 +829,7 @@ gnc_queryterm2scm (const QofQueryTerm *qt)
qt_scm = scm_cons (scm_str2symbol (pd->type_name), qt_scm);
qt_scm = scm_cons (scm_long2num (pd->how), qt_scm);
if (!safe_strcmp (pd->type_name, QOF_TYPE_STRING))
if (!g_strcmp0 (pd->type_name, QOF_TYPE_STRING))
{
query_string_t pdata = (query_string_t) pd;
@@ -838,7 +838,7 @@ gnc_queryterm2scm (const QofQueryTerm *qt)
qt_scm = scm_cons (scm_makfrom0str (pdata->matchstring), qt_scm);
}
else if (!safe_strcmp (pd->type_name, QOF_TYPE_DATE))
else if (!g_strcmp0 (pd->type_name, QOF_TYPE_DATE))
{
query_date_t pdata = (query_date_t) pd;
@@ -846,7 +846,7 @@ gnc_queryterm2scm (const QofQueryTerm *qt)
qt_scm = scm_cons (gnc_timespec2timepair (pdata->date), qt_scm);
}
else if (!safe_strcmp (pd->type_name, QOF_TYPE_NUMERIC))
else if (!g_strcmp0 (pd->type_name, QOF_TYPE_NUMERIC))
{
query_numeric_t pdata = (query_numeric_t) pd;
@@ -854,7 +854,7 @@ gnc_queryterm2scm (const QofQueryTerm *qt)
qt_scm = scm_cons (gnc_query_numeric2scm (pdata->amount), qt_scm);
}
else if (!safe_strcmp (pd->type_name, QOF_TYPE_GUID))
else if (!g_strcmp0 (pd->type_name, QOF_TYPE_GUID))
{
query_guid_t pdata = (query_guid_t) pd;
@@ -862,28 +862,28 @@ gnc_queryterm2scm (const QofQueryTerm *qt)
qt_scm = scm_cons (gnc_guid_glist2scm (pdata->guids), qt_scm);
}
else if (!safe_strcmp (pd->type_name, QOF_TYPE_INT64))
else if (!g_strcmp0 (pd->type_name, QOF_TYPE_INT64))
{
query_int64_t pdata = (query_int64_t) pd;
qt_scm = scm_cons (gnc_gint64_to_scm (pdata->val), qt_scm);
}
else if (!safe_strcmp (pd->type_name, QOF_TYPE_DOUBLE))
else if (!g_strcmp0 (pd->type_name, QOF_TYPE_DOUBLE))
{
query_double_t pdata = (query_double_t) pd;
qt_scm = scm_cons (scm_make_real (pdata->val), qt_scm);
}
else if (!safe_strcmp (pd->type_name, QOF_TYPE_BOOLEAN))
else if (!g_strcmp0 (pd->type_name, QOF_TYPE_BOOLEAN))
{
query_boolean_t pdata = (query_boolean_t) pd;
qt_scm = scm_cons (SCM_BOOL (pdata->val), qt_scm);
}
else if (!safe_strcmp (pd->type_name, QOF_TYPE_CHAR))
else if (!g_strcmp0 (pd->type_name, QOF_TYPE_CHAR))
{
query_char_t pdata = (query_char_t) pd;
@@ -891,7 +891,7 @@ gnc_queryterm2scm (const QofQueryTerm *qt)
qt_scm = scm_cons (scm_makfrom0str (pdata->char_list), qt_scm);
}
else if (!safe_strcmp (pd->type_name, QOF_TYPE_KVP))
else if (!g_strcmp0 (pd->type_name, QOF_TYPE_KVP))
{
query_kvp_t pdata = (query_kvp_t) pd;
@@ -954,7 +954,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
/* Now compute the predicate */
if (!safe_strcmp (type, QOF_TYPE_STRING))
if (!g_strcmp0 (type, QOF_TYPE_STRING))
{
QofStringMatch options;
gboolean is_regex;
@@ -982,7 +982,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
scm_dynwind_free (matchstring);
scm_dynwind_end ();
}
else if (!safe_strcmp (type, QOF_TYPE_DATE))
else if (!g_strcmp0 (type, QOF_TYPE_DATE))
{
QofDateMatch options;
Timespec date;
@@ -1002,7 +1002,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
pd = qof_query_date_predicate (compare_how, options, date);
}
else if (!safe_strcmp (type, QOF_TYPE_NUMERIC))
else if (!g_strcmp0 (type, QOF_TYPE_NUMERIC))
{
QofNumericMatch options;
gnc_numeric val;
@@ -1022,7 +1022,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
pd = qof_query_numeric_predicate (compare_how, options, val);
}
else if (!safe_strcmp (type, QOF_TYPE_GUID))
else if (!g_strcmp0 (type, QOF_TYPE_GUID))
{
QofGuidMatch options;
GList *guids;
@@ -1044,7 +1044,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
gnc_guid_glist_free (guids);
}
else if (!safe_strcmp (type, QOF_TYPE_INT64))
else if (!g_strcmp0 (type, QOF_TYPE_INT64))
{
gint64 val;
@@ -1057,7 +1057,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
pd = qof_query_int64_predicate (compare_how, val);
}
else if (!safe_strcmp (type, QOF_TYPE_DOUBLE))
else if (!g_strcmp0 (type, QOF_TYPE_DOUBLE))
{
double val;
@@ -1070,7 +1070,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
pd = qof_query_double_predicate (compare_how, val);
}
else if (!safe_strcmp (type, QOF_TYPE_BOOLEAN))
else if (!g_strcmp0 (type, QOF_TYPE_BOOLEAN))
{
gboolean val;
@@ -1083,7 +1083,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
pd = qof_query_boolean_predicate (compare_how, val);
}
else if (!safe_strcmp (type, QOF_TYPE_CHAR))
else if (!g_strcmp0 (type, QOF_TYPE_CHAR))
{
QofCharMatch options;
gchar *char_list;
@@ -1105,7 +1105,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
scm_dynwind_free (char_list);
scm_dynwind_end ();
}
else if (!safe_strcmp (type, QOF_TYPE_KVP))
else if (!g_strcmp0 (type, QOF_TYPE_KVP))
{
GSList *kvp_path;
KvpValue *value;
@@ -1204,7 +1204,7 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm)
q = qof_query_create_for(GNC_ID_SPLIT);
if (!safe_strcmp (pd_type, "pd-date"))
if (!g_strcmp0 (pd_type, "pd-date"))
{
gboolean use_start;
gboolean use_end;
@@ -1251,7 +1251,7 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm)
ok = TRUE;
}
else if (!safe_strcmp (pd_type, "pd-amount"))
else if (!g_strcmp0 (pd_type, "pd-amount"))
{
QofQueryCompare how;
QofNumericMatch amt_sgn;
@@ -1282,19 +1282,19 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm)
val = double_to_gnc_numeric (amount, GNC_DENOM_AUTO,
GNC_HOW_DENOM_SIGFIGS(6) | GNC_HOW_RND_ROUND_HALF_UP);
if (!safe_strcmp (pr_type, "pr-price"))
if (!g_strcmp0 (pr_type, "pr-price"))
{
xaccQueryAddSharePriceMatch (q, val, how, QOF_QUERY_OR);
ok = TRUE;
}
else if (!safe_strcmp (pr_type, "pr-shares"))
else if (!g_strcmp0 (pr_type, "pr-shares"))
{
xaccQueryAddSharesMatch (q, val, how, QOF_QUERY_OR);
ok = TRUE;
}
else if (!safe_strcmp (pr_type, "pr-value"))
else if (!g_strcmp0 (pr_type, "pr-value"))
{
xaccQueryAddValueMatch (q, val, amt_sgn, how, QOF_QUERY_OR);
ok = TRUE;
@@ -1306,7 +1306,7 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm)
}
}
else if (!safe_strcmp (pd_type, "pd-account"))
else if (!g_strcmp0 (pd_type, "pd-account"))
{
QofGuidMatch how;
GList *account_guids;
@@ -1341,7 +1341,7 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm)
ok = TRUE;
}
else if (!safe_strcmp (pd_type, "pd-string"))
else if (!g_strcmp0 (pd_type, "pd-string"))
{
gboolean case_sens;
gboolean use_regexp;
@@ -1372,28 +1372,28 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm)
scm_dynwind_begin (0);
matchstring = scm_to_locale_string (scm);
if (!safe_strcmp (pr_type, "pr-action"))
if (!g_strcmp0 (pr_type, "pr-action"))
{
xaccQueryAddActionMatch (q, matchstring, case_sens, use_regexp,
QOF_QUERY_OR);
ok = TRUE;
}
else if (!safe_strcmp (pr_type, "pr-desc"))
else if (!g_strcmp0 (pr_type, "pr-desc"))
{
xaccQueryAddDescriptionMatch (q, matchstring, case_sens,
use_regexp, QOF_QUERY_OR);
ok = TRUE;
}
else if (!safe_strcmp (pr_type, "pr-memo"))
else if (!g_strcmp0 (pr_type, "pr-memo"))
{
xaccQueryAddMemoMatch (q, matchstring, case_sens, use_regexp,
QOF_QUERY_OR);
ok = TRUE;
}
else if (!safe_strcmp (pr_type, "pr-num"))
else if (!g_strcmp0 (pr_type, "pr-num"))
{
xaccQueryAddNumberMatch (q, matchstring, case_sens, use_regexp,
QOF_QUERY_OR);
@@ -1408,7 +1408,7 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm)
scm_dynwind_end ();
}
else if (!safe_strcmp (pd_type, "pd-cleared"))
else if (!g_strcmp0 (pd_type, "pd-cleared"))
{
cleared_match_t how;
@@ -1424,7 +1424,7 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm)
ok = TRUE;
}
else if (!safe_strcmp (pd_type, "pd-balance"))
else if (!g_strcmp0 (pd_type, "pd-balance"))
{
gboolean how;
@@ -1441,7 +1441,7 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm)
ok = TRUE;
}
else if (!safe_strcmp (pd_type, "pd-guid"))
else if (!g_strcmp0 (pd_type, "pd-guid"))
{
GncGUID guid;
QofIdType id_type;
@@ -1469,7 +1469,7 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm)
ok = TRUE;
}
else if (!safe_strcmp (pd_type, "pd-kvp"))
else if (!g_strcmp0 (pd_type, "pd-kvp"))
{
GSList *path;
KvpValue *value;
@@ -1794,79 +1794,79 @@ gnc_query_sort_to_list (const gchar * symbol)
if (!symbol)
return NULL;
if (!safe_strcmp (symbol, "by-none"))
if (!g_strcmp0 (symbol, "by-none"))
{
path = NULL;
}
else if (!safe_strcmp (symbol, "by-standard"))
else if (!g_strcmp0 (symbol, "by-standard"))
{
path = g_slist_prepend (path, QUERY_DEFAULT_SORT);
}
else if (!safe_strcmp (symbol, "by-date") ||
!safe_strcmp (symbol, "by-date-rounded"))
else if (!g_strcmp0 (symbol, "by-date") ||
!g_strcmp0 (symbol, "by-date-rounded"))
{
path = g_slist_prepend (path, TRANS_DATE_POSTED);
path = g_slist_prepend (path, SPLIT_TRANS);
}
else if (!safe_strcmp (symbol, "by-date-entered") ||
!safe_strcmp (symbol, "by-date-entered-rounded"))
else if (!g_strcmp0 (symbol, "by-date-entered") ||
!g_strcmp0 (symbol, "by-date-entered-rounded"))
{
path = g_slist_prepend (path, TRANS_DATE_ENTERED);
path = g_slist_prepend (path, SPLIT_TRANS);
}
else if (!safe_strcmp (symbol, "by-date-reconciled") ||
!safe_strcmp (symbol, "by-date-reconciled-rounded"))
else if (!g_strcmp0 (symbol, "by-date-reconciled") ||
!g_strcmp0 (symbol, "by-date-reconciled-rounded"))
{
path = g_slist_prepend (path, SPLIT_DATE_RECONCILED);
}
else if (!safe_strcmp (symbol, "by-num"))
else if (!g_strcmp0 (symbol, "by-num"))
{
path = g_slist_prepend (path, TRANS_NUM);
path = g_slist_prepend (path, SPLIT_TRANS);
}
else if (!safe_strcmp (symbol, "by-amount"))
else if (!g_strcmp0 (symbol, "by-amount"))
{
path = g_slist_prepend (path, SPLIT_VALUE);
}
else if (!safe_strcmp (symbol, "by-memo"))
else if (!g_strcmp0 (symbol, "by-memo"))
{
path = g_slist_prepend (path, SPLIT_MEMO);
}
else if (!safe_strcmp (symbol, "by-desc"))
else if (!g_strcmp0 (symbol, "by-desc"))
{
path = g_slist_prepend (path, TRANS_DESCRIPTION);
path = g_slist_prepend (path, SPLIT_TRANS);
}
else if (!safe_strcmp (symbol, "by-reconcile"))
else if (!g_strcmp0 (symbol, "by-reconcile"))
{
path = g_slist_prepend (path, SPLIT_RECONCILE);
}
else if (!safe_strcmp (symbol, "by-account-full-name"))
else if (!g_strcmp0 (symbol, "by-account-full-name"))
{
path = g_slist_prepend (path, SPLIT_ACCT_FULLNAME);
}
else if (!safe_strcmp (symbol, "by-account-code"))
else if (!g_strcmp0 (symbol, "by-account-code"))
{
path = g_slist_prepend (path, ACCOUNT_CODE_);
path = g_slist_prepend (path, SPLIT_ACCOUNT);
}
else if (!safe_strcmp (symbol, "by-corr-account-full-name"))
else if (!g_strcmp0 (symbol, "by-corr-account-full-name"))
{
path = g_slist_prepend (path, SPLIT_CORR_ACCT_NAME);
}
else if (!safe_strcmp (symbol, "by-corr-account-code"))
else if (!g_strcmp0 (symbol, "by-corr-account-code"))
{
path = g_slist_prepend (path, SPLIT_CORR_ACCT_CODE);
@@ -1927,7 +1927,7 @@ gnc_scm2query_v1 (SCM query_scm)
break;
}
if (safe_strcmp ("terms", symbol) == 0)
if (g_strcmp0 ("terms", symbol) == 0)
{
if (q)
qof_query_destroy (q);
@@ -1941,7 +1941,7 @@ gnc_scm2query_v1 (SCM query_scm)
}
}
else if (safe_strcmp ("primary-sort", symbol) == 0)
else if (g_strcmp0 ("primary-sort", symbol) == 0)
{
if (!scm_is_symbol (value))
{
@@ -1953,7 +1953,7 @@ gnc_scm2query_v1 (SCM query_scm)
primary_sort = SCM_SYMBOL_CHARS (value);
}
else if (safe_strcmp ("secondary-sort", symbol) == 0)
else if (g_strcmp0 ("secondary-sort", symbol) == 0)
{
if (!scm_is_symbol (value))
{
@@ -1965,7 +1965,7 @@ gnc_scm2query_v1 (SCM query_scm)
secondary_sort = SCM_SYMBOL_CHARS (value);
}
else if (safe_strcmp ("tertiary-sort", symbol) == 0)
else if (g_strcmp0 ("tertiary-sort", symbol) == 0)
{
if (!scm_is_symbol (value))
{
@@ -1977,22 +1977,22 @@ gnc_scm2query_v1 (SCM query_scm)
tertiary_sort = SCM_SYMBOL_CHARS (value);
}
else if (safe_strcmp ("primary-increasing", symbol) == 0)
else if (g_strcmp0 ("primary-increasing", symbol) == 0)
{
primary_increasing = scm_is_true (value);
}
else if (safe_strcmp ("secondary-increasing", symbol) == 0)
else if (g_strcmp0 ("secondary-increasing", symbol) == 0)
{
secondary_increasing = scm_is_true (value);
}
else if (safe_strcmp ("tertiary-increasing", symbol) == 0)
else if (g_strcmp0 ("tertiary-increasing", symbol) == 0)
{
tertiary_increasing = scm_is_true (value);
}
else if (safe_strcmp ("max-splits", symbol) == 0)
else if (g_strcmp0 ("max-splits", symbol) == 0)
{
if (!scm_is_number (value))
{
@@ -2074,7 +2074,7 @@ gnc_scm2query_v2 (SCM query_scm)
break;
}
if (!safe_strcmp ("terms", symbol))
if (!g_strcmp0 ("terms", symbol))
{
if (q)
qof_query_destroy (q);
@@ -2087,7 +2087,7 @@ gnc_scm2query_v2 (SCM query_scm)
}
}
else if (!safe_strcmp ("search-for", symbol))
else if (!g_strcmp0 ("search-for", symbol))
{
if (!scm_is_symbol (value))
{
@@ -2097,7 +2097,7 @@ gnc_scm2query_v2 (SCM query_scm)
search_for = SCM_SYMBOL_CHARS (value);
}
else if (safe_strcmp ("primary-sort", symbol) == 0)
else if (g_strcmp0 ("primary-sort", symbol) == 0)
{
if (! gnc_query_scm2sort (value, &sp1, &so1, &si1))
{
@@ -2106,7 +2106,7 @@ gnc_scm2query_v2 (SCM query_scm)
}
}
else if (!safe_strcmp ("secondary-sort", symbol))
else if (!g_strcmp0 ("secondary-sort", symbol))
{
if (! gnc_query_scm2sort (value, &sp2, &so2, &si2))
{
@@ -2115,7 +2115,7 @@ gnc_scm2query_v2 (SCM query_scm)
}
}
else if (!safe_strcmp ("tertiary-sort", symbol))
else if (!g_strcmp0 ("tertiary-sort", symbol))
{
if (! gnc_query_scm2sort (value, &sp3, &so3, &si3))
{
@@ -2124,7 +2124,7 @@ gnc_scm2query_v2 (SCM query_scm)
}
}
else if (!safe_strcmp ("max-results", symbol))
else if (!g_strcmp0 ("max-results", symbol))
{
if (!scm_is_number (value))
{
@@ -2189,7 +2189,7 @@ gnc_scm2query (SCM query_scm)
if (!type)
return NULL;
if (!safe_strcmp (type, "query-v2"))
if (!g_strcmp0 (type, "query-v2"))
q = gnc_scm2query_v2 (SCM_CDR (query_scm));
return q;

View File

@@ -380,38 +380,38 @@ gnc_quote_source_lookup_by_internal(const char * name)
GList *node;
gint i;
if ((name == NULL) || (safe_strcmp(name, "") == 0))
if ((name == NULL) || (g_strcmp0(name, "") == 0))
{
return NULL;
}
if (safe_strcmp(name, currency_quote_source.internal_name) == 0)
if (g_strcmp0(name, currency_quote_source.internal_name) == 0)
return &currency_quote_source;
if (safe_strcmp(name, currency_quote_source.old_internal_name) == 0)
if (g_strcmp0(name, currency_quote_source.old_internal_name) == 0)
return &currency_quote_source;
for (i = 0; i < num_single_quote_sources; i++)
{
if (safe_strcmp(name, single_quote_sources[i].internal_name) == 0)
if (g_strcmp0(name, single_quote_sources[i].internal_name) == 0)
return &single_quote_sources[i];
if (safe_strcmp(name, single_quote_sources[i].old_internal_name) == 0)
if (g_strcmp0(name, single_quote_sources[i].old_internal_name) == 0)
return &single_quote_sources[i];
}
for (i = 0; i < num_multiple_quote_sources; i++)
{
if (safe_strcmp(name, multiple_quote_sources[i].internal_name) == 0)
if (g_strcmp0(name, multiple_quote_sources[i].internal_name) == 0)
return &multiple_quote_sources[i];
if (safe_strcmp(name, multiple_quote_sources[i].old_internal_name) == 0)
if (g_strcmp0(name, multiple_quote_sources[i].old_internal_name) == 0)
return &multiple_quote_sources[i];
}
for (i = 0, node = new_quote_sources; node; node = node->next, i++)
{
source = node->data;
if (safe_strcmp(name, source->internal_name) == 0)
if (g_strcmp0(name, source->internal_name) == 0)
return source;
if (safe_strcmp(name, source->old_internal_name) == 0)
if (g_strcmp0(name, source->old_internal_name) == 0)
return source;
}
@@ -1449,7 +1449,7 @@ gnc_commodity_equiv(const gnc_commodity * a, const gnc_commodity * b)
priv_a = GET_PRIVATE(a);
priv_b = GET_PRIVATE(b);
if (priv_a->namespace != priv_b->namespace) return FALSE;
if (safe_strcmp(priv_a->mnemonic, priv_b->mnemonic) != 0) return FALSE;
if (g_strcmp0(priv_a->mnemonic, priv_b->mnemonic) != 0) return FALSE;
return TRUE;
}
@@ -1473,7 +1473,7 @@ gnc_commodity_equal(const gnc_commodity * a, const gnc_commodity * b)
same_book = qof_instance_get_book(QOF_INSTANCE(a)) == qof_instance_get_book(QOF_INSTANCE(b));
if ((same_book && priv_a->namespace != priv_b->namespace)
|| (!same_book && safe_strcmp( gnc_commodity_namespace_get_name(priv_a->namespace),
|| (!same_book && g_strcmp0( gnc_commodity_namespace_get_name(priv_a->namespace),
gnc_commodity_namespace_get_name(priv_b->namespace)) != 0))
{
DEBUG ("namespaces differ: %p(%s) vs %p(%s)",
@@ -1482,19 +1482,19 @@ gnc_commodity_equal(const gnc_commodity * a, const gnc_commodity * b)
return FALSE;
}
if (safe_strcmp(priv_a->mnemonic, priv_b->mnemonic) != 0)
if (g_strcmp0(priv_a->mnemonic, priv_b->mnemonic) != 0)
{
DEBUG ("mnemonics differ: %s vs %s", priv_a->mnemonic, priv_b->mnemonic);
return FALSE;
}
if (safe_strcmp(priv_a->fullname, priv_b->fullname) != 0)
if (g_strcmp0(priv_a->fullname, priv_b->fullname) != 0)
{
DEBUG ("fullnames differ: %s vs %s", priv_a->fullname, priv_b->fullname);
return FALSE;
}
if (safe_strcmp(priv_a->cusip, priv_b->cusip) != 0)
if (g_strcmp0(priv_a->cusip, priv_b->cusip) != 0)
{
DEBUG ("cusips differ: %s vs %s", priv_a->cusip, priv_b->cusip);
return FALSE;
@@ -1549,14 +1549,14 @@ gnc_commodity_namespace_get_commodity_list(const gnc_commodity_namespace *namesp
gboolean
gnc_commodity_namespace_is_iso(const char *namespace)
{
return ((safe_strcmp(namespace, GNC_COMMODITY_NS_ISO) == 0) ||
(safe_strcmp(namespace, GNC_COMMODITY_NS_CURRENCY) == 0));
return ((g_strcmp0(namespace, GNC_COMMODITY_NS_ISO) == 0) ||
(g_strcmp0(namespace, GNC_COMMODITY_NS_CURRENCY) == 0));
}
static const gchar *
gnc_commodity_table_map_namespace(const char * namespace)
{
if (safe_strcmp(namespace, GNC_COMMODITY_NS_ISO) == 0)
if (g_strcmp0(namespace, GNC_COMMODITY_NS_ISO) == 0)
return GNC_COMMODITY_NS_CURRENCY;
return namespace;
}
@@ -1618,7 +1618,7 @@ count_coms(gpointer key, gpointer value, gpointer user_data)
GHashTable *tbl = ((gnc_commodity_namespace*)value)->cm_table;
guint *count = (guint*)user_data;
if (safe_strcmp((char*)key, GNC_COMMODITY_NS_CURRENCY) == 0)
if (g_strcmp0((char*)key, GNC_COMMODITY_NS_CURRENCY) == 0)
{
/* don't count default commodities */
return;
@@ -1958,8 +1958,8 @@ gnc_commodity_is_currency(const gnc_commodity *cm)
if (!cm) return FALSE;
ns_name = gnc_commodity_namespace_get_name(GET_PRIVATE(cm)->namespace);
return (!safe_strcmp(ns_name, GNC_COMMODITY_NS_LEGACY) ||
!safe_strcmp(ns_name, GNC_COMMODITY_NS_CURRENCY));
return (!g_strcmp0(ns_name, GNC_COMMODITY_NS_LEGACY) ||
!g_strcmp0(ns_name, GNC_COMMODITY_NS_CURRENCY));
}
/********************************************************************

View File

@@ -433,7 +433,7 @@ void
gnc_price_set_source(GNCPrice *p, const char *s)
{
if (!p) return;
if (safe_strcmp(p->source, s) != 0)
if (g_strcmp0(p->source, s) != 0)
{
char *tmp;
@@ -450,7 +450,7 @@ void
gnc_price_set_typestr(GNCPrice *p, const char* type)
{
if (!p) return;
if (safe_strcmp(p->type, type) != 0)
if (g_strcmp0(p->type, type) != 0)
{
gchar *tmp;
@@ -564,11 +564,11 @@ gnc_price_equal (const GNCPrice *p1, const GNCPrice *p2)
if (!timespec_equal (&ts1, &ts2))
return FALSE;
if (safe_strcmp (gnc_price_get_source (p1),
if (g_strcmp0 (gnc_price_get_source (p1),
gnc_price_get_source (p2)) != 0)
return FALSE;
if (safe_strcmp (gnc_price_get_typestr (p1),
if (g_strcmp0 (gnc_price_get_typestr (p1),
gnc_price_get_typestr (p2)) != 0)
return FALSE;
@@ -1190,7 +1190,7 @@ check_one_price_date (GNCPrice *price, gpointer user_data)
if (!data->delete_user)
{
source = gnc_price_get_source (price);
if (safe_strcmp(source, "Finance::Quote") != 0)
if (g_strcmp0(source, "Finance::Quote") != 0)
{
LEAVE("Not an automatic quote");
return TRUE;
@@ -2314,12 +2314,12 @@ compare_kvpairs_by_commodity_key(gconstpointer a, gconstpointer b)
ca = (gnc_commodity *) kvpa->key;
cb = (gnc_commodity *) kvpb->key;
cmp_result = safe_strcmp(gnc_commodity_get_namespace(ca),
cmp_result = g_strcmp0(gnc_commodity_get_namespace(ca),
gnc_commodity_get_namespace(cb));
if (cmp_result != 0) return cmp_result;
return safe_strcmp(gnc_commodity_get_mnemonic(ca),
return g_strcmp0(gnc_commodity_get_mnemonic(ca),
gnc_commodity_get_mnemonic(cb));
}

View File

@@ -392,7 +392,7 @@ gncAddressFree (GncAddress *addr)
char * tmp; \
\
if (member == str) return; \
if (!safe_strcmp (member, str)) return; \
if (!g_strcmp0 (member, str)) return; \
gncAddressBeginEdit (obj); \
tmp = CACHE_INSERT (str); \
CACHE_REMOVE (member); \
@@ -566,7 +566,7 @@ int gncAddressCompare (const GncAddress *a, const GncAddress *b)
if (!a && b) return 1;
if (a && !b) return -1;
return safe_strcmp (a->name, b->name);
return g_strcmp0 (a->name, b->name);
}
gboolean
@@ -578,42 +578,42 @@ gncAddressEqual(const GncAddress* a, const GncAddress* b)
g_return_val_if_fail(GNC_IS_ADDRESS(a), FALSE);
g_return_val_if_fail(GNC_IS_ADDRESS(b), FALSE);
if (safe_strcmp(a->name, b->name) != 0)
if (g_strcmp0(a->name, b->name) != 0)
{
PWARN("names differ: %s vs %s", a->name, b->name);
return FALSE;
}
if (safe_strcmp(a->addr1, b->addr1) != 0)
if (g_strcmp0(a->addr1, b->addr1) != 0)
{
PWARN("address lines 1 differ: %s vs %s", a->addr1, b->addr1);
return FALSE;
}
if (safe_strcmp(a->addr2, b->addr2) != 0)
if (g_strcmp0(a->addr2, b->addr2) != 0)
{
PWARN("address lines 2 differ: %s vs %s", a->addr2, b->addr1);
return FALSE;
}
if (safe_strcmp(a->addr3, b->addr3) != 0)
if (g_strcmp0(a->addr3, b->addr3) != 0)
{
PWARN("address lines 3 differ: %s vs %s", a->addr3, b->addr3);
return FALSE;
}
if (safe_strcmp(a->addr4, b->addr4) != 0)
if (g_strcmp0(a->addr4, b->addr4) != 0)
{
PWARN("address lines 4 differ: %s vs %s", a->addr4, b->addr4);
return FALSE;
}
if (safe_strcmp(a->phone, b->phone) != 0)
if (g_strcmp0(a->phone, b->phone) != 0)
{
PWARN("phone numbers differ: %s vs %s", a->phone, b->phone);
return FALSE;
}
if (safe_strcmp(a->fax, b->fax) != 0)
if (g_strcmp0(a->fax, b->fax) != 0)
{
PWARN("fax numbers differ: %s vs %s", a->fax, b->fax);
return FALSE;
}
if (safe_strcmp(a->email, b->email) != 0)
if (g_strcmp0(a->email, b->email) != 0)
{
PWARN("email addresses differ: %s vs %s", a->email, b->email);
return FALSE;

View File

@@ -73,7 +73,7 @@ static QofLogModule log_module = GNC_MOD_BUSINESS;
#define SET_STR(obj, member, str) { \
char * tmp; \
\
if (!safe_strcmp (member, str)) return; \
if (!g_strcmp0 (member, str)) return; \
gncBillTermBeginEdit (obj); \
tmp = CACHE_INSERT (str); \
CACHE_REMOVE (member); \
@@ -490,7 +490,7 @@ GncBillTerm *gncBillTermLookupByName (QofBook *book, const char *name)
for ( ; list; list = list->next)
{
GncBillTerm *term = list->data;
if (!safe_strcmp (term->name, name))
if (!g_strcmp0 (term->name, name))
return list->data;
}
return NULL;
@@ -625,10 +625,10 @@ int gncBillTermCompare (const GncBillTerm *a, const GncBillTerm *b)
if (!a) return -1;
if (!b) return 1;
ret = safe_strcmp (a->name, b->name);
ret = g_strcmp0 (a->name, b->name);
if (ret) return ret;
return safe_strcmp (a->desc, b->desc);
return g_strcmp0 (a->desc, b->desc);
}
gboolean gncBillTermEqual(const GncBillTerm *a, const GncBillTerm *b)
@@ -639,13 +639,13 @@ gboolean gncBillTermEqual(const GncBillTerm *a, const GncBillTerm *b)
g_return_val_if_fail(GNC_IS_BILLTERM(a), FALSE);
g_return_val_if_fail(GNC_IS_BILLTERM(b), FALSE);
if (safe_strcmp(a->name, b->name) != 0)
if (g_strcmp0(a->name, b->name) != 0)
{
PWARN("Names differ: %s vs %s", a->name, b->name);
return FALSE;
}
if (safe_strcmp(a->desc, b->desc) != 0)
if (g_strcmp0(a->desc, b->desc) != 0)
{
PWARN("Descriptions differ: %s vs %s", a->desc, b->desc);
return FALSE;

View File

@@ -316,7 +316,7 @@ static void gncCustomerFree (GncCustomer *cust)
#define SET_STR(obj, member, str) { \
char * tmp; \
\
if (!safe_strcmp (member, str)) return; \
if (!g_strcmp0 (member, str)) return; \
gncCustomerBeginEdit (obj); \
tmp = CACHE_INSERT (str); \
CACHE_REMOVE (member); \
@@ -682,19 +682,19 @@ gncCustomerEqual(const GncCustomer *a, const GncCustomer *b)
g_return_val_if_fail(GNC_IS_CUSTOMER(a), FALSE);
g_return_val_if_fail(GNC_IS_CUSTOMER(b), FALSE);
if (safe_strcmp(a->id, b->id) != 0)
if (g_strcmp0(a->id, b->id) != 0)
{
PWARN("IDs differ: %s vs %s", a->id, b->id);
return FALSE;
}
if (safe_strcmp(a->name, b->name) != 0)
if (g_strcmp0(a->name, b->name) != 0)
{
PWARN("Names differ: %s vs %s", a->name, b->name);
return FALSE;
}
if (safe_strcmp(a->notes, b->notes) != 0)
if (g_strcmp0(a->notes, b->notes) != 0)
{
PWARN("Notes differ: %s vs %s", a->notes, b->notes);
return FALSE;

View File

@@ -422,7 +422,7 @@ static void gncEmployeeFree (GncEmployee *employee)
#define SET_STR(obj, member, str) { \
char * tmp; \
\
if (!safe_strcmp (member, str)) return; \
if (!g_strcmp0 (member, str)) return; \
gncEmployeeBeginEdit (obj); \
tmp = CACHE_INSERT (str); \
CACHE_REMOVE (member); \
@@ -684,13 +684,13 @@ gboolean gncEmployeeEqual(const GncEmployee* a, const GncEmployee* b)
g_return_val_if_fail(GNC_IS_EMPLOYEE(a), FALSE);
g_return_val_if_fail(GNC_IS_EMPLOYEE(b), FALSE);
if (safe_strcmp(a->id, b->id) != 0)
if (g_strcmp0(a->id, b->id) != 0)
{
PWARN("IDs differ: %s vs %s", a->id, b->id);
return FALSE;
}
if (safe_strcmp(a->username, b->username) != 0)
if (g_strcmp0(a->username, b->username) != 0)
{
PWARN("Usernames differ: %s vs %s", a->username, b->username);
return FALSE;
@@ -714,13 +714,13 @@ gboolean gncEmployeeEqual(const GncEmployee* a, const GncEmployee* b)
return FALSE;
}
if (safe_strcmp(a->language, b->language) != 0)
if (g_strcmp0(a->language, b->language) != 0)
{
PWARN("Languages differ: %s vs %s", a->language, b->language);
return FALSE;
}
if (safe_strcmp(a->acl, b->acl) != 0)
if (g_strcmp0(a->acl, b->acl) != 0)
{
PWARN("ACLs differ: %s vs %s", a->acl, b->acl);
return FALSE;

View File

@@ -191,7 +191,7 @@ gboolean gncEntryPaymentStringToType (const char *str, GncEntryPaymentType *type
#define SET_STR(obj, member, str) { \
char * tmp; \
\
if (!safe_strcmp (member, str)) return; \
if (!g_strcmp0 (member, str)) return; \
gncEntryBeginEdit (obj); \
tmp = CACHE_INSERT (str); \
CACHE_REMOVE (member); \
@@ -1522,17 +1522,17 @@ int gncEntryCompare (const GncEntry *a, const GncEntry *b)
compare = timespec_cmp (&(a->date_entered), &(b->date_entered));
if (compare) return compare;
compare = safe_strcmp (a->desc, b->desc);
compare = g_strcmp0 (a->desc, b->desc);
if (compare) return compare;
compare = safe_strcmp (a->action, b->action);
compare = g_strcmp0 (a->action, b->action);
if (compare) return compare;
return qof_instance_guid_compare(a, b);
}
#define CHECK_STRING(X, Y, FIELD) \
if (safe_strcmp((X)->FIELD, (Y)->FIELD) != 0) \
if (g_strcmp0((X)->FIELD, (Y)->FIELD) != 0) \
{ \
PWARN("%s differ: %s vs %s", #FIELD, (X)->FIELD, (Y)->FIELD); \
return FALSE; \

View File

@@ -87,7 +87,7 @@ static QofLogModule log_module = GNC_MOD_BUSINESS;
#define SET_STR(obj, member, str) { \
char * tmp; \
\
if (!safe_strcmp (member, str)) return; \
if (!g_strcmp0 (member, str)) return; \
gncInvoiceBeginEdit (obj); \
tmp = CACHE_INSERT (str); \
CACHE_REMOVE (member); \
@@ -1039,7 +1039,7 @@ qofInvoiceSetEntries(GncInvoice *invoice, QofCollection *entry_coll)
{
return;
}
if (0 == safe_strcmp(qof_collection_get_type(entry_coll), GNC_ID_ENTRY))
if (0 == g_strcmp0(qof_collection_get_type(entry_coll), GNC_ID_ENTRY))
{
qof_collection_foreach(entry_coll, qofInvoiceEntryCB, invoice);
}
@@ -1788,7 +1788,7 @@ int gncInvoiceCompare (const GncInvoice *a, const GncInvoice *b)
if (!a) return -1;
if (!b) return 1;
compare = safe_strcmp (a->id, b->id);
compare = g_strcmp0 (a->id, b->id);
if (compare) return compare;
compare = timespec_cmp (&(a->date_opened), &(b->date_opened));
@@ -1808,25 +1808,25 @@ gboolean gncInvoiceEqual(const GncInvoice *a, const GncInvoice *b)
g_return_val_if_fail(GNC_IS_INVOICE(a), FALSE);
g_return_val_if_fail(GNC_IS_INVOICE(b), FALSE);
if (safe_strcmp(a->id, b->id) != 0)
if (g_strcmp0(a->id, b->id) != 0)
{
PWARN("IDs differ: %s vs %s", a->id, b->id);
return FALSE;
}
if (safe_strcmp(a->notes, b->notes) != 0)
if (g_strcmp0(a->notes, b->notes) != 0)
{
PWARN("Notes differ: %s vs %s", a->notes, b->notes);
return FALSE;
}
if (safe_strcmp(a->billing_id, b->billing_id) != 0)
if (g_strcmp0(a->billing_id, b->billing_id) != 0)
{
PWARN("Billing IDs differ: %s vs %s", a->billing_id, b->billing_id);
return FALSE;
}
if (safe_strcmp(a->printname, b->printname) != 0)
if (g_strcmp0(a->printname, b->printname) != 0)
{
PWARN("Printnames differ: %s vs %s", a->printname, b->printname);
return FALSE;

View File

@@ -239,7 +239,7 @@ static void gncJobFree (GncJob *job)
#define SET_STR(obj, member, str) { \
char * tmp; \
\
if (!safe_strcmp (member, str)) return; \
if (!g_strcmp0 (member, str)) return; \
gncJobBeginEdit (obj); \
tmp = CACHE_INSERT (str); \
CACHE_REMOVE (member); \
@@ -421,7 +421,7 @@ int gncJobCompare (const GncJob * a, const GncJob *b)
if (!a && b) return 1;
if (a && !b) return -1;
return (safe_strcmp(a->id, b->id));
return (g_strcmp0(a->id, b->id));
}
gboolean gncJobEqual(const GncJob * a, const GncJob *b)
@@ -432,19 +432,19 @@ gboolean gncJobEqual(const GncJob * a, const GncJob *b)
g_return_val_if_fail(GNC_IS_JOB(a), FALSE);
g_return_val_if_fail(GNC_IS_JOB(b), FALSE);
if (safe_strcmp(a->id, b->id) != 0)
if (g_strcmp0(a->id, b->id) != 0)
{
PWARN("IDs differ: %s vs %s", a->id, b->id);
return FALSE;
}
if (safe_strcmp(a->name, b->name) != 0)
if (g_strcmp0(a->name, b->name) != 0)
{
PWARN("Names differ: %s vs %s", a->name, b->name);
return FALSE;
}
if (safe_strcmp(a->desc, b->desc) != 0)
if (g_strcmp0(a->desc, b->desc) != 0)
{
PWARN("Descriptions differ: %s vs %s", a->desc, b->desc);
return FALSE;

View File

@@ -65,7 +65,7 @@ static QofLogModule log_module = GNC_MOD_BUSINESS;
#define SET_STR(obj, member, str) { \
char * tmp; \
\
if (!safe_strcmp (member, str)) return; \
if (!g_strcmp0 (member, str)) return; \
gncOrderBeginEdit (obj); \
tmp = CACHE_INSERT (str); \
CACHE_REMOVE (member); \
@@ -516,7 +516,7 @@ int gncOrderCompare (const GncOrder *a, const GncOrder *b)
if (!a) return -1;
if (!b) return 1;
compare = safe_strcmp (a->id, b->id);
compare = g_strcmp0 (a->id, b->id);
if (compare) return compare;
compare = timespec_cmp (&(a->opened), &(b->opened));

View File

@@ -267,22 +267,22 @@ qofOwnerSetEntity (GncOwner *owner, QofInstance *ent)
{
return;
}
if (0 == safe_strcmp(ent->e_type, GNC_ID_CUSTOMER))
if (0 == g_strcmp0(ent->e_type, GNC_ID_CUSTOMER))
{
owner->type = GNC_OWNER_CUSTOMER;
gncOwnerInitCustomer(owner, (GncCustomer*)ent);
}
else if (0 == safe_strcmp(ent->e_type, GNC_ID_JOB))
else if (0 == g_strcmp0(ent->e_type, GNC_ID_JOB))
{
owner->type = GNC_OWNER_JOB;
gncOwnerInitJob(owner, (GncJob*)ent);
}
else if (0 == safe_strcmp(ent->e_type, GNC_ID_VENDOR))
else if (0 == g_strcmp0(ent->e_type, GNC_ID_VENDOR))
{
owner->type = GNC_OWNER_VENDOR;
gncOwnerInitVendor(owner, (GncVendor*)ent);
}
else if (0 == safe_strcmp(ent->e_type, GNC_ID_EMPLOYEE))
else if (0 == g_strcmp0(ent->e_type, GNC_ID_EMPLOYEE))
{
owner->type = GNC_OWNER_EMPLOYEE;
gncOwnerInitEmployee(owner, (GncEmployee*)ent);
@@ -1166,25 +1166,25 @@ gboolean gncOwnerGetOwnerFromTypeGuid (QofBook *book, GncOwner *owner, QofIdType
{
if (!book || !owner || !type || !guid) return FALSE;
if (0 == safe_strcmp(type, GNC_ID_CUSTOMER))
if (0 == g_strcmp0(type, GNC_ID_CUSTOMER))
{
GncCustomer *customer = gncCustomerLookup(book, guid);
gncOwnerInitCustomer(owner, customer);
return (NULL != customer);
}
else if (0 == safe_strcmp(type, GNC_ID_JOB))
else if (0 == g_strcmp0(type, GNC_ID_JOB))
{
GncJob *job = gncJobLookup(book, guid);
gncOwnerInitJob(owner, job);
return (NULL != job);
}
else if (0 == safe_strcmp(type, GNC_ID_VENDOR))
else if (0 == g_strcmp0(type, GNC_ID_VENDOR))
{
GncVendor *vendor = gncVendorLookup(book, guid);
gncOwnerInitVendor(owner, vendor);
return (NULL != vendor);
}
else if (0 == safe_strcmp(type, GNC_ID_EMPLOYEE))
else if (0 == g_strcmp0(type, GNC_ID_EMPLOYEE))
{
GncEmployee *employee = gncEmployeeLookup(book, guid);
gncOwnerInitEmployee(owner, employee);

View File

@@ -103,7 +103,7 @@ gncTaxIncludedTypeToString (GncTaxIncluded type)
}
#undef GNC_RETURN_ENUM_AS_STRING
#define GNC_RETURN_ON_MATCH(s,x) \
if(safe_strcmp((s), (str)) == 0) { *type = x; return(TRUE); }
if(g_strcmp0((s), (str)) == 0) { *type = x; return(TRUE); }
gboolean
gncAmountStringToType (const char *str, GncAmountType *type)
{
@@ -136,7 +136,7 @@ gncTaxIncludedStringToType (const char *str, GncTaxIncluded *type)
#define SET_STR(obj, member, str) { \
char * tmp; \
\
if (!safe_strcmp (member, str)) return; \
if (!g_strcmp0 (member, str)) return; \
gncTaxTableBeginEdit (obj); \
tmp = CACHE_INSERT (str); \
CACHE_REMOVE (member); \
@@ -657,7 +657,7 @@ GncTaxTable *gncTaxTableLookupByName (QofBook *book, const char *name)
for ( ; list; list = list->next)
{
GncTaxTable *table = list->data;
if (!safe_strcmp (table->name, name))
if (!g_strcmp0 (table->name, name))
return list->data;
}
return NULL;
@@ -793,7 +793,7 @@ int gncTaxTableEntryCompare (const GncTaxTableEntry *a, const GncTaxTableEntry *
name_a = gnc_account_get_full_name (a->account);
name_b = gnc_account_get_full_name (b->account);
retval = safe_strcmp(name_a, name_b);
retval = g_strcmp0(name_a, name_b);
g_free(name_a);
g_free(name_b);
@@ -808,7 +808,7 @@ int gncTaxTableCompare (const GncTaxTable *a, const GncTaxTable *b)
if (!a && !b) return 0;
if (!a) return -1;
if (!b) return 1;
return safe_strcmp (a->name, b->name);
return g_strcmp0 (a->name, b->name);
}
gboolean gncTaxTableEntryEqual(const GncTaxTableEntry *a, const GncTaxTableEntry *b)
@@ -845,7 +845,7 @@ gboolean gncTaxTableEqual(const GncTaxTable *a, const GncTaxTable *b)
g_return_val_if_fail(GNC_IS_TAXTABLE(a), FALSE);
g_return_val_if_fail(GNC_IS_TAXTABLE(b), FALSE);
if (safe_strcmp(a->name, b->name) != 0)
if (g_strcmp0(a->name, b->name) != 0)
{
PWARN("Names differ: %s vs %s", a->name, b->name);
return FALSE;

View File

@@ -449,7 +449,7 @@ static void gncVendorFree (GncVendor *vendor)
#define SET_STR(obj, member, str) { \
char * tmp; \
\
if (!safe_strcmp (member, str)) return; \
if (!g_strcmp0 (member, str)) return; \
gncVendorBeginEdit (obj); \
tmp = CACHE_INSERT (str); \
CACHE_REMOVE (member); \
@@ -745,19 +745,19 @@ gboolean gncVendorEqual(const GncVendor *a, const GncVendor *b)
g_return_val_if_fail(GNC_IS_VENDOR(a), FALSE);
g_return_val_if_fail(GNC_IS_VENDOR(b), FALSE);
if (safe_strcmp(a->id, b->id) != 0)
if (g_strcmp0(a->id, b->id) != 0)
{
PWARN("IDs differ: %s vs %s", a->id, b->id);
return FALSE;
}
if (safe_strcmp(a->name, b->name) != 0)
if (g_strcmp0(a->name, b->name) != 0)
{
PWARN("Names differ: %s vs %s", a->name, b->name);
return FALSE;
}
if (safe_strcmp(a->notes, b->notes) != 0)
if (g_strcmp0(a->notes, b->notes) != 0)
{
PWARN("Notes differ");
return FALSE;

View File

@@ -81,7 +81,7 @@ test_string_fcn (GncAddress *address, const char *message,
do_test (!gncAddressIsDirty (address), "test if start dirty");
set (address, str);
do_test (gncAddressIsDirty (address), "test dirty later");
do_test (safe_strcmp (get (address), str) == 0, message);
do_test (g_strcmp0 (get (address), str) == 0, message);
gncAddressClearDirty (address);
}

View File

@@ -65,7 +65,7 @@ static void test_business (void)
do_test (gncBusinessLookup ("snm98sn snml say dyikh9y9ha") == NULL,
"lookup non-existant business object");
do_test (!safe_strcmp (gncBusinessGetTypeLabel (TEST_MODULE_NAME),
do_test (!g_strcmp0 (gncBusinessGetTypeLabel (TEST_MODULE_NAME),
_(TEST_MODULE_DESC)),
"test description return");
}

View File

@@ -71,19 +71,19 @@ test_commodity(void)
com != NULL, "commodity with data new and destroy");
do_test(
safe_strcmp(fullname, gnc_commodity_get_fullname(com)) == 0,
g_strcmp0(fullname, gnc_commodity_get_fullname(com)) == 0,
"fullnames equal test");
do_test(
safe_strcmp(namespace, gnc_commodity_get_namespace(com)) == 0,
g_strcmp0(namespace, gnc_commodity_get_namespace(com)) == 0,
"namespace equal test");
do_test(
safe_strcmp(mnemonic, gnc_commodity_get_mnemonic(com)) == 0,
g_strcmp0(mnemonic, gnc_commodity_get_mnemonic(com)) == 0,
"mnemonic equal test");
do_test(
safe_strcmp(cusip, gnc_commodity_get_cusip(com)) == 0,
g_strcmp0(cusip, gnc_commodity_get_cusip(com)) == 0,
"cusip equal test");
do_test(
@@ -93,25 +93,25 @@ test_commodity(void)
fullname = get_random_string();
gnc_commodity_set_fullname(com, fullname);
do_test(
safe_strcmp(fullname, gnc_commodity_get_fullname(com)) == 0,
g_strcmp0(fullname, gnc_commodity_get_fullname(com)) == 0,
"reset fullnames equal test");
namespace = get_random_commodity_namespace();
gnc_commodity_set_namespace(com, namespace);
do_test(
safe_strcmp(namespace, gnc_commodity_get_namespace(com)) == 0,
g_strcmp0(namespace, gnc_commodity_get_namespace(com)) == 0,
"reset namespace equal test");
mnemonic = get_random_string();
gnc_commodity_set_mnemonic(com, mnemonic);
do_test(
safe_strcmp(mnemonic, gnc_commodity_get_mnemonic(com)) == 0,
g_strcmp0(mnemonic, gnc_commodity_get_mnemonic(com)) == 0,
"reset mnemonic equal test");
cusip = get_random_string();
gnc_commodity_set_cusip(com, cusip);
do_test(
safe_strcmp(cusip, gnc_commodity_get_cusip(com)) == 0,
g_strcmp0(cusip, gnc_commodity_get_cusip(com)) == 0,
"reset cusip equal test");
fraction = get_random_int_in_range(0, 10000);

View File

@@ -117,7 +117,7 @@ test_customer (void)
gncCustomerCommitEdit(customer);
res = qof_object_printable (GNC_ID_CUSTOMER, customer);
do_test (res != NULL, "Printable NULL?");
do_test (safe_strcmp (str, res) == 0, "Printable equals");
do_test (g_strcmp0 (str, res) == 0, "Printable equals");
}
do_test (gncCustomerGetJoblist (customer, TRUE) == NULL, "joblist empty");
@@ -154,7 +154,7 @@ test_string_fcn (QofBook *book, const char *message,
* without having circular dependencies.
*/
// do_test (!gncCustomerIsDirty (customer), "test dirty after commit");
do_test (safe_strcmp (get (customer), str) == 0, message);
do_test (g_strcmp0 (get (customer), str) == 0, message);
gncCustomerSetActive (customer, FALSE);
count++;
}

View File

@@ -122,7 +122,7 @@ test_employee (void)
gncAddressSetName (addr, str);
res = qof_object_printable (GNC_ID_EMPLOYEE, employee);
do_test (res != NULL, "Printable NULL?");
do_test (safe_strcmp (str, res) == 0, "Printable equals");
do_test (g_strcmp0 (str, res) == 0, "Printable equals");
}
qof_book_destroy (book);
@@ -148,7 +148,7 @@ test_string_fcn (QofBook *book, const char *message,
* without having circular dependencies.
*/
// do_test (!gncEmployeeIsDirty (employee), "test dirty after commit");
do_test (safe_strcmp (get (employee), str) == 0, message);
do_test (g_strcmp0 (get (employee), str) == 0, message);
gncEmployeeSetActive (employee, FALSE);
count++;
}

View File

@@ -118,7 +118,7 @@ test_job (void)
gncJobSetName (job, str);
res = qof_object_printable (GNC_ID_JOB, job);
do_test (res != NULL, "Printable NULL?");
do_test (safe_strcmp (str, res) == 0, "Printable equals");
do_test (g_strcmp0 (str, res) == 0, "Printable equals");
}
{
GList *list;
@@ -167,7 +167,7 @@ test_string_fcn (QofBook *book, const char *message,
* without having circular dependencies.
*/
// do_test (!qof_instance_is_dirty (QOF_INSTANCE(job)), "test dirty after commit");
do_test (safe_strcmp (get (job), str) == 0, message);
do_test (g_strcmp0 (get (job), str) == 0, message);
gncJobSetActive (job, FALSE);
count++;
}

View File

@@ -81,7 +81,7 @@ test_object (void)
do_test (qof_object_lookup ("snm98sn snml say dyikh9y9ha") == NULL,
"lookup non-existant object object");
do_test (!safe_strcmp (qof_object_get_type_label (TEST_MODULE_NAME),
do_test (!g_strcmp0 (qof_object_get_type_label (TEST_MODULE_NAME),
_(TEST_MODULE_DESC)),
"test description return");
}

View File

@@ -81,7 +81,7 @@ static void test_class (void)
== (QofAccessFunc)test_core_param,
"qof_class_get_parameter_getter");
do_test (safe_strcmp (qof_class_get_parameter_type (TEST_MODULE_NAME,
do_test (g_strcmp0 (qof_class_get_parameter_type (TEST_MODULE_NAME,
TEST_PARAM),
TEST_CORE) == 0, "qof_class_get_parameter_type");

View File

@@ -120,7 +120,7 @@ test_vendor (void)
gncVendorSetName (vendor, str);
res = qof_object_printable (GNC_ID_VENDOR, vendor);
do_test (res != NULL, "Printable NULL?");
do_test (safe_strcmp (str, res) == 0, "Printable equals");
do_test (g_strcmp0 (str, res) == 0, "Printable equals");
}
qof_book_destroy (book);
@@ -146,7 +146,7 @@ test_string_fcn (QofBook *book, const char *message,
* without having circular dependencies.
*/
// do_test (!gncVendorIsDirty (vendor), "test dirty after commit");
do_test (safe_strcmp (get (vendor), str) == 0, message);
do_test (g_strcmp0 (get (vendor), str) == 0, message);
gncVendorSetActive (vendor, FALSE);
count++;
}

View File

@@ -369,7 +369,7 @@ listen_for_account_events (QofInstance *entity, QofEventId event_type,
if (match)
{
match_str = gnc_quickfill_string (match);
if (match_str && (safe_strcmp(match_str, name) != 0))
if (match_str && (g_strcmp0(match_str, name) != 0))
{
PINFO ("got match for %s", name);
break;

View File

@@ -368,21 +368,21 @@ gnc_ui_to_account(AccountWindow *aw)
string = gtk_entry_get_text (GTK_ENTRY(aw->name_entry));
old_string = xaccAccountGetName (account);
if (safe_strcmp (string, old_string) != 0)
if (g_strcmp0 (string, old_string) != 0)
xaccAccountSetName (account, string);
string = gtk_entry_get_text (GTK_ENTRY(aw->description_entry));
old_string = xaccAccountGetDescription (account);
if (safe_strcmp (string, old_string) != 0)
if (g_strcmp0 (string, old_string) != 0)
xaccAccountSetDescription (account, string);
gtk_color_button_get_color(GTK_COLOR_BUTTON(aw->color_entry_button), &color );
string = gdk_color_to_string(&color);
if (safe_strcmp (string, DEFAULT_COLOR) == 0)
if (g_strcmp0 (string, DEFAULT_COLOR) == 0)
string = "Not Set";
old_string = xaccAccountGetColor (account);
if (safe_strcmp (string, old_string) != 0)
if (g_strcmp0 (string, old_string) != 0)
xaccAccountSetColor (account, string);
commodity = (gnc_commodity *)
@@ -408,7 +408,7 @@ gnc_ui_to_account(AccountWindow *aw)
string = gtk_entry_get_text (GTK_ENTRY(aw->code_entry));
old_string = xaccAccountGetCode (account);
if (safe_strcmp (string, old_string) != 0)
if (g_strcmp0 (string, old_string) != 0)
xaccAccountSetCode (account, string);
gtk_text_buffer_get_start_iter (aw->notes_text_buffer, &start);
@@ -758,7 +758,7 @@ gnc_common_ok (AccountWindow *aw)
/* check for valid name */
name = gtk_entry_get_text(GTK_ENTRY(aw->name_entry));
if (safe_strcmp(name, "") == 0)
if (g_strcmp0(name, "") == 0)
{
const char *message = _("The account must be given a name.");
gnc_error_dialog(aw->dialog, "%s", message);
@@ -1663,7 +1663,7 @@ gnc_split_account_name (QofBook *book, const char *in_name, Account **base_accou
{
account = node->data;
if (safe_strcmp(xaccAccountGetName (account), *ptr) == 0)
if (g_strcmp0(xaccAccountGetName (account), *ptr) == 0)
{
/* We found an account. */
*base_account = account;

View File

@@ -711,7 +711,7 @@ gnc_ui_namespace_picker_ns (GtkWidget *cbwe)
namespace = gtk_entry_get_text( GTK_ENTRY( gtk_bin_get_child( GTK_BIN( GTK_COMBO_BOX(cbwe)))));
if (safe_strcmp (namespace, GNC_COMMODITY_NS_ISO) == 0)
if (g_strcmp0 (namespace, GNC_COMMODITY_NS_ISO) == 0)
{
/* In case the user types in ISO4217, map it to CURRENCY. */
return g_strdup(GNC_COMMODITY_NS_CURRENCY);
@@ -870,7 +870,7 @@ gnc_find_timezone_menu_position(const gchar *timezone)
guint i = 0;
while (!found && known_timezones[i])
{
if (safe_strcmp(timezone, known_timezones[i]) != 0)
if (g_strcmp0(timezone, known_timezones[i]) != 0)
{
i++;
}

View File

@@ -462,7 +462,7 @@ gnc_option_create_date_widget (GNCOption *option)
show_time = gnc_option_show_time(option);
use24 = gnc_gconf_get_bool(GCONF_GENERAL, "24hour_time", FALSE);
if (safe_strcmp(type, "relative") != 0)
if (g_strcmp0(type, "relative") != 0)
{
ab_widget = gnc_date_edit_new(time(NULL), show_time, use24);
entry = GNC_DATE_EDIT(ab_widget)->date_entry;
@@ -476,7 +476,7 @@ gnc_option_create_date_widget (GNCOption *option)
}
}
if (safe_strcmp(type, "absolute") != 0)
if (g_strcmp0(type, "absolute") != 0)
{
int i;
num_values = gnc_option_num_permissible_values(option);
@@ -518,20 +518,20 @@ gnc_option_create_date_widget (GNCOption *option)
}
}
if (safe_strcmp(type, "absolute") == 0)
if (g_strcmp0(type, "absolute") == 0)
{
free(type);
gnc_option_set_widget (option, ab_widget);
return ab_widget;
}
else if (safe_strcmp(type, "relative") == 0)
else if (g_strcmp0(type, "relative") == 0)
{
gnc_option_set_widget (option, rel_widget);
free(type);
return rel_widget;
}
else if (safe_strcmp(type, "both") == 0)
else if (g_strcmp0(type, "both") == 0)
{
box = gtk_hbox_new(FALSE, 5);
@@ -1212,7 +1212,7 @@ gnc_options_dialog_build_contents(GNCOptionWin *propertybox,
page = gnc_options_dialog_append_page(propertybox, section);
section_name = gnc_option_section_name(section);
if (safe_strcmp(section_name, default_section_name) == 0)
if (g_strcmp0(section_name, default_section_name) == 0)
default_page = page;
}
@@ -2259,17 +2259,17 @@ gnc_option_set_ui_value_date (GNCOption *option, gboolean use_default,
symbol_str = gnc_date_option_value_get_type (value);
if (symbol_str)
{
if (safe_strcmp(symbol_str, "relative") == 0)
if (g_strcmp0(symbol_str, "relative") == 0)
{
SCM relative = gnc_date_option_value_get_relative (value);
index = gnc_option_permissible_value_index(option, relative);
if (safe_strcmp(date_option_type, "relative") == 0)
if (g_strcmp0(date_option_type, "relative") == 0)
{
/* GtkComboBox per-item tooltip changes needed below */
gnc_combott_set_active(GNC_COMBOTT(widget), index);
}
else if (safe_strcmp(date_option_type, "both") == 0)
else if (g_strcmp0(date_option_type, "both") == 0)
{
GList *widget_list;
GtkWidget *rel_date_widget;
@@ -2287,17 +2287,17 @@ gnc_option_set_ui_value_date (GNCOption *option, gboolean use_default,
bad_value = TRUE;
}
}
else if (safe_strcmp(symbol_str, "absolute") == 0)
else if (g_strcmp0(symbol_str, "absolute") == 0)
{
Timespec ts;
ts = gnc_date_option_value_get_absolute (value);
if (safe_strcmp(date_option_type, "absolute") == 0)
if (g_strcmp0(date_option_type, "absolute") == 0)
{
gnc_date_edit_set_time(GNC_DATE_EDIT(widget), ts.tv_sec);
}
else if (safe_strcmp(date_option_type, "both") == 0)
else if (g_strcmp0(date_option_type, "both") == 0)
{
GList *widget_list;
GtkWidget *ab_widget;
@@ -2688,7 +2688,7 @@ gnc_option_get_ui_value_date (GNCOption *option, GtkWidget *widget)
SCM type, val, result = SCM_UNDEFINED;
char *subtype = gnc_option_date_option_get_subtype(option);
if (safe_strcmp(subtype, "relative") == 0)
if (g_strcmp0(subtype, "relative") == 0)
{
/* GtkComboBox per-item tooltip changes needed below */
index = gnc_combott_get_active(GNC_COMBOTT(widget));
@@ -2697,7 +2697,7 @@ gnc_option_get_ui_value_date (GNCOption *option, GtkWidget *widget)
val = gnc_option_permissible_value(option, index);
result = scm_cons(type, val);
}
else if (safe_strcmp(subtype, "absolute") == 0)
else if (g_strcmp0(subtype, "absolute") == 0)
{
Timespec ts;
@@ -2706,7 +2706,7 @@ gnc_option_get_ui_value_date (GNCOption *option, GtkWidget *widget)
result = scm_cons(scm_str2symbol("absolute"), gnc_timespec2timepair(ts));
}
else if (safe_strcmp(subtype, "both") == 0)
else if (g_strcmp0(subtype, "both") == 0)
{
Timespec ts;
int index;

View File

@@ -674,7 +674,7 @@ gnc_xfer_dialog_quickfill( XferDialog *xferData )
changed = TRUE;
}
if ( !safe_strcmp(gtk_entry_get_text(GTK_ENTRY(xferData->memo_entry)), "" ))
if ( !g_strcmp0(gtk_entry_get_text(GTK_ENTRY(xferData->memo_entry)), "" ))
{
DEBUG("updating memo");
gtk_entry_set_text( GTK_ENTRY(xferData->memo_entry),

View File

@@ -1998,7 +1998,7 @@ main_window_update_page_color (GncPluginPage *page,
color_string = g_strstrip(g_strdup(color_in));
/* Optimization, if the color hasn't changed, don't update. */
if (*color_string == '\0' || 0 == safe_strcmp(color_string, gnc_plugin_page_get_page_color(page)))
if (*color_string == '\0' || 0 == g_strcmp0(color_string, gnc_plugin_page_get_page_color(page)))
{
g_free(color_string);
LEAVE("empty string or color unchanged");

View File

@@ -87,15 +87,15 @@ gnc_extension_type (SCM extension, GtkUIManagerItemType *type)
return FALSE;
}
if (safe_strcmp(string, "menu-item") == 0)
if (g_strcmp0(string, "menu-item") == 0)
{
*type = GTK_UI_MANAGER_MENUITEM;
}
else if (safe_strcmp(string, "menu") == 0)
else if (g_strcmp0(string, "menu") == 0)
{
*type = GTK_UI_MANAGER_MENU;
}
else if (safe_strcmp(string, "separator") == 0)
else if (g_strcmp0(string, "separator") == 0)
{
*type = GTK_UI_MANAGER_SEPARATOR;
}

View File

@@ -201,7 +201,7 @@ update_booleans (GNCQueryList *list, gint row)
const char *type = gnc_search_param_get_param_type (param);
/* if this is a boolean, ignore it now -- we'll use a checkmark later */
if (safe_strcmp (type, QOF_TYPE_BOOLEAN))
if (g_strcmp0 (type, QOF_TYPE_BOOLEAN))
continue;
result = (gboolean) GPOINTER_TO_INT(gnc_search_param_compute_value(param, entry));
@@ -733,8 +733,8 @@ gnc_query_list_set_query_sort (GNCQueryList *list, gboolean new_column)
if (list->numeric_inv_sort)
{
const char *type = gnc_search_param_get_param_type (param);
if (!safe_strcmp(type, QOF_TYPE_NUMERIC) ||
!safe_strcmp(type, QOF_TYPE_DEBCRED))
if (!g_strcmp0(type, QOF_TYPE_NUMERIC) ||
!g_strcmp0(type, QOF_TYPE_DEBCRED))
sort_order = !sort_order;
}
@@ -840,7 +840,7 @@ gnc_query_list_fill(GNCQueryList *list)
gpointer res = item->data;
/* if this is a boolean, ignore it now -- we'll use a checkmark later */
if (!safe_strcmp (type, QOF_TYPE_BOOLEAN))
if (!g_strcmp0 (type, QOF_TYPE_BOOLEAN))
{
strings[i++] = g_strdup("");
continue;
@@ -857,8 +857,8 @@ gnc_query_list_fill(GNCQueryList *list)
}
/* Now convert this to a text value for the row */
if (!safe_strcmp(type, QOF_TYPE_DEBCRED) ||
!safe_strcmp(type, QOF_TYPE_NUMERIC))
if (!g_strcmp0(type, QOF_TYPE_DEBCRED) ||
!g_strcmp0(type, QOF_TYPE_NUMERIC))
{
gnc_numeric (*nfcn)(gpointer, QofParam *) =
(gnc_numeric(*)(gpointer, QofParam *))(qp->param_getfcn);

View File

@@ -377,7 +377,7 @@ _name_comparator(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer u
a_caseless = g_utf8_casefold(xaccSchedXactionGetName(a_inst->sx), -1);
b_caseless = g_utf8_casefold(xaccSchedXactionGetName(b_inst->sx), -1);
rtn = safe_strcmp(a_caseless, b_caseless);
rtn = g_strcmp0(a_caseless, b_caseless);
g_free(a_caseless);
g_free(b_caseless);

View File

@@ -1570,7 +1570,7 @@ gnc_tree_model_split_reg_event_handler (QofInstance *entity,
return;
type = entity->e_type;
if (safe_strcmp(type, GNC_ID_SPLIT) == 0) {
if (g_strcmp0(type, GNC_ID_SPLIT) == 0) {
/* Get the split.*/
split = (Split *) entity;
@@ -1581,7 +1581,7 @@ gnc_tree_model_split_reg_event_handler (QofInstance *entity,
default:
DEBUG("ignored event for %p (%s)", split, name);
}
} else if (safe_strcmp(type, GNC_ID_TRANS) == 0) {
} else if (g_strcmp0(type, GNC_ID_TRANS) == 0) {
/* Get the trans.*/
trans = (Transaction *) entity;
@@ -1607,7 +1607,7 @@ gnc_tree_model_split_reg_event_handler (QofInstance *entity,
default:
DEBUG("ignored event for %p (%s)", trans, name);
}
} else if (safe_strcmp(type, GNC_ID_ACCOUNT) == 0) {
} else if (g_strcmp0(type, GNC_ID_ACCOUNT) == 0) {
switch (event_type) {
Account *acc;
case GNC_EVENT_ITEM_ADDED:

View File

@@ -506,13 +506,13 @@ tax_info_data_func (GtkTreeViewColumn *col,
GNC_TREE_MODEL_ACCOUNT_COL_TAX_INFO_SUB_ACCT,
&tax_info_sub_acct,
-1);
if ((safe_strcmp (tax_info_sub_acct, "") == 0) ||
if ((g_strcmp0 (tax_info_sub_acct, "") == 0) ||
(tax_info_sub_acct == NULL))
g_object_set(renderer, "text",
(tax_info == NULL ? "" : tax_info), NULL);
else
{
if ((safe_strcmp (tax_info, "") == 0) ||
if ((g_strcmp0 (tax_info, "") == 0) ||
(tax_info == NULL))
g_object_set(renderer, "text",
(tax_info_sub_acct == NULL ? "" : tax_info_sub_acct),
@@ -2279,7 +2279,7 @@ gnc_tree_view_account_name_edited_cb(Account *account, GtkTreeViewColumn *col, c
void
gnc_tree_view_account_code_edited_cb(Account *account, GtkTreeViewColumn *col, const gchar *new_code)
{
if (safe_strcmp(xaccAccountGetCode(account), new_code) == 0)
if (g_strcmp0(xaccAccountGetCode(account), new_code) == 0)
return;
xaccAccountSetCode(account, new_code);
}
@@ -2287,7 +2287,7 @@ gnc_tree_view_account_code_edited_cb(Account *account, GtkTreeViewColumn *col, c
void
gnc_tree_view_account_description_edited_cb(Account *account, GtkTreeViewColumn *col, const gchar *new_desc)
{
if (safe_strcmp(xaccAccountGetDescription(account), new_desc) == 0)
if (g_strcmp0(xaccAccountGetDescription(account), new_desc) == 0)
return;
xaccAccountSetDescription(account, new_desc);
}
@@ -2295,7 +2295,7 @@ gnc_tree_view_account_description_edited_cb(Account *account, GtkTreeViewColumn
void
gnc_tree_view_account_notes_edited_cb(Account *account, GtkTreeViewColumn *col, const gchar *new_notes)
{
if (safe_strcmp(xaccAccountGetNotes(account), new_notes) == 0)
if (g_strcmp0(xaccAccountGetNotes(account), new_notes) == 0)
return;
xaccAccountSetNotes(account, new_notes);
}

View File

@@ -279,7 +279,7 @@ gnc_search_param_type_match (GNCSearchParam *a, GNCSearchParam *b)
a_priv = GNC_SEARCH_PARAM_GET_PRIVATE(a);
b_priv = GNC_SEARCH_PARAM_GET_PRIVATE(b);
if (a_priv->type == b_priv->type ||
!safe_strcmp (a_priv->type, b_priv->type))
!g_strcmp0 (a_priv->type, b_priv->type))
return TRUE;
return FALSE;

View File

@@ -280,7 +280,7 @@ gnc_commodities_dialog_filter_ns_func (gnc_commodity_namespace *namespace,
/* Never show the template list */
name = gnc_commodity_namespace_get_name (namespace);
if (safe_strcmp (name, "template") == 0)
if (g_strcmp0 (name, "template") == 0)
return FALSE;
/* Check whether or not to show commodities */

View File

@@ -354,7 +354,7 @@ gnc_price_dialog_filter_ns_func (gnc_commodity_namespace *namespace,
/* Never show the template list */
name = gnc_commodity_namespace_get_name (namespace);
if (safe_strcmp (name, "template") == 0)
if (g_strcmp0 (name, "template") == 0)
return FALSE;
/* See if this namespace has commodities */

View File

@@ -101,16 +101,16 @@ gnc_prices_set_changed (PriceEditDialog *pedit_dialog, gboolean changed)
static int
type_string_to_index (const char *type)
{
if (safe_strcmp (type, "bid") == 0)
if (g_strcmp0 (type, "bid") == 0)
return 0;
if (safe_strcmp (type, "ask") == 0)
if (g_strcmp0 (type, "ask") == 0)
return 1;
if (safe_strcmp (type, "last") == 0)
if (g_strcmp0 (type, "last") == 0)
return 2;
if (safe_strcmp (type, "nav") == 0)
if (g_strcmp0 (type, "nav") == 0)
return 3;
return 4;

View File

@@ -234,7 +234,7 @@ load_txf_info (gint acct_category, TaxInfoDialog *ti_dialog)
SCM codes;
if (ti_dialog->tax_type == NULL ||
(safe_strcmp (ti_dialog->tax_type, "") == 0))
(g_strcmp0 (ti_dialog->tax_type, "") == 0))
{
destroy_txf_infos (infos);
return NULL;
@@ -302,7 +302,7 @@ load_txf_info (gint acct_category, TaxInfoDialog *ti_dialog)
str = g_strdup (SCM_SYMBOL_CHARS (scm));
else
str = g_strdup ("");
if (safe_strcmp (str, "not-impl") == 0)
if (g_strcmp0 (str, "not-impl") == 0)
{
g_free (str);
continue;
@@ -310,7 +310,7 @@ load_txf_info (gint acct_category, TaxInfoDialog *ti_dialog)
txf_info = g_new0 (TXFInfo, 1);
if (safe_strcmp (str, "none") == 0)
if (g_strcmp0 (str, "none") == 0)
txf_info->payer_name_source = NULL;
else
txf_info->payer_name_source = g_strdup (str);
@@ -417,7 +417,7 @@ load_txf_info (gint acct_category, TaxInfoDialog *ti_dialog)
g_free (temp);
g_free (temp2);
}
if (safe_strcmp (until, now) != 0)
if (g_strcmp0 (until, now) != 0)
g_free (until);
}
if (year != 0)
@@ -538,7 +538,7 @@ load_tax_entity_type_list (TaxInfoDialog *ti_dialog)
" - ",
tax_type_info->description, NULL);
/* save combo text for current tax type code */
if (safe_strcmp (ti_dialog->tax_type, tax_type_info->type_code) == 0)
if (g_strcmp0 (ti_dialog->tax_type, tax_type_info->type_code) == 0)
ti_dialog->tax_type_combo_text = tax_type_info->combo_box_entry;
/* the last will be default */
ti_dialog->default_tax_type = tax_type_info->combo_box_entry;
@@ -633,7 +633,7 @@ txf_infos_find_code (GList *infos, const char *code)
{
TXFInfo *info = infos->data;
if (safe_strcmp (code, info->code) == 0)
if (g_strcmp0 (code, info->code) == 0)
return info;
}
@@ -681,7 +681,7 @@ account_to_gui (TaxInfoDialog *ti_dialog, Account *account)
gtk_tree_path_free(path);
str = xaccAccountGetTaxUSPayerNameSource (account);
if (safe_strcmp (str, "parent") == 0)
if (g_strcmp0 (str, "parent") == 0)
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (ti_dialog->parent_account_button), TRUE);
else
@@ -924,13 +924,13 @@ gnc_tax_info_acct_type_cb (GtkWidget *w, gpointer data)
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w)))
{
button_name = gtk_buildable_get_name(GTK_BUILDABLE(w));
if (safe_strcmp (button_name, "income_radio") == 0)
if (g_strcmp0 (button_name, "income_radio") == 0)
ti_dialog->account_type = ACCT_TYPE_INCOME;
else if (safe_strcmp (button_name, "expense_radio") == 0)
else if (g_strcmp0 (button_name, "expense_radio") == 0)
ti_dialog->account_type = ACCT_TYPE_EXPENSE;
else if (safe_strcmp (button_name, "asset_radio") == 0)
else if (g_strcmp0 (button_name, "asset_radio") == 0)
ti_dialog->account_type = ACCT_TYPE_ASSET;
else if (safe_strcmp (button_name, "liab_eq_radio") == 0)
else if (g_strcmp0 (button_name, "liab_eq_radio") == 0)
ti_dialog->account_type = ACCT_TYPE_LIABILITY;
else
return;
@@ -1052,8 +1052,8 @@ static void
set_focus_sensitivity (TaxInfoDialog *ti_dialog)
{
if ((ti_dialog->tax_type == NULL) ||
(safe_strcmp (ti_dialog->tax_type, "Other") == 0) ||
(safe_strcmp (ti_dialog->tax_type, "") == 0))
(g_strcmp0 (ti_dialog->tax_type, "Other") == 0) ||
(g_strcmp0 (ti_dialog->tax_type, "") == 0))
{
gtk_widget_grab_focus (ti_dialog->tax_identity_edit_button);
gtk_widget_set_sensitive (ti_dialog->acct_info, FALSE);
@@ -1102,7 +1102,7 @@ identity_edit_response_cb (GtkDialog *dialog, gint response, gpointer data)
if (selected_type)
{
entry_type = selected_type->type_code;
if (!(safe_strcmp (ti_dialog->tax_type, entry_type) == 0))
if (!(g_strcmp0 (ti_dialog->tax_type, entry_type) == 0))
{
ti_dialog->tax_type_changed = TRUE;
gnc_set_current_book_tax_type (entry_type);
@@ -1139,7 +1139,7 @@ identity_edit_response_cb (GtkDialog *dialog, gint response, gpointer data)
}
}
}
if (!(safe_strcmp (ti_dialog->tax_name, entry_name) == 0))
if (!(g_strcmp0 (ti_dialog->tax_name, entry_name) == 0))
{
gnc_set_current_book_tax_name (entry_name);
ti_dialog->tax_name = g_strdup (entry_name);
@@ -1184,7 +1184,7 @@ identity_edit_clicked_cb (GtkButton *button,
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
name_entry = gtk_entry_new();
ti_dialog->entity_name_entry = name_entry;
if (!(safe_strcmp (ti_dialog->tax_name, NULL) == 0))
if (!(g_strcmp0 (ti_dialog->tax_name, NULL) == 0))
gtk_entry_set_text (GTK_ENTRY (name_entry), ti_dialog->tax_name);
label = gtk_label_new (_("Name"));
gtk_misc_set_alignment (GTK_MISC (label), 1.00, 0.50);
@@ -1206,7 +1206,7 @@ identity_edit_clicked_cb (GtkButton *button,
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter, 0, tax_type_info->combo_box_entry, -1);
if (safe_strcmp (ti_dialog->tax_type, tax_type_info->type_code) == 0)
if (g_strcmp0 (ti_dialog->tax_type, tax_type_info->type_code) == 0)
current_item = item;
item++;
}

View File

@@ -260,9 +260,9 @@ extract_base_name(URLType type, const gchar* path)
regcomp(&compiled_m, machine_rexp, REG_EXTENDED);
regcomp(&compiled_p, path_rexp, REG_EXTENDED);
if (!safe_strcmp (type, URL_TYPE_HTTP) ||
!safe_strcmp (type, URL_TYPE_SECURE) ||
!safe_strcmp (type, URL_TYPE_FTP))
if (!g_strcmp0 (type, URL_TYPE_HTTP) ||
!g_strcmp0 (type, URL_TYPE_SECURE) ||
!g_strcmp0 (type, URL_TYPE_FTP))
{
/* step 1: split the machine name away from the path
@@ -479,11 +479,11 @@ load_to_stream( GncHtmlWebkit* self, URLType type,
do
{
if ( !safe_strcmp( type, URL_TYPE_SECURE ) ||
!safe_strcmp( type, URL_TYPE_HTTP ) )
if ( !g_strcmp0( type, URL_TYPE_SECURE ) ||
!g_strcmp0( type, URL_TYPE_HTTP ) )
{
if ( !safe_strcmp( type, URL_TYPE_SECURE ) )
if ( !g_strcmp0( type, URL_TYPE_SECURE ) )
{
if ( !https_allowed() )
{
@@ -865,23 +865,23 @@ impl_webkit_show_url( GncHtml* self, URLType type,
return;
}
if ( safe_strcmp( type, URL_TYPE_SCHEME ) == 0 )
if ( g_strcmp0( type, URL_TYPE_SCHEME ) == 0 )
{
gnc_html_open_scm( GNC_HTML_WEBKIT(self), location, label, new_window );
}
else if ( safe_strcmp( type, URL_TYPE_JUMP ) == 0 )
else if ( g_strcmp0( type, URL_TYPE_JUMP ) == 0 )
{
/* Webkit jumps to the anchor on its own */
}
else if ( safe_strcmp( type, URL_TYPE_SECURE ) == 0 ||
safe_strcmp( type, URL_TYPE_HTTP ) == 0 ||
safe_strcmp( type, URL_TYPE_FILE ) == 0 )
else if ( g_strcmp0( type, URL_TYPE_SECURE ) == 0 ||
g_strcmp0( type, URL_TYPE_HTTP ) == 0 ||
g_strcmp0( type, URL_TYPE_FILE ) == 0 )
{
do
{
if ( safe_strcmp( type, URL_TYPE_SECURE ) == 0 )
if ( g_strcmp0( type, URL_TYPE_SECURE ) == 0 )
{
if ( !https_allowed() )
{
@@ -893,7 +893,7 @@ impl_webkit_show_url( GncHtml* self, URLType type,
}
}
if ( safe_strcmp( type, URL_TYPE_HTTP ) == 0 )
if ( g_strcmp0( type, URL_TYPE_HTTP ) == 0 )
{
if ( !http_allowed() )
{

View File

@@ -264,7 +264,7 @@ gnc_html_parse_url( GncHtml* self, const gchar* url,
g_free( protocol );
if ( !safe_strcmp( retval, URL_TYPE_FILE ) )
if ( !g_strcmp0( retval, URL_TYPE_FILE ) )
{
if ( !found_protocol && path && self && priv->base_location )
{
@@ -285,7 +285,7 @@ gnc_html_parse_url( GncHtml* self, const gchar* url,
}
}
else if ( !safe_strcmp( retval, URL_TYPE_JUMP ) )
else if ( !g_strcmp0( retval, URL_TYPE_JUMP ) )
{
*url_location = NULL;
g_free( path );

View File

@@ -446,13 +446,13 @@ csv_export_info_acct_type_cb (GtkWidget *w, gpointer user_data)
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w)))
{
button_name = gtk_buildable_get_name(GTK_BUILDABLE(w));
if (safe_strcmp (button_name, "income_radio") == 0)
if (g_strcmp0 (button_name, "income_radio") == 0)
info->csva.account_type = ACCT_TYPE_INCOME;
else if (safe_strcmp (button_name, "expense_radio") == 0)
else if (g_strcmp0 (button_name, "expense_radio") == 0)
info->csva.account_type = ACCT_TYPE_EXPENSE;
else if (safe_strcmp (button_name, "asset_radio") == 0)
else if (g_strcmp0 (button_name, "asset_radio") == 0)
info->csva.account_type = ACCT_TYPE_ASSET;
else if (safe_strcmp (button_name, "liab_eq_radio") == 0)
else if (g_strcmp0 (button_name, "liab_eq_radio") == 0)
info->csva.account_type = ACCT_TYPE_LIABILITY;
else
return;

View File

@@ -888,7 +888,7 @@ static void column_type_changed(GtkCellRenderer* renderer, gchar* path,
* model 0, string 0, model 1, string 1, ..., model ncols, string ncols. */
gtk_tree_model_get(store, &iter, 2 * i + 1, &contents, -1);
/* If this column has the same string that the user selected ... */
if (!safe_strcmp(contents, new_text))
if (!g_strcmp0(contents, new_text))
{
/* ... set this column to the "None" type. (We can't allow duplicate types.) */
gtk_list_store_set(GTK_LIST_STORE(store), &iter, 2 * i + 1,
@@ -991,7 +991,7 @@ gboolean preview_settings_valid (CsvImportTrans* info)
for (type = 0; type < GNC_CSV_NUM_COL_TYPES; type++)
{
/* ... we find one that matches with what's in the column. */
if (!safe_strcmp(contents, _(gnc_csv_column_type_strs[type])))
if (!g_strcmp0(contents, _(gnc_csv_column_type_strs[type])))
{
/* Set the column_types array appropriately and quit. */
column_types->data[i] = type;

View File

@@ -701,7 +701,7 @@ static void split_find_match (GNCImportTransInfo * trans_info,
conversion_ok = FALSE;
if ( (conversion_ok && (split_number == new_trans_number)) ||
(safe_strcmp(new_trans_str, split_str) == 0) )
(g_strcmp0(new_trans_str, split_str) == 0) )
{
/* An exact match of the Check number gives a +4 */
prob += 4;

View File

@@ -278,51 +278,51 @@ find_reference_param_cb(QofParam *param, gpointer user_data)
{
return;
}
if (0 == safe_strcmp(param->param_type, QOF_TYPE_STRING))
if (0 == g_strcmp0(param->param_type, QOF_TYPE_STRING))
{
return;
}
if (0 == safe_strcmp(param->param_type, QOF_TYPE_NUMERIC))
if (0 == g_strcmp0(param->param_type, QOF_TYPE_NUMERIC))
{
return;
}
if (0 == safe_strcmp(param->param_type, QOF_TYPE_DATE))
if (0 == g_strcmp0(param->param_type, QOF_TYPE_DATE))
{
return;
}
if (0 == safe_strcmp(param->param_type, QOF_TYPE_CHAR))
if (0 == g_strcmp0(param->param_type, QOF_TYPE_CHAR))
{
return;
}
if (0 == safe_strcmp(param->param_type, QOF_TYPE_DEBCRED))
if (0 == g_strcmp0(param->param_type, QOF_TYPE_DEBCRED))
{
return;
}
if (0 == safe_strcmp(param->param_type, QOF_TYPE_GUID))
if (0 == g_strcmp0(param->param_type, QOF_TYPE_GUID))
{
return;
}
if (0 == safe_strcmp(param->param_type, QOF_TYPE_INT32))
if (0 == g_strcmp0(param->param_type, QOF_TYPE_INT32))
{
return;
}
if (0 == safe_strcmp(param->param_type, QOF_TYPE_INT64))
if (0 == g_strcmp0(param->param_type, QOF_TYPE_INT64))
{
return;
}
if (0 == safe_strcmp(param->param_type, QOF_TYPE_DOUBLE))
if (0 == g_strcmp0(param->param_type, QOF_TYPE_DOUBLE))
{
return;
}
if (0 == safe_strcmp(param->param_type, QOF_TYPE_KVP))
if (0 == g_strcmp0(param->param_type, QOF_TYPE_KVP))
{
return;
}
if (0 == safe_strcmp(param->param_type, QOF_TYPE_BOOLEAN))
if (0 == g_strcmp0(param->param_type, QOF_TYPE_BOOLEAN))
{
return;
}
if (0 == safe_strcmp(param->param_type, QOF_ID_BOOK))
if (0 == g_strcmp0(param->param_type, QOF_ID_BOOK))
{
return;
}

View File

@@ -297,7 +297,7 @@ qof_instance_init_data (QofInstance *inst, QofIdType type, QofBook *book)
* OK, it might eliminate programming errors. */
col_type = qof_collection_get_type(col);
if (safe_strcmp(col_type, type))
if (g_strcmp0(col_type, type))
{
PERR ("attempt to insert \"%s\" into \"%s\"", type, col_type);
return;

View File

@@ -162,7 +162,7 @@ qof_log_init_filename(const gchar* log_filename)
fout = fopen(fname, "wb");
#else
/* We must not overwrite /dev/null */
g_assert(safe_strcmp(log_filename, "/dev/null") != 0);
g_assert(g_strcmp0(log_filename, "/dev/null") != 0);
/* Windows prevents renaming of open files, so the next command silently fails there
* No problem, the filename on Winows will simply have the random characters */

View File

@@ -355,7 +355,7 @@ const QofObject * qof_object_lookup (QofIdTypeConst name)
for (iter = object_modules; iter; iter = iter->next)
{
obj = iter->data;
if (!safe_strcmp (obj->e_type, name))
if (!g_strcmp0 (obj->e_type, name))
return obj;
}
return NULL;

View File

@@ -492,7 +492,7 @@ compile_sort (QofQuerySort *sort, QofIdType obj)
if (sort->comp_fcn == NULL)
sort->obj_cmp = qof_class_get_default_sort (resObj->param_type);
}
else if (!safe_strcmp (sort->param_list->data, QUERY_DEFAULT_SORT))
else if (!g_strcmp0 (sort->param_list->data, QUERY_DEFAULT_SORT))
{
sort->use_default = TRUE;
}
@@ -580,7 +580,7 @@ static int param_list_cmp (const QofQueryParamList *l1, const QofQueryParamList
if (!l1 && l2) return -1;
if (l1 && !l2) return 1;
ret = safe_strcmp (l1->data, l2->data);
ret = g_strcmp0 (l1->data, l2->data);
if (ret)
return ret;
@@ -851,7 +851,7 @@ qof_query_run_subquery (QofQuery *subq, const QofQuery* primaryq)
/* Make sure we're searching for the same thing */
g_return_val_if_fail (subq->search_for, NULL);
g_return_val_if_fail (primaryq->search_for, NULL);
g_return_val_if_fail(!safe_strcmp(subq->search_for, primaryq->search_for),
g_return_val_if_fail(!g_strcmp0(subq->search_for, primaryq->search_for),
NULL);
/* Perform the subquery */
@@ -894,7 +894,7 @@ void qof_query_search_for (QofQuery *q, QofIdTypeConst obj_type)
if (!q || !obj_type)
return;
if (safe_strcmp (q->search_for, obj_type))
if (g_strcmp0 (q->search_for, obj_type))
{
q->search_for = (QofIdType) obj_type;
q->changed = 1;
@@ -1103,7 +1103,7 @@ qof_query_merge(QofQuery *q1, QofQuery *q2, QofQueryOp op)
if (!q2) return q1;
if (q1->search_for && q2->search_for)
g_return_val_if_fail (safe_strcmp (q1->search_for, q2->search_for) == 0,
g_return_val_if_fail (g_strcmp0 (q1->search_for, q2->search_for) == 0,
NULL);
search_for = (q1->search_for ? q1->search_for : q2->search_for);
@@ -1702,8 +1702,8 @@ qof_query_printPredData (QofQueryPredData *pd, GList *lst)
g_string_append (gs, (gchar *) pd->type_name);
/* Char Predicate and GncGUID predicate don't use the 'how' field. */
if (safe_strcmp (pd->type_name, QOF_TYPE_CHAR) &&
safe_strcmp (pd->type_name, QOF_TYPE_GUID))
if (g_strcmp0 (pd->type_name, QOF_TYPE_CHAR) &&
g_strcmp0 (pd->type_name, QOF_TYPE_GUID))
{
g_string_append_printf (gs, " how: %s",
qof_query_printStringForHow (pd->how));
@@ -1747,7 +1747,7 @@ static void
qof_query_printValueForParam (QofQueryPredData *pd, GString * gs)
{
if (!safe_strcmp (pd->type_name, QOF_TYPE_GUID))
if (!g_strcmp0 (pd->type_name, QOF_TYPE_GUID))
{
GList *node;
query_guid_t pdata = (query_guid_t) pd;
@@ -1761,7 +1761,7 @@ qof_query_printValueForParam (QofQueryPredData *pd, GString * gs)
}
return;
}
if (!safe_strcmp (pd->type_name, QOF_TYPE_STRING))
if (!g_strcmp0 (pd->type_name, QOF_TYPE_STRING))
{
query_string_t pdata = (query_string_t) pd;
g_string_append_printf (gs, " Match type %s",
@@ -1771,7 +1771,7 @@ qof_query_printValueForParam (QofQueryPredData *pd, GString * gs)
pdata->matchstring);
return;
}
if (!safe_strcmp (pd->type_name, QOF_TYPE_NUMERIC))
if (!g_strcmp0 (pd->type_name, QOF_TYPE_NUMERIC))
{
query_numeric_t pdata = (query_numeric_t) pd;
g_string_append_printf (gs, " Match type %s",
@@ -1780,7 +1780,7 @@ qof_query_printValueForParam (QofQueryPredData *pd, GString * gs)
gnc_num_dbg_to_string (pdata->amount));
return;
}
if (!safe_strcmp (pd->type_name, QOF_TYPE_KVP))
if (!g_strcmp0 (pd->type_name, QOF_TYPE_KVP))
{
GSList *node;
query_kvp_t pdata = (query_kvp_t) pd;
@@ -1793,25 +1793,25 @@ qof_query_printValueForParam (QofQueryPredData *pd, GString * gs)
kvp_value_to_string (pdata->value));
return;
}
if (!safe_strcmp (pd->type_name, QOF_TYPE_INT64))
if (!g_strcmp0 (pd->type_name, QOF_TYPE_INT64))
{
query_int64_t pdata = (query_int64_t) pd;
g_string_append_printf (gs, " int64: %" G_GINT64_FORMAT, pdata->val);
return;
}
if (!safe_strcmp (pd->type_name, QOF_TYPE_INT32))
if (!g_strcmp0 (pd->type_name, QOF_TYPE_INT32))
{
query_int32_t pdata = (query_int32_t) pd;
g_string_append_printf (gs, " int32: %d", pdata->val);
return;
}
if (!safe_strcmp (pd->type_name, QOF_TYPE_DOUBLE))
if (!g_strcmp0 (pd->type_name, QOF_TYPE_DOUBLE))
{
query_double_t pdata = (query_double_t) pd;
g_string_append_printf (gs, " double: %.18g", pdata->val);
return;
}
if (!safe_strcmp (pd->type_name, QOF_TYPE_DATE))
if (!g_strcmp0 (pd->type_name, QOF_TYPE_DATE))
{
query_date_t pdata = (query_date_t) pd;
g_string_append_printf (gs, " Match type %s",
@@ -1819,7 +1819,7 @@ qof_query_printValueForParam (QofQueryPredData *pd, GString * gs)
g_string_append_printf (gs, " query_date: %s", gnc_print_date (pdata->date));
return;
}
if (!safe_strcmp (pd->type_name, QOF_TYPE_CHAR))
if (!g_strcmp0 (pd->type_name, QOF_TYPE_CHAR))
{
query_char_t pdata = (query_char_t) pd;
g_string_append_printf (gs, " Match type %s",
@@ -1827,7 +1827,7 @@ qof_query_printValueForParam (QofQueryPredData *pd, GString * gs)
g_string_append_printf (gs, " char list: %s", pdata->char_list);
return;
}
if (!safe_strcmp (pd->type_name, QOF_TYPE_BOOLEAN))
if (!g_strcmp0 (pd->type_name, QOF_TYPE_BOOLEAN))
{
query_boolean_t pdata = (query_boolean_t) pd;
g_string_append_printf (gs, " boolean: %s", pdata->val ? "TRUE" : "FALSE");

View File

@@ -105,12 +105,12 @@ static GHashTable *predEqualTable = NULL;
#define VERIFY_PDATA(str) { \
g_return_if_fail (pd != NULL); \
g_return_if_fail (pd->type_name == str || \
!safe_strcmp (str, pd->type_name)); \
!g_strcmp0 (str, pd->type_name)); \
}
#define VERIFY_PDATA_R(str) { \
g_return_val_if_fail (pd != NULL, NULL); \
g_return_val_if_fail (pd->type_name == str || \
!safe_strcmp (str, pd->type_name), \
!g_strcmp0 (str, pd->type_name), \
NULL); \
}
#define VERIFY_PREDICATE(str) { \
@@ -118,7 +118,7 @@ static GHashTable *predEqualTable = NULL;
g_return_val_if_fail (getter->param_getfcn != NULL, PREDICATE_ERROR); \
g_return_val_if_fail (pd != NULL, PREDICATE_ERROR); \
g_return_val_if_fail (pd->type_name == str || \
!safe_strcmp (str, pd->type_name), \
!g_strcmp0 (str, pd->type_name), \
PREDICATE_ERROR); \
}
@@ -186,7 +186,7 @@ string_compare_func (gpointer a, gpointer b, gint options,
if (options == QOF_STRING_MATCH_CASEINSENSITIVE)
return safe_strcasecmp (s1, s2);
return safe_strcmp (s1, s2);
return g_strcmp0 (s1, s2);
}
int
@@ -216,7 +216,7 @@ qof_string_number_compare_func (gpointer a, gpointer b, gint options,
if (options == QOF_STRING_MATCH_CASEINSENSITIVE)
return safe_strcasecmp (sr1, sr2);
return safe_strcmp (sr1, sr2);
return g_strcmp0 (sr1, sr2);
}
static void
@@ -253,7 +253,7 @@ string_predicate_equal (const QofQueryPredData *p1, const QofQueryPredData *p2)
if (pd1->options != pd2->options) return FALSE;
if (pd1->is_regex != pd2->is_regex) return FALSE;
return (safe_strcmp (pd1->matchstring, pd2->matchstring) == 0);
return (g_strcmp0 (pd1->matchstring, pd2->matchstring) == 0);
}
QofQueryPredData *
@@ -1170,7 +1170,7 @@ char_predicate_equal (const QofQueryPredData *p1, const QofQueryPredData *p2)
const query_char_t pd2 = (const query_char_t) p2;
if (pd1->options != pd2->options) return FALSE;
return (safe_strcmp (pd1->char_list, pd2->char_list) == 0);
return (g_strcmp0 (pd1->char_list, pd2->char_list) == 0);
}
QofQueryPredData *
@@ -1277,7 +1277,7 @@ kvp_predicate_equal (const QofQueryPredData *p1, const QofQueryPredData *p2)
for ( ; n1 && n2; n1 = n1->next, n2 = n2->next)
{
if (safe_strcmp (n1->data, n2->data) != 0)
if (g_strcmp0 (n1->data, n2->data) != 0)
return FALSE;
}
@@ -1928,7 +1928,7 @@ qof_query_core_predicate_equal (const QofQueryPredData *p1, const QofQueryPredDa
if (!p1 || !p2) return FALSE;
if (p1->how != p2->how) return FALSE;
if (safe_strcmp (p1->type_name, p2->type_name)) return FALSE;
if (g_strcmp0 (p1->type_name, p2->type_name)) return FALSE;
pred_equal = g_hash_table_lookup (predEqualTable, p1->type_name);
g_return_val_if_fail (pred_equal, FALSE);

View File

@@ -71,9 +71,9 @@ entity_set_reference_cb(QofInstance *ent, gpointer user_data)
/* collect and choice handling */
collect_setter = (void(*)(QofInstance*, QofCollection*))ref->param->param_setfcn;
choice_setter = (void(*)(QofInstance*, QofInstance*))ref->param->param_setfcn;
if ((0 == safe_strcmp(ref->param->param_type, QOF_TYPE_COLLECT)) &&
if ((0 == g_strcmp0(ref->param->param_type, QOF_TYPE_COLLECT)) &&
(0 == guid_compare(qof_instance_get_guid(ent), ref->ent_guid)) &&
(0 == safe_strcmp(ref->type, ent->e_type)))
(0 == g_strcmp0(ref->type, ent->e_type)))
{
QofCollection *temp_col;
char cm_sa[GUID_ENCODING_LENGTH + 1];
@@ -97,7 +97,7 @@ entity_set_reference_cb(QofInstance *ent, gpointer user_data)
qof_collection_destroy(temp_col);
}
}
if (0 == safe_strcmp(ref->param->param_type, QOF_TYPE_CHOICE))
if (0 == g_strcmp0(ref->param->param_type, QOF_TYPE_CHOICE))
{
coll = qof_book_get_collection(partial_book, ref->type);
reference = qof_collection_lookup_entity(coll, ref->ref_guid);
@@ -164,7 +164,7 @@ qof_instance_get_reference_from(QofInstance *ent, const QofParam *param)
{
g_return_val_if_fail(param, NULL);
param = qof_class_get_parameter(ent->e_type, param->param_name);
g_return_val_if_fail(0 != safe_strcmp(param->param_type, QOF_TYPE_COLLECT), NULL);
g_return_val_if_fail(0 != g_strcmp0(param->param_type, QOF_TYPE_COLLECT), NULL);
return create_reference(ent, param);
}

View File

@@ -366,7 +366,7 @@ qof_instance_param_cb (QofParam *param, gpointer data)
qecd = (QofInstanceCopyData*)data;
g_return_if_fail (param != NULL);
/* KVP doesn't need a set routine to be copied. */
if (0 == safe_strcmp (param->param_type, QOF_TYPE_KVP))
if (0 == g_strcmp0 (param->param_type, QOF_TYPE_KVP))
{
qecd->param_list = g_slist_prepend (qecd->param_list, param);
return;
@@ -450,7 +450,7 @@ qof_instance_foreach_copy (gpointer data, gpointer user_data)
cm_param = (QofParam*) data;
g_return_if_fail (cm_param != NULL);
context->param = cm_param;
if (safe_strcmp (cm_param->param_type, QOF_TYPE_STRING) == 0)
if (g_strcmp0 (cm_param->param_type, QOF_TYPE_STRING) == 0)
{
cm_string = (gchar*)cm_param->param_getfcn (importEnt, cm_param);
if (cm_string)
@@ -463,7 +463,7 @@ qof_instance_foreach_copy (gpointer data, gpointer user_data)
}
registered_type = TRUE;
}
if (safe_strcmp (cm_param->param_type, QOF_TYPE_DATE) == 0)
if (g_strcmp0 (cm_param->param_type, QOF_TYPE_DATE) == 0)
{
date_getter = (Timespec (*)(QofInstance*, QofParam*))cm_param->param_getfcn;
cm_date = date_getter (importEnt, cm_param);
@@ -474,8 +474,8 @@ qof_instance_foreach_copy (gpointer data, gpointer user_data)
}
registered_type = TRUE;
}
if ((safe_strcmp (cm_param->param_type, QOF_TYPE_NUMERIC) == 0) ||
(safe_strcmp (cm_param->param_type, QOF_TYPE_DEBCRED) == 0))
if ((g_strcmp0 (cm_param->param_type, QOF_TYPE_NUMERIC) == 0) ||
(g_strcmp0 (cm_param->param_type, QOF_TYPE_DEBCRED) == 0))
{
numeric_getter = (gnc_numeric (*)(QofInstance*, QofParam*))cm_param->param_getfcn;
cm_numeric = numeric_getter (importEnt, cm_param);
@@ -486,7 +486,7 @@ qof_instance_foreach_copy (gpointer data, gpointer user_data)
}
registered_type = TRUE;
}
if (safe_strcmp (cm_param->param_type, QOF_TYPE_GUID) == 0)
if (g_strcmp0 (cm_param->param_type, QOF_TYPE_GUID) == 0)
{
cm_guid = (const GncGUID*)cm_param->param_getfcn (importEnt, cm_param);
guid_setter = (void (*)(QofInstance*, const GncGUID*))cm_param->param_setfcn;
@@ -496,7 +496,7 @@ qof_instance_foreach_copy (gpointer data, gpointer user_data)
}
registered_type = TRUE;
}
if (safe_strcmp (cm_param->param_type, QOF_TYPE_INT32) == 0)
if (g_strcmp0 (cm_param->param_type, QOF_TYPE_INT32) == 0)
{
int32_getter = (gint32 (*)(QofInstance*, QofParam*)) cm_param->param_getfcn;
cm_i32 = int32_getter (importEnt, cm_param);
@@ -507,7 +507,7 @@ qof_instance_foreach_copy (gpointer data, gpointer user_data)
}
registered_type = TRUE;
}
if (safe_strcmp (cm_param->param_type, QOF_TYPE_INT64) == 0)
if (g_strcmp0 (cm_param->param_type, QOF_TYPE_INT64) == 0)
{
int64_getter = (gint64 (*)(QofInstance*, QofParam*)) cm_param->param_getfcn;
cm_i64 = int64_getter (importEnt, cm_param);
@@ -518,7 +518,7 @@ qof_instance_foreach_copy (gpointer data, gpointer user_data)
}
registered_type = TRUE;
}
if (safe_strcmp (cm_param->param_type, QOF_TYPE_DOUBLE) == 0)
if (g_strcmp0 (cm_param->param_type, QOF_TYPE_DOUBLE) == 0)
{
double_getter = (double (*)(QofInstance*, QofParam*)) cm_param->param_getfcn;
cm_double = double_getter (importEnt, cm_param);
@@ -529,7 +529,7 @@ qof_instance_foreach_copy (gpointer data, gpointer user_data)
}
registered_type = TRUE;
}
if (safe_strcmp (cm_param->param_type, QOF_TYPE_BOOLEAN) == 0)
if (g_strcmp0 (cm_param->param_type, QOF_TYPE_BOOLEAN) == 0)
{
boolean_getter = (gboolean (*)(QofInstance*, QofParam*)) cm_param->param_getfcn;
cm_boolean = boolean_getter (importEnt, cm_param);
@@ -540,7 +540,7 @@ qof_instance_foreach_copy (gpointer data, gpointer user_data)
}
registered_type = TRUE;
}
if (safe_strcmp (cm_param->param_type, QOF_TYPE_KVP) == 0)
if (g_strcmp0 (cm_param->param_type, QOF_TYPE_KVP) == 0)
{
cm_kvp = (KvpFrame*)cm_param->param_getfcn (importEnt, cm_param);
kvp_frame_setter = (void (*)(QofInstance*, KvpFrame*))cm_param->param_setfcn;
@@ -558,7 +558,7 @@ qof_instance_foreach_copy (gpointer data, gpointer user_data)
}
registered_type = TRUE;
}
if (safe_strcmp (cm_param->param_type, QOF_TYPE_CHAR) == 0)
if (g_strcmp0 (cm_param->param_type, QOF_TYPE_CHAR) == 0)
{
cm_char = (gchar*)cm_param->param_getfcn (importEnt, cm_param);
char_setter = (void (*)(QofInstance*, char*))cm_param->param_setfcn;
@@ -568,7 +568,7 @@ qof_instance_foreach_copy (gpointer data, gpointer user_data)
}
registered_type = TRUE;
}
if (safe_strcmp (cm_param->param_type, QOF_TYPE_COLLECT) == 0)
if (g_strcmp0 (cm_param->param_type, QOF_TYPE_COLLECT) == 0)
{
cm_col = (QofCollection*)cm_param->param_getfcn (importEnt, cm_param);
if (cm_col)
@@ -871,7 +871,7 @@ recurse_ent_cb (QofInstance *ent, gpointer user_data)
{
continue;
}
if (0 == safe_strcmp (ref_param->param_type, QOF_TYPE_COLLECT))
if (0 == g_strcmp0 (ref_param->param_type, QOF_TYPE_COLLECT))
{
QofCollection *col;

View File

@@ -96,29 +96,6 @@ qof_utf8_strcasecmp (const gchar *da, const gchar *db)
return retval;
}
gint
safe_strcmp (const gchar * da, const gchar * db)
{
if ((da) && (db))
{
if ((da) != (db))
{
gint retval = strcmp ((da), (db));
/* if strings differ, return */
if (retval) return retval;
}
}
else if ((!(da)) && (db))
{
return -1;
}
else if ((da) && (!(db)))
{
return +1;
}
return 0;
}
gint
safe_strcasecmp (const gchar * da, const gchar * db)
{

View File

@@ -177,21 +177,6 @@ void g_hash_table_foreach_sorted(GHashTable *hash_table, GHFunc func, gpointer u
* otherwise. */
gboolean qof_utf8_substr_nocase (const gchar *haystack, const gchar *needle);
/** The safe_strcmp compares strings da and db the same way that strcmp()
does, except that either may be null. This routine assumes that
a non-null string is always greater than a null string.
@param da string 1.
@param db string 2.
@return If da == NULL && db != NULL, returns -1.
If da != NULL && db == NULL, returns +1.
If da != NULL && db != NULL, returns the result of
strcmp(da, db).
If da == NULL && db == NULL, returns 0.
*/
gint safe_strcmp (const gchar * da, const gchar * db);
/** case sensitive comparison of strings da and db - either
may be NULL. A non-NULL string is greater than a NULL string.

View File

@@ -207,9 +207,9 @@ gnc_get_default_register_style (GNCAccountType type)
default:
style_string = gnc_gconf_get_string(GCONF_GENERAL_REGISTER,
"default_style", NULL);
if (safe_strcmp(style_string, "journal") == 0)
if (g_strcmp0(style_string, "journal") == 0)
new_style = REG_STYLE_JOURNAL;
else if (safe_strcmp(style_string, "auto_ledger") == 0)
else if (g_strcmp0(style_string, "auto_ledger") == 0)
new_style = REG_STYLE_AUTO_LEDGER;
else
new_style = REG_STYLE_LEDGER;

Some files were not shown because too many files have changed in this diff Show More