summaryrefslogtreecommitdiff
path: root/legacy/ecore/examples/list_destroy_example.c
blob: ccf00ffd3472ae525dcc9d6c00598227aa931f2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <Ecore_Data.h>

void alloc_data (Ecore_List *list) {
  ecore_list_append(list, strdup("first"));
  ecore_list_append(list, strdup("second"));
  ecore_list_append(list, strdup("third"));
}

void destroy_cb (void *data) {
  printf("Destroying \"%s\".\n", (char *)data);
  free(data);
}

int main (int argc, char *argv[]) {
  Ecore_List *list;

  list = ecore_list_new();
  alloc_data(list);
  ecore_list_set_free_cb(list, destroy_cb);
  ecore_list_destroy(list);

  return 0;
}