4 #include <libelfu/libelfu.h>
8 * Allocation, destruction
11 ElfuElf* elfu_mElfAlloc()
15 me = malloc(sizeof(ElfuElf));
17 ELFU_WARN("mElfAlloc: malloc() failed for ElfuElf.\n");
21 memset(me, 0, sizeof(*me));
23 CIRCLEQ_INIT(&me->phdrList);
24 CIRCLEQ_INIT(&me->orphanScnList);
30 void elfu_mElfDestroy(ElfuElf* me)
37 CIRCLEQ_INIT(&me->phdrList);
38 CIRCLEQ_INIT(&me->orphanScnList);
40 CIRCLEQ_FOREACH(mp, &me->phdrList, elem) {
41 CIRCLEQ_REMOVE(&me->phdrList, mp, elem);
42 elfu_mPhdrDestroy(mp);
45 CIRCLEQ_FOREACH(ms, &me->orphanScnList, elem) {
46 CIRCLEQ_REMOVE(&me->orphanScnList, ms, elem);