summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-07-11 13:05:40 (GMT)
committermidipix <writeonce@midipix.org>2018-07-11 13:35:43 (GMT)
commitb5fcb346edd0b22ff4a53dec6c3cb7ed3708de74 (patch)
tree016c9f0dcaab5cfea4f9fb6236f16556278f56d3
parent4127b548161e64d97082a95c8b2571ed9686a646 (diff)
downloadslibtool-b5fcb346ed.tar.bz2
slibtool-b5fcb346ed.tar.xz
slbt_exec_compile(): refactor for elegance.
-rw-r--r--src/logic/slbt_exec_compile.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/logic/slbt_exec_compile.c b/src/logic/slbt_exec_compile.c
index f3d3b48..70d44fd 100644
--- a/src/logic/slbt_exec_compile.c
+++ b/src/logic/slbt_exec_compile.c
@@ -34,11 +34,12 @@ int slbt_exec_compile(
const struct slbt_driver_ctx * dctx,
struct slbt_exec_ctx * ectx)
{
- int ret;
- struct slbt_exec_ctx * actx = 0;
+ int ret;
+ struct slbt_exec_ctx * actx = 0;
+ const struct slbt_common_ctx * cctx = dctx->cctx;
/* dry run */
- if (dctx->cctx->drvflags & SLBT_DRIVER_DRY_RUN)
+ if (cctx->drvflags & SLBT_DRIVER_DRY_RUN)
return 0;
/* context */
@@ -54,7 +55,7 @@ int slbt_exec_compile(
return SLBT_NESTED_ERROR(dctx);
/* .libs directory */
- if (dctx->cctx->drvflags & SLBT_DRIVER_SHARED)
+ if (cctx->drvflags & SLBT_DRIVER_SHARED)
if (slbt_mkdir(ectx->ldirname)) {
slbt_free_exec_ctx(actx);
return SLBT_SYSTEM_ERROR(dctx);
@@ -65,18 +66,18 @@ int slbt_exec_compile(
ectx->argv = ectx->cargv;
/* shared library object */
- if (dctx->cctx->drvflags & SLBT_DRIVER_SHARED) {
- if (!(dctx->cctx->drvflags & SLBT_DRIVER_ANTI_PIC))
+ if (cctx->drvflags & SLBT_DRIVER_SHARED) {
+ if (!(cctx->drvflags & SLBT_DRIVER_ANTI_PIC))
*ectx->dpic = "-DPIC";
- if (!(dctx->cctx->drvflags & SLBT_DRIVER_ANTI_PIC))
- if (dctx->cctx->settings.picswitch)
- *ectx->fpic = dctx->cctx->settings.picswitch;
+ if (!(cctx->drvflags & SLBT_DRIVER_ANTI_PIC))
+ if (cctx->settings.picswitch)
+ *ectx->fpic = cctx->settings.picswitch;
*ectx->lout[0] = "-o";
*ectx->lout[1] = ectx->lobjname;
- if (!(dctx->cctx->drvflags & SLBT_DRIVER_SILENT)) {
+ if (!(cctx->drvflags & SLBT_DRIVER_SILENT)) {
if (slbt_output_compile(dctx,ectx)) {
slbt_free_exec_ctx(actx);
return SLBT_NESTED_ERROR(dctx);
@@ -90,20 +91,20 @@ int slbt_exec_compile(
}
/* static archive object */
- if (dctx->cctx->drvflags & SLBT_DRIVER_STATIC) {
+ if (cctx->drvflags & SLBT_DRIVER_STATIC) {
slbt_reset_placeholders(ectx);
- if (dctx->cctx->drvflags & SLBT_DRIVER_PRO_PIC)
+ if (cctx->drvflags & SLBT_DRIVER_PRO_PIC)
*ectx->dpic = "-DPIC";
- if (dctx->cctx->drvflags & SLBT_DRIVER_PRO_PIC)
- if (dctx->cctx->settings.picswitch)
- *ectx->fpic = dctx->cctx->settings.picswitch;
+ if (cctx->drvflags & SLBT_DRIVER_PRO_PIC)
+ if (cctx->settings.picswitch)
+ *ectx->fpic = cctx->settings.picswitch;
*ectx->lout[0] = "-o";
*ectx->lout[1] = ectx->aobjname;
- if (!(dctx->cctx->drvflags & SLBT_DRIVER_SILENT)) {
+ if (!(cctx->drvflags & SLBT_DRIVER_SILENT)) {
if (slbt_output_compile(dctx,ectx)) {
slbt_free_exec_ctx(actx);
return SLBT_NESTED_ERROR(dctx);