Move section-in-segment.c to generic/
[centaur.git] / src / elfops / section-in-segment.c
index e12720ff0093e72e16914fe463da6a50504485ad..185da364e3fad08ea0ac33a286ad0384ba1f8cb1 100644 (file)
@@ -1,8 +1,7 @@
-#include <stdio.h>
 #include <stdlib.h>
 
-#include <libelf.h>
-#include <gelf.h>
+#include <libelf/libelf.h>
+#include <libelf/gelf.h>
 
 #include <libelfu/libelfu.h>
 
@@ -13,7 +12,7 @@
  *
  * If no section fits, NULL is returned.
  */
-Elf_Scn* elfu_firstSectionInSegment(Elf *e, GElf_Phdr *phdr)
+Elf_Scn* elfu_eScnFirstInSegment(Elf *e, GElf_Phdr *phdr)
 {
   Elf_Scn *scn;
 
@@ -26,7 +25,7 @@ Elf_Scn* elfu_firstSectionInSegment(Elf *e, GElf_Phdr *phdr)
     }
 
     if (shdr.sh_offset == phdr->p_offset
-        && elfu_segmentContainsSection(phdr, &shdr)) {
+        && elfu_gPhdrContainsScn(phdr, &shdr)) {
       return scn;
     }
 
@@ -45,7 +44,7 @@ Elf_Scn* elfu_firstSectionInSegment(Elf *e, GElf_Phdr *phdr)
  *
  * If no section fits, NULL is returned.
  */
-Elf_Scn* elfu_lastSectionInSegment(Elf *e, GElf_Phdr *phdr)
+Elf_Scn* elfu_eScnLastInSegment(Elf *e, GElf_Phdr *phdr)
 {
   Elf_Scn *last = NULL;
   Elf_Scn *scn;
@@ -56,11 +55,11 @@ Elf_Scn* elfu_lastSectionInSegment(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_segmentContainsSection(phdr, &shdr)) {
+    if (elfu_gPhdrContainsScn(phdr, &shdr)) {
       if (!last) {
         last = scn;
       } else {