summaryrefslogtreecommitdiff
path: root/src/model/section-by-type.c
blob: e36865a7ed3a42172c07ba99515ecbb5e05a9a24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <assert.h>
#include <libelf/gelf.h>
#include <libelfu/libelfu.h>


/*
 * Returns the first section with the given type.
 */
ElfuScn* elfu_mScnByType(ElfuElf *me, Elf32_Word type)
{
  ElfuScn *ms;

  assert(me);

  CIRCLEQ_FOREACH(ms, &me->scnList, elem) {
    if (ms->shdr.sh_type == type) {
      return ms;
    }
  }

  return NULL;
}