e36865a7ed3a42172c07ba99515ecbb5e05a9a24
[centaur.git] / src / model / section-by-type.c
1 #include <assert.h>
2 #include <libelf/gelf.h>
3 #include <libelfu/libelfu.h>
4
5
6 /*
7  * Returns the first section with the given type.
8  */
9 ElfuScn* elfu_mScnByType(ElfuElf *me, Elf32_Word type)
10 {
11   ElfuScn *ms;
12
13   assert(me);
14
15   CIRCLEQ_FOREACH(ms, &me->scnList, elem) {
16     if (ms->shdr.sh_type == type) {
17       return ms;
18     }
19   }
20
21   return NULL;
22 }