Skip to content

Commit

Permalink
Add some missing log Macros for the price model
Browse files Browse the repository at this point in the history
Add some missing LEAVE macro statements so the log entries do not get
longer and longer.
  • Loading branch information
Bob-IT committed Apr 26, 2019
1 parent af96c74 commit 9f0558f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
15 changes: 12 additions & 3 deletions gnucash/gnome-utils/gnc-tree-model-price.c
Expand Up @@ -219,6 +219,8 @@ gnc_tree_model_price_new (QofBook *book, GNCPriceDB *price_db)
GncTreeModelPricePrivate *priv;
const GList *item;

ENTER(" ");

item = gnc_gobject_tracking_get_list(GNC_TREE_MODEL_PRICE_NAME);
for ( ; item; item = g_list_next(item))
{
Expand All @@ -232,8 +234,7 @@ gnc_tree_model_price_new (QofBook *book, GNCPriceDB *price_db)
}
}

model = g_object_new (GNC_TYPE_TREE_MODEL_PRICE,
NULL);
model = g_object_new (GNC_TYPE_TREE_MODEL_PRICE, NULL);

priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
priv->book = book;
Expand All @@ -242,6 +243,7 @@ gnc_tree_model_price_new (QofBook *book, GNCPriceDB *price_db)
priv->event_handler_id =
qof_event_register_handler (gnc_tree_model_price_event_handler, model);

LEAVE("returning new model %p", model);
return GTK_TREE_MODEL (model);
}

Expand Down Expand Up @@ -1244,7 +1246,7 @@ gnc_tree_model_price_get_iter_from_commodity (GncTreeModelPrice *model,
n = g_list_index(list, commodity);
if (n == -1)
{
LEAVE("not in list");
LEAVE("commodity not in list");
return FALSE;
}

Expand Down Expand Up @@ -1280,11 +1282,17 @@ gnc_tree_model_price_get_iter_from_namespace (GncTreeModelPrice *model,
ct = qof_book_get_data (priv->book, GNC_COMMODITY_TABLE);
list = gnc_commodity_table_get_namespaces_list(ct);
if (list == NULL)
{
LEAVE("namespace list empty");
return FALSE;
}

n = g_list_index(list, name_space);
if (n == -1)
{
LEAVE("namespace not found");
return FALSE;
}

iter->stamp = model->stamp;
iter->user_data = ITER_IS_NAMESPACE;
Expand Down Expand Up @@ -1596,6 +1604,7 @@ gnc_tree_model_price_event_handler (QofInstance *entity,
}
else
{
LEAVE(" ");
return;
}

Expand Down
20 changes: 13 additions & 7 deletions libgnucash/engine/gnc-pricedb.c
Expand Up @@ -309,18 +309,19 @@ gnc_price_create (QofBook *book)

g_return_val_if_fail (book, NULL);

ENTER(" ");
p = g_object_new(GNC_TYPE_PRICE, NULL);

qof_instance_init_data (&p->inst, GNC_ID_PRICE, book);
qof_event_gen (&p->inst, QOF_EVENT_CREATE, NULL);

LEAVE ("price created %p", p);
return p;
}

static void
gnc_price_destroy (GNCPrice *p)
{
ENTER(" ");
ENTER("destroy price %p", p);
qof_event_gen (&p->inst, QOF_EVENT_DESTROY, NULL);

if (p->type) CACHE_REMOVE(p->type);
Expand Down Expand Up @@ -372,14 +373,14 @@ gnc_price_clone (GNCPrice* p, QofBook *book)

if (!p)
{
LEAVE (" ");
LEAVE ("return NULL");
return NULL;
}

new_p = gnc_price_create(book);
if (!new_p)
{
LEAVE (" ");
LEAVE ("return NULL");
return NULL;
}

Expand All @@ -394,7 +395,7 @@ gnc_price_clone (GNCPrice* p, QofBook *book)
gnc_price_set_value(new_p, gnc_price_get_value(p));
gnc_price_set_currency(new_p, gnc_price_get_currency(p));
gnc_price_commit_edit(new_p);
LEAVE (" ");
LEAVE ("return cloned price %p", new_p);
return(new_p);
}

Expand Down Expand Up @@ -1801,7 +1802,7 @@ GNCPrice *gnc_pricedb_lookup_latest(GNCPriceDB *db,
result = price_list->data;
gnc_price_ref(result);
g_list_free (price_list);
LEAVE(" ");
LEAVE("price is %p", result);
return result;
}

Expand Down Expand Up @@ -2202,7 +2203,11 @@ gnc_pricedb_nth_price (GNCPriceDB *db,
ENTER ("db=%p commodity=%s index=%d", db, gnc_commodity_get_mnemonic(c), n);

if (last_c && prices && last_c == c)
return g_list_nth_data (prices, n);
{
result = g_list_nth_data (prices, n);
LEAVE ("price=%p", result);
return result;
}

last_c = c;

Expand Down Expand Up @@ -2255,6 +2260,7 @@ gnc_pricedb_lookup_at_time64(GNCPriceDB *db,
{
gnc_price_ref(p);
g_list_free (price_list);
LEAVE("price is %p", p);
return p;
}
item = item->next;
Expand Down

0 comments on commit 9f0558f

Please sign in to comment.