summaryrefslogtreecommitdiff
path: root/src/model/count.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/model/count.c')
-rw-r--r--src/model/count.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/model/count.c b/src/model/count.c
index b7c8013..671767e 100644
--- a/src/model/count.c
+++ b/src/model/count.c
@@ -3,6 +3,26 @@
#include <libelfu/libelfu.h>
+size_t elfu_mScnIndex(ElfuElf *me, ElfuScn *ms)
+{
+ ElfuScn *ms2;
+ size_t i = 1;
+
+ assert(me);
+ assert(ms);
+
+ CIRCLEQ_FOREACH(ms2, &me->scnList, elem) {
+ if (ms2 == ms) {
+ return i;
+ }
+
+ i++;
+ }
+
+ /* Section is not in ELF model. This means the calling code is broken. */
+ assert(0);
+}
+
/* NULL section is not counted! */
size_t elfu_mCountScns(ElfuElf *me)