summaryrefslogtreecommitdiff
path: root/src/output
diff options
context:
space:
mode:
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;
}