mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[gnc-budget] gnc_budget_get_account_period_note returns a const
to harmonize with all other char getters
This commit is contained in:
@@ -644,13 +644,13 @@ gnc_budget_set_account_period_note(GncBudget *budget, const Account *account,
|
||||
|
||||
}
|
||||
|
||||
gchar *
|
||||
const gchar *
|
||||
gnc_budget_get_account_period_note (const GncBudget *budget,
|
||||
const Account *account, guint period_num)
|
||||
{
|
||||
g_return_val_if_fail (period_num < GET_PRIVATE(budget)->num_periods, nullptr);
|
||||
auto& data = get_perioddata (budget, account, period_num);
|
||||
return data.note.empty () ? nullptr : g_strdup (data.note.c_str());
|
||||
return data.note.empty () ? nullptr : data.note.c_str();
|
||||
}
|
||||
|
||||
time64
|
||||
|
||||
@@ -161,11 +161,10 @@ gnc_numeric gnc_budget_get_account_period_value(
|
||||
gnc_numeric gnc_budget_get_account_period_actual_value(
|
||||
const GncBudget *budget, Account *account, guint period_num);
|
||||
|
||||
/* get/set the budget account period's note, beware when retrieving
|
||||
the period note, the latter must be g_freed by the caller */
|
||||
/* get/set the budget account period's note */
|
||||
void gnc_budget_set_account_period_note(GncBudget *budget,
|
||||
const Account *account, guint period_num, const gchar *note);
|
||||
gchar *gnc_budget_get_account_period_note (const GncBudget *budget,
|
||||
const gchar *gnc_budget_get_account_period_note (const GncBudget *budget,
|
||||
const Account *account, guint period_num);
|
||||
|
||||
/* Returns some budget in the book, or NULL. */
|
||||
|
||||
@@ -78,7 +78,7 @@ test_gnc_set_budget_num_periods_data_retention ()
|
||||
QofBook *book = qof_book_new();
|
||||
GncBudget* budget = gnc_budget_new(book);
|
||||
Account *acc = gnc_account_create_root(book);
|
||||
gchar *note;
|
||||
const gchar *note;
|
||||
|
||||
/* initially has 20 periods */
|
||||
gnc_budget_set_num_periods(budget, 20);
|
||||
@@ -100,7 +100,6 @@ test_gnc_set_budget_num_periods_data_retention ()
|
||||
g_assert (!gnc_budget_is_account_period_value_set(budget, acc, 15));
|
||||
note = gnc_budget_get_account_period_note (budget, acc, 11);
|
||||
g_assert_cmpstr (note, ==, NULL);
|
||||
g_free (note);
|
||||
|
||||
gnc_budget_destroy(budget);
|
||||
qof_book_destroy(book);
|
||||
|
||||
Reference in New Issue
Block a user