summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2015-12-06 08:56:34 -0500
committermidipix <writeonce@midipix.org>2016-11-10 23:35:31 -0500
commitb5c6e6b6969328711658c248d0725f543573939e (patch)
treeb4ba9239f9bb1a301fe7889a2a4e15e0df85a44b
parent85119ef1e354b05d1c8fdc7876bc83c8c1375082 (diff)
downloadperk-b5c6e6b6969328711658c248d0725f543573939e.tar.bz2
perk-b5c6e6b6969328711658c248d0725f543573939e.tar.xz
API redesign 9/10: struct pe_image_summary: elegance.
-rw-r--r--include/perk/perk.h6
-rw-r--r--src/logic/pe_get_image_meta.c8
-rw-r--r--src/output/pe_output_import_libraries.c4
-rw-r--r--src/perk.c4
4 files changed, 11 insertions, 11 deletions
diff --git a/include/perk/perk.h b/include/perk/perk.h
index 536e4c8..9e4b035 100644
--- a/include/perk/perk.h
+++ b/include/perk/perk.h
@@ -52,9 +52,9 @@ struct pe_raw_image {
};
struct pe_image_summary {
- uint32_t num_of_export_syms;
- uint32_t num_of_implibs;
- uint32_t num_of_relocs;
+ uint32_t nexpsyms;
+ uint32_t nimplibs;
+ uint32_t nrelocs;
};
struct pe_image_meta {
diff --git a/src/logic/pe_get_image_meta.c b/src/logic/pe_get_image_meta.c
index acf377f..78b8b91 100644
--- a/src/logic/pe_get_image_meta.c
+++ b/src/logic/pe_get_image_meta.c
@@ -11,7 +11,7 @@ static int pe_free_image_meta_impl(struct pe_image_meta * meta, int status)
unsigned i;
if (meta) {
- for (i=0; i<meta->summary.num_of_implibs; i++)
+ for (i=0; i<meta->summary.nimplibs; i++)
free(meta->idata[i].items);
free(meta->idata);
@@ -124,13 +124,13 @@ int pe_get_image_meta(const struct pe_raw_image * image, struct pe_image_meta **
if (m->aidata) {
/* num of implibs */
- for (pidata=m->aidata; pidata->name_rva[0]; pidata++,m->summary.num_of_implibs++);
+ for (pidata=m->aidata; pidata->name_rva[0]; pidata++,m->summary.nimplibs++);
/* import headers */
- if (!(m->idata = calloc(m->summary.num_of_implibs,sizeof(*(m->idata)))))
+ if (!(m->idata = calloc(m->summary.nimplibs,sizeof(*(m->idata)))))
return pe_free_image_meta_impl(m,status);
- for (i=0; i<m->summary.num_of_implibs; i++) {
+ for (i=0; i<m->summary.nimplibs; i++) {
pe_read_import_header(&m->aidata[i],&m->idata[i]);
m->idata[i].name = base + m->hidata->ptr_to_raw_data
diff --git a/src/output/pe_output_import_libraries.c b/src/output/pe_output_import_libraries.c
index 9a83780..be46d1f 100644
--- a/src/output/pe_output_import_libraries.c
+++ b/src/output/pe_output_import_libraries.c
@@ -43,7 +43,7 @@ int pe_output_import_libraries(
FILE * ftmp;
int i,j;
- if (!m->summary.num_of_implibs)
+ if (!m->summary.nimplibs)
return 0;
if (!(fout = pe_output_prolog(cctx,fout,&ftmp)))
@@ -52,7 +52,7 @@ int pe_output_import_libraries(
if ((pretty_header(cctx,fout)) < 0)
return pe_output_epilog(-1,ftmp);
- for (i=0; i<m->summary.num_of_implibs; i++) {
+ for (i=0; i<m->summary.nimplibs; i++) {
if ((pretty_implib_header(cctx,m->idata[i].name,fout)) < 0)
return pe_output_epilog(-1,ftmp);
diff --git a/src/perk.c b/src/perk.c
index 993478c..00a44b1 100644
--- a/src/perk.c
+++ b/src/perk.c
@@ -43,14 +43,14 @@ static void perk_perform_unit_actions(struct pe_unit_ctx * uctx)
if (flags & PERK_OUTPUT_EXPORT_SYMS) {
uctx->status = pe_output_export_symbols(uctx->meta,uctx->cctx,0);
uctx->nerrors += !!uctx->status;
- fpara += uctx->meta->summary.num_of_export_syms;
+ fpara += uctx->meta->summary.nexpsyms;
}
if ((flags & PERK_OUTPUT_IMPORT_LIBS) || (flags & PERK_OUTPUT_IMPORT_SYMS)) {
perk_paragraph_break(uctx,&fpara);
uctx->status = pe_output_import_libraries(uctx->meta,uctx->cctx,0);
uctx->nerrors += !!uctx->status;
- fpara += (uctx->meta->summary.num_of_implibs > 0);
+ fpara += (uctx->meta->summary.nimplibs > 0);
}
}