genlist_example_04/05.c: initialize pointer variables and check null.
authorDaniel Juyung Seo <seojuyung2@gmail.com>
Wed, 20 Nov 2013 01:44:07 +0000 (10:44 +0900)
committerDaniel Juyung Seo <seojuyung2@gmail.com>
Wed, 20 Nov 2013 01:46:10 +0000 (10:46 +0900)
This removes build warnings.

legacy/elementary/src/examples/genlist_example_04.c
legacy/elementary/src/examples/genlist_example_05.c

index 090c9d0..e62dde2 100644 (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)
           {
index 7f1b095..03ac142 100644 (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;
           }
      }