Hello,

During my work with code I have found two places in the code that I would
like to ask about - can you please take a look? The code is from repo's
head:

1. file.c:324
int parent_type = VIK_LAYER(stack->data)->type;
if ( ( ! stack->data ) || ((parent_type != VIK_LAYER_AGGREGATE) &&
(parent_type != VIK_LAYER_GPS)) )

In second line we test if stack->data is NULL, but in first line we
dereference the stack->data pointer, which may be NULL. I'm no expert on
gobjects, but I suspect that this dereferencing of potentially NULL pointer
(before testing it) may be risky.


2. vikaggregatelayer.c/aggregate_layer_search_date():557
if ( !found ) {
   // Reset and try on Waypoints
   gl = NULL;
   gl = vik_aggregate_layer_get_all_layers_of_type ( val, gl,
VIK_LAYER_TRW, TRUE );

Is the "reset" of gl and a second execution of
vik_aggregate_layer_get_all_layers_of_type() (which may be time consuming)
necessary? Would it be possible to save some time and re-use gl (or
previously stored copy of gl)?

Best regards,
Kamil
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Viking-devel mailing list
Viking-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/viking-devel
Viking home page: http://viking.sf.net/

Reply via email to