genlist_example_04/05.c: initialize pointer variables and check null.

This removes build warnings.
This commit is contained in:
Daniel Juyung Seo 2013-11-20 10:44:07 +09:00
parent 674287da50
commit fc48b1bf7a
2 changed files with 5 additions and 4 deletions

View File

@ -300,7 +300,7 @@ elm_main(int argc, char **argv)
for (i = 0; i < N_ITEMS; i++)
{
Elm_Object_Item *gli, *glg;
Elm_Object_Item *gli = NULL, *glg = NULL;
if (i % 7 == 0)
{

View File

@ -370,14 +370,14 @@ elm_main(int argc, char **argv)
for (i = 0; i < N_ITEMS; i++)
{
Elm_Object_Item *gli, *glg;
Elm_Object_Item *gli = NULL, *glg = NULL;
Node_Data *data = malloc(sizeof(*data)); // data for this item
data->children = NULL;
data->value = i;
data->favorite = EINA_FALSE;
nitems++;
Node_Data *pdata; // data for the parent of the group
Node_Data *pdata = NULL; // data for the parent of the group
printf("creating item: #%d\n", data->value);
if (i % 3 == 0)
@ -394,7 +394,8 @@ elm_main(int argc, char **argv)
gli = elm_genlist_item_append(list, _itc, data, glg,
ELM_GENLIST_ITEM_NONE,
_item_sel_cb, NULL);
pdata->children = eina_list_append(pdata->children, data);
if (pdata)
pdata->children = eina_list_append(pdata->children, data);
data->level = 1;
}
}