diff options
author | norly <ny-git@enpas.org> | 2013-02-22 18:35:12 +0000 |
---|---|---|
committer | norly <ny-git@enpas.org> | 2013-02-22 18:35:12 +0000 |
commit | 7b04e102bb2ad0189f66d4878fe92d6fa22a1990 (patch) | |
tree | 60726daa2d83a2aac9acdaca76da081a2b8a6fd1 | |
parent | c2fa58cbd584e835f0c53c95469fde5a699a6396 (diff) |
Use CIRCLEQ_FOREACH throughout
-rw-r--r-- | src/model/count.c | 8 | ||||
-rw-r--r-- | src/model/toFile.c | 16 |
2 files changed, 6 insertions, 18 deletions
diff --git a/src/model/count.c b/src/model/count.c index 02f6a33..d42f806 100644 --- a/src/model/count.c +++ b/src/model/count.c @@ -8,9 +8,7 @@ size_t elfu_countSections(ElfuElf *me) ElfuScn *ms; size_t i = 0; - for (ms = me->scnList.cqh_first; - ms != (void *)&me->scnList; - ms = ms->elem.cqe_next) { + CIRCLEQ_FOREACH(ms, &me->scnList, elem) { i++; } @@ -23,9 +21,7 @@ size_t elfu_countPHDRs(ElfuElf *me) ElfuPhdr *mp; size_t i = 0; - for (mp = me->phdrList.cqh_first; - mp != (void *)&me->phdrList; - mp = mp->elem.cqe_next) { + CIRCLEQ_FOREACH(mp, &me->phdrList, elem) { i++; } diff --git a/src/model/toFile.c b/src/model/toFile.c index 294cfe4..399c25b 100644 --- a/src/model/toFile.c +++ b/src/model/toFile.c @@ -15,9 +15,7 @@ static void elfu_modelToPhdrs(ElfuElf *me, Elf *e) /* Count PHDRs */ i = 0; - for (mp = me->phdrList.cqh_first; - mp != (void *)&me->phdrList; - mp = mp->elem.cqe_next) { + CIRCLEQ_FOREACH(mp, &me->phdrList, elem) { i++; } @@ -27,9 +25,7 @@ static void elfu_modelToPhdrs(ElfuElf *me, Elf *e) /* Copy PHDRs */ i = 0; - for (mp = me->phdrList.cqh_first; - mp != (void *)&me->phdrList; - mp = mp->elem.cqe_next) { + CIRCLEQ_FOREACH(mp, &me->phdrList, elem) { if (!gelf_update_phdr (e, i, &mp->phdr)) { fprintf(stderr, "gelf_update_phdr() failed: %s\n", elf_errmsg(-1)); } @@ -59,9 +55,7 @@ static void elfu_modelToSection(ElfuScn *ms, Elf *e) /* Data */ ElfuData *md; - for (md = ms->dataList.cqh_first; - md != (void *)&ms->dataList; - md = md->elem.cqe_next) { + CIRCLEQ_FOREACH(md, &ms->dataList, elem) { Elf_Data *dataOut = elf_newdata(scnOut); if (!dataOut) { fprintf(stderr, "elf_newdata() failed: %s\n", elf_errmsg(-1)); @@ -100,9 +94,7 @@ void elfu_modelToElf(ElfuElf *me, Elf *e) /* Sections */ - for (ms = me->scnList.cqh_first; - ms != (void *)&me->scnList; - ms = ms->elem.cqe_next) { + CIRCLEQ_FOREACH(ms, &me->scnList, elem) { elfu_modelToSection(ms, e); } |