mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Simplify function parameters.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15639 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
43277fef39
commit
88456c2b3c
@ -996,20 +996,20 @@ static int revorder[NUM_ACCOUNT_TYPES] = {
|
||||
|
||||
|
||||
int
|
||||
xaccAccountOrder (const Account **aa, const Account **ab)
|
||||
xaccAccountOrder (const Account *aa, const Account *ab)
|
||||
{
|
||||
char *da, *db;
|
||||
char *endptr = NULL;
|
||||
int ta, tb, result;
|
||||
long la, lb;
|
||||
|
||||
if ( (*aa) && !(*ab) ) return -1;
|
||||
if ( !(*aa) && (*ab) ) return +1;
|
||||
if ( !(*aa) && !(*ab) ) return 0;
|
||||
if ( aa && !ab ) return -1;
|
||||
if ( !aa && ab ) return +1;
|
||||
if ( !aa && !ab ) return 0;
|
||||
|
||||
/* sort on accountCode strings */
|
||||
da = (*aa)->accountCode;
|
||||
db = (*ab)->accountCode;
|
||||
da = aa->accountCode;
|
||||
db = ab->accountCode;
|
||||
|
||||
/* If accountCodes are both base 36 integers do an integer sort */
|
||||
la = strtoul (da, &endptr, 36);
|
||||
@ -1036,22 +1036,28 @@ xaccAccountOrder (const Account **aa, const Account **ab)
|
||||
}
|
||||
|
||||
/* otherwise, sort on account type */
|
||||
ta = (*aa)->type;
|
||||
tb = (*ab)->type;
|
||||
ta = aa->type;
|
||||
tb = ab->type;
|
||||
ta = revorder[ta];
|
||||
tb = revorder[tb];
|
||||
if (ta < tb) return -1;
|
||||
if (ta > tb) return +1;
|
||||
|
||||
/* otherwise, sort on accountName strings */
|
||||
da = (*aa)->accountName;
|
||||
db = (*ab)->accountName;
|
||||
da = aa->accountName;
|
||||
db = ab->accountName;
|
||||
result = safe_utf8_collate(da, db);
|
||||
if (result)
|
||||
return result;
|
||||
|
||||
/* guarantee a stable sort */
|
||||
return guid_compare (&((*aa)->inst.entity.guid), &((*ab)->inst.entity.guid));
|
||||
return guid_compare (&(aa->inst.entity.guid), &(ab->inst.entity.guid));
|
||||
}
|
||||
|
||||
static int
|
||||
qof_xaccAccountOrder (const Account **aa, const Account **ab)
|
||||
{
|
||||
return xaccAccountOrder(*aa, *ab);
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
@ -2717,7 +2723,7 @@ gboolean xaccAccountRegister (void)
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
qof_class_register (GNC_ID_ACCOUNT, (QofSortFunc) xaccAccountOrder, params);
|
||||
qof_class_register (GNC_ID_ACCOUNT, (QofSortFunc) qof_xaccAccountOrder, params);
|
||||
|
||||
return qof_object_register (&account_object_def);
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ gboolean xaccAccountEqual(const Account *a, const Account* b,
|
||||
* the account codes are compared, and if these are equal, then
|
||||
* account types, and, if these are equal, the account names.
|
||||
*/
|
||||
int xaccAccountOrder (const Account **account_1, const Account **account_2);
|
||||
int xaccAccountOrder (const Account *account_1, const Account *account_2);
|
||||
|
||||
/** @} */
|
||||
|
||||
|
@ -421,12 +421,9 @@ xaccGroupGetSubAccounts (const AccountGroup *grp)
|
||||
static int
|
||||
group_sort_helper (gconstpointer a, gconstpointer b)
|
||||
{
|
||||
const Account *aa = (const Account *) a;
|
||||
const Account *bb = (const Account *) b;
|
||||
|
||||
/* xaccAccountOrder returns > 1 if aa should come after bb.
|
||||
/* xaccAccountOrder returns > 1 if a should come after b.
|
||||
* This funciton is building a reversed list. */
|
||||
return xaccAccountOrder (&aa, &bb);
|
||||
return xaccAccountOrder ((const Account *) a, (const Account *) b);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -286,7 +286,7 @@ sort_by_string (GtkTreeModel *f_model,
|
||||
result = safe_utf8_collate(str1, str2);
|
||||
if (result != 0)
|
||||
return result;
|
||||
return xaccAccountOrder(&account1, &account2);
|
||||
return xaccAccountOrder(account1, account2);
|
||||
}
|
||||
|
||||
static gint
|
||||
@ -300,7 +300,7 @@ sort_by_code (GtkTreeModel *f_model,
|
||||
sort_cb_setup (f_model, f_iter_a, f_iter_b, &account_a, &account_b);
|
||||
|
||||
/* Default ordering uses this column first. */
|
||||
return xaccAccountOrder(&account_a, &account_b);
|
||||
return xaccAccountOrder(account_a, account_b);
|
||||
}
|
||||
|
||||
static gint
|
||||
@ -325,7 +325,7 @@ sort_by_xxx_value (xaccGetBalanceInCurrencyFn fn,
|
||||
result = gnc_numeric_compare(balance_a, balance_b);
|
||||
if (result != 0)
|
||||
return result;
|
||||
return xaccAccountOrder(&account_a, &account_b);
|
||||
return xaccAccountOrder(account_a, account_b);
|
||||
}
|
||||
|
||||
static gint
|
||||
@ -408,7 +408,7 @@ sort_by_placeholder (GtkTreeModel *f_model,
|
||||
return -1;
|
||||
else if (flag_a < flag_b)
|
||||
return 1;
|
||||
return xaccAccountOrder(&account_a, &account_b);
|
||||
return xaccAccountOrder(account_a, account_b);
|
||||
}
|
||||
|
||||
static gint
|
||||
@ -434,7 +434,7 @@ sort_by_xxx_period_value (GtkTreeModel *f_model,
|
||||
result = gnc_numeric_compare(b1, b2);
|
||||
if (result != 0)
|
||||
return result;
|
||||
return xaccAccountOrder((const Account **)&acct1, (const Account **)&acct2);
|
||||
return xaccAccountOrder(acct1, acct2);
|
||||
}
|
||||
|
||||
static gint
|
||||
|
Loading…
Reference in New Issue
Block a user