diff options
author | midipix <writeonce@midipix.org> | 2016-11-14 14:35:37 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-11-14 14:39:32 -0500 |
commit | f11c1faa5ab033f3b2ba1f6b3cd5f5db454c48ec (patch) | |
tree | 87b8df2c2068e5e4f0fea4d125f787caf4ae934e /src/driver | |
parent | 5a5fa5cd283d214bedb92130f2807abe64643f16 (diff) | |
download | perk-f11c1faa5ab033f3b2ba1f6b3cd5f5db454c48ec.tar.bz2 perk-f11c1faa5ab033f3b2ba1f6b3cd5f5db454c48ec.tar.xz |
libary api: pre-alpha: code maintenance: removed struct pe_io_ctx.
Diffstat (limited to 'src/driver')
-rw-r--r-- | src/driver/pe_amain.c | 10 | ||||
-rw-r--r-- | src/driver/pe_driver_ctx.c | 21 | ||||
-rw-r--r-- | src/driver/pe_unit_ctx.c | 4 |
3 files changed, 5 insertions, 30 deletions
diff --git a/src/driver/pe_amain.c b/src/driver/pe_amain.c index cd345d9..d23e9fe 100644 --- a/src/driver/pe_amain.c +++ b/src/driver/pe_amain.c @@ -46,15 +46,11 @@ static ssize_t pe_version(struct pe_driver_ctx * dctx) verclr[4],verinfo->commit,verclr[5]); } -static ssize_t pe_paragraph_break(const struct pe_driver_ctx * dctx, int * fpara) +static ssize_t pe_paragraph_break(int * fpara) { if (*fpara) { *fpara = 0; - - if (dctx->cctx->ioctx->fdout >= 0) - return write(dctx->cctx->ioctx->fdout,"\n",1); - else - return fputc('\n',stdout); + return fputc('\n',stdout); } else return 0; } @@ -75,7 +71,7 @@ static void pe_perform_unit_actions( } if ((flags & PERK_OUTPUT_IMPORT_LIBS) || (flags & PERK_OUTPUT_IMPORT_SYMS)) { - pe_paragraph_break(dctx,&fpara); + pe_paragraph_break(&fpara); pe_output_import_libraries(dctx,uctx->meta,0); fpara += (uctx->meta->summary.nimplibs > 0); } diff --git a/src/driver/pe_driver_ctx.c b/src/driver/pe_driver_ctx.c index 3622fa8..021a7fb 100644 --- a/src/driver/pe_driver_ctx.c +++ b/src/driver/pe_driver_ctx.c @@ -90,8 +90,7 @@ static struct pe_driver_ctx_impl * pe_driver_ctx_alloc( ictx->ctx.errinfp = &ictx->ctx.erriptr[0]; ictx->ctx.erricap = &ictx->ctx.erriptr[--elements]; - ictx->meta = meta; - ictx->ctx.cctx.ioctx = &ictx->ctx.ioctx; + ictx->meta = meta; for (entry=meta->entries,units=ictx->units; entry->fopt || entry->arg; entry++) if (!entry->fopt) @@ -200,30 +199,12 @@ int pe_get_driver_ctx( ctx->ctx.program = program; ctx->ctx.cctx = &ctx->cctx; - ctx->ioctx.fdout = cctx.output ? fdout : -1; - ctx->ioctx.fdin = -1; - ctx->ioctx.fderr = -1; - ctx->ioctx.fdlog = -1; - ctx->ioctx.fdsrc = AT_FDCWD; - ctx->ioctx.fddst = AT_FDCWD; - ctx->ioctx.fdtmp = AT_FDCWD; - *pctx = &ctx->ctx; return PERK_OK; } -static void pe_driver_close_fds(struct pe_common_ctx * cctx) -{ - if (cctx->ioctx->status && cctx->output) - unlinkat(cctx->ioctx->fddst,cctx->output,0); - - if (cctx->ioctx->fdout >= 0) - close(cctx->ioctx->fdout); -} - static void pe_free_driver_ctx_impl(struct pe_driver_ctx_alloc * ictx) { - pe_driver_close_fds(&ictx->ctx.cctx); argv_free(ictx->meta); free(ictx); } diff --git a/src/driver/pe_unit_ctx.c b/src/driver/pe_unit_ctx.c index b3dae71..26fb8a7 100644 --- a/src/driver/pe_unit_ctx.c +++ b/src/driver/pe_unit_ctx.c @@ -47,7 +47,7 @@ int pe_get_unit_ctx( ? PROT_READ | PROT_WRITE : PROT_READ; - if (pe_map_raw_image(dctx,dctx->cctx->ioctx->fdin,path,prot,&ctx->map)) + if (pe_map_raw_image(dctx,-1,path,prot,&ctx->map)) return pe_free_unit_ctx_impl(ctx, PERK_NESTED_ERROR(dctx)); @@ -56,8 +56,6 @@ int pe_get_unit_ctx( PERK_NESTED_ERROR(dctx)); ctx->path = path; - ctx->ioctx.prot = prot; - ctx->uctx.path = &ctx->path; ctx->uctx.map = &ctx->map; ctx->uctx.meta = ctx->meta; |