summaryrefslogtreecommitdiffhomepage
path: root/src/output
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-11-14 14:35:37 -0500
committermidipix <writeonce@midipix.org>2016-11-14 14:39:32 -0500
commitf11c1faa5ab033f3b2ba1f6b3cd5f5db454c48ec (patch)
tree87b8df2c2068e5e4f0fea4d125f787caf4ae934e /src/output
parent5a5fa5cd283d214bedb92130f2807abe64643f16 (diff)
downloadperk-f11c1faa5ab033f3b2ba1f6b3cd5f5db454c48ec.tar.bz2
perk-f11c1faa5ab033f3b2ba1f6b3cd5f5db454c48ec.tar.xz
libary api: pre-alpha: code maintenance: removed struct pe_io_ctx.
Diffstat (limited to 'src/output')
-rw-r--r--src/output/pe_output_export_symbols.c16
-rw-r--r--src/output/pe_output_image_type.c18
-rw-r--r--src/output/pe_output_import_libraries.c20
3 files changed, 16 insertions, 38 deletions
diff --git a/src/output/pe_output_export_symbols.c b/src/output/pe_output_export_symbols.c
index d47cb7a..ee48b0e 100644
--- a/src/output/pe_output_export_symbols.c
+++ b/src/output/pe_output_export_symbols.c
@@ -12,7 +12,6 @@
#include <perk/perk.h>
#include <perk/perk_output.h>
-#include "perk_output_impl.h"
#include "perk_errinfo_impl.h"
static int pretty_header(const struct pe_common_ctx * cctx, FILE * fout)
@@ -37,7 +36,6 @@ int pe_output_export_symbols(
const struct pe_image_meta * m,
FILE * fout)
{
- FILE * ftmp;
uint32_t offset;
uint32_t * symrva;
unsigned i;
@@ -46,13 +44,11 @@ int pe_output_export_symbols(
if (!m->hedata)
return 0;
- if (!(fout = pe_output_prolog(cctx,fout,&ftmp)))
- return PERK_SYSTEM_ERROR(dctx);
+ if (!fout)
+ fout = stdout;
if ((pretty_header(cctx,fout)) < 0)
- return pe_output_epilog(
- PERK_FILE_ERROR(dctx),
- ftmp);
+ return PERK_FILE_ERROR(dctx);
offset = m->hedata->virtual_addr - m->hedata->ptr_to_raw_data;
symrva = (uint32_t *)((uintptr_t)m->image.addr + (m->edata.name_ptr_rva - offset));
@@ -62,9 +58,7 @@ int pe_output_export_symbols(
cctx,
(char *)((uintptr_t)m->image.addr + symrva[i] - offset),
fout)) < 0)
- return pe_output_epilog(
- PERK_FILE_ERROR(dctx),
- ftmp);
+ return PERK_FILE_ERROR(dctx);
- return pe_output_epilog(0,ftmp);
+ return 0;
}
diff --git a/src/output/pe_output_image_type.c b/src/output/pe_output_image_type.c
index 15bcabc..1d0ff59 100644
--- a/src/output/pe_output_image_type.c
+++ b/src/output/pe_output_image_type.c
@@ -13,7 +13,6 @@
#include <perk/perk.h>
#include <perk/perk_output.h>
-#include "perk_output_impl.h"
#include "perk_errinfo_impl.h"
static const char const * pe_subsystem_name[0x10] = {
@@ -141,11 +140,8 @@ int pe_output_image_type(
const struct pe_unit_ctx * uctx,
FILE * fout)
{
- FILE * ftmp;
- const struct pe_common_ctx * cctx = dctx->cctx;
-
- if (!(fout = pe_output_prolog(cctx,fout,&ftmp)))
- return PERK_SYSTEM_ERROR(dctx);
+ if (!fout)
+ fout = stdout;
if (dctx->cctx->fmtflags & PERK_PRETTY_YAML) {
if (fprintf(fout,"%s:\n- %s:\n- %s:\n- %s:\n- %s:\n",
@@ -154,19 +150,15 @@ int pe_output_image_type(
pretty_type(uctx),
pretty_subsystem(uctx),
pretty_framework(uctx)) < 0)
- return pe_output_epilog(
- PERK_FILE_ERROR(dctx),
- ftmp);
+ return PERK_FILE_ERROR(dctx);
} else {
if (fprintf(fout,"%s-%s-%s-%s\n",
pretty_abi(uctx),
pretty_type(uctx),
pretty_subsystem(uctx),
pretty_framework(uctx)) < 0)
- return pe_output_epilog(
- PERK_FILE_ERROR(dctx),
- ftmp);
+ return PERK_FILE_ERROR(dctx);
}
- return pe_output_epilog(0,ftmp);
+ return 0;
}
diff --git a/src/output/pe_output_import_libraries.c b/src/output/pe_output_import_libraries.c
index 95920ab..54b7b48 100644
--- a/src/output/pe_output_import_libraries.c
+++ b/src/output/pe_output_import_libraries.c
@@ -12,7 +12,6 @@
#include <perk/perk.h>
#include <perk/perk_output.h>
-#include "perk_output_impl.h"
#include "perk_errinfo_impl.h"
static int pretty_header(const struct pe_common_ctx * cctx, FILE * fout)
@@ -47,7 +46,6 @@ int pe_output_import_libraries(
const struct pe_image_meta * m,
FILE * fout)
{
- FILE * ftmp;
int i;
unsigned j;
const struct pe_common_ctx * cctx = dctx->cctx;
@@ -55,19 +53,15 @@ int pe_output_import_libraries(
if (!m->summary.nimplibs)
return 0;
- if (!(fout = pe_output_prolog(cctx,fout,&ftmp)))
- return PERK_SYSTEM_ERROR(dctx);
+ if (!fout)
+ fout = stdout;
if ((pretty_header(cctx,fout)) < 0)
- return pe_output_epilog(
- PERK_FILE_ERROR(dctx),
- ftmp);
+ return PERK_FILE_ERROR(dctx);
for (i=0; i<m->summary.nimplibs; i++) {
if ((pretty_implib_header(cctx,m->idata[i].name,fout)) < 0)
- return pe_output_epilog(
- PERK_FILE_ERROR(dctx),
- ftmp);
+ return PERK_FILE_ERROR(dctx);
if (cctx->fmtflags & PERK_OUTPUT_IMPORT_SYMS)
for (j=0; j<m->idata[i].count; j++)
@@ -76,10 +70,8 @@ int pe_output_import_libraries(
cctx,
m->idata[i].items[j].name,
fout)) < 0)
- return pe_output_epilog(
- PERK_FILE_ERROR(dctx),
- ftmp);
+ return PERK_FILE_ERROR(dctx);
}
- return pe_output_epilog(0,ftmp);
+ return 0;
}