mv main.c -> elfucli.c, make it scriptable via args
[centaur.git] / src / elfops / section-in-segment.c
index cb625141d8eaa5c2d3448f4dfb2fb47f67be38f4..7e6206b812cda5b79cdf4d79d23d31852b523bcb 100644 (file)
@@ -1,9 +1,4 @@
-#include <stdio.h>
 #include <stdlib.h>
-
-#include <libelf.h>
-#include <gelf.h>
-
 #include <libelfu/libelfu.h>
 
 
@@ -26,7 +21,7 @@ Elf_Scn* elfu_eScnFirstInSegment(Elf *e, GElf_Phdr *phdr)
     }
 
     if (shdr.sh_offset == phdr->p_offset
-        && elfu_ePhdrContainsScn(phdr, &shdr)) {
+        && PHDR_CONTAINS_SCN_IN_MEMORY(phdr, &shdr)) {
       return scn;
     }
 
@@ -56,11 +51,11 @@ Elf_Scn* elfu_eScnLastInSegment(Elf *e, GElf_Phdr *phdr)
     GElf_Shdr shdr;
 
     if (gelf_getshdr(scn, &shdr) != &shdr) {
-      fprintf(stderr, "gelf_getshdr() failed: %s\n", elf_errmsg(-1));
+      ELFU_WARNELF("gelf_getshdr");
       continue;
     }
 
-    if (elfu_ePhdrContainsScn(phdr, &shdr)) {
+    if (PHDR_CONTAINS_SCN_IN_MEMORY(phdr, &shdr)) {
       if (!last) {
         last = scn;
       } else {