From 33a569a279a1c0acbf06fe6622866bd79f111685 Mon Sep 17 00:00:00 2001 From: midipix Date: Tue, 20 Feb 2024 17:29:18 +0000 Subject: utility api's: _output_ namespace: simplified the execution context interfaces. --- src/internal/slibtool_symlink_impl.c | 4 ++-- src/logic/linkcmd/slbt_linkcmd_archive.c | 2 +- src/logic/linkcmd/slbt_linkcmd_dsolib.c | 2 +- src/logic/linkcmd/slbt_linkcmd_executable.c | 2 +- src/logic/linkcmd/slbt_linkcmd_implib.c | 2 +- src/logic/slbt_exec_compile.c | 4 ++-- src/logic/slbt_exec_execute.c | 2 +- src/logic/slbt_exec_install.c | 8 +++---- src/logic/slbt_exec_uninstall.c | 2 +- src/output/slbt_output_exec.c | 37 ++++++++++++----------------- src/util/slbt_copy_file.c | 4 ++-- 11 files changed, 31 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/internal/slibtool_symlink_impl.c b/src/internal/slibtool_symlink_impl.c index 21d4972..c9be845 100644 --- a/src/internal/slibtool_symlink_impl.c +++ b/src/internal/slibtool_symlink_impl.c @@ -104,12 +104,12 @@ slbt_hidden int slbt_create_symlink( /* step output */ if (!(dctx->cctx->drvflags & SLBT_DRIVER_SILENT)) { if (dctx->cctx->mode == SLBT_MODE_LINK) { - if (slbt_output_link(dctx,ectx)) { + if (slbt_output_link(ectx)) { ectx->argv = oargv; return SLBT_NESTED_ERROR(dctx); } } else { - if (slbt_output_install(dctx,ectx)) { + if (slbt_output_install(ectx)) { ectx->argv = oargv; return SLBT_NESTED_ERROR(dctx); } diff --git a/src/logic/linkcmd/slbt_linkcmd_archive.c b/src/logic/linkcmd/slbt_linkcmd_archive.c index 13abb9f..f7ddc5c 100644 --- a/src/logic/linkcmd/slbt_linkcmd_archive.c +++ b/src/logic/linkcmd/slbt_linkcmd_archive.c @@ -139,7 +139,7 @@ slbt_hidden int slbt_exec_link_create_archive( /* step output */ if (!(dctx->cctx->drvflags & SLBT_DRIVER_SILENT)) - if (slbt_output_link(dctx,ectx)) + if (slbt_output_link(ectx)) return SLBT_NESTED_ERROR(dctx); /* remove old archive as needed */ diff --git a/src/logic/linkcmd/slbt_linkcmd_dsolib.c b/src/logic/linkcmd/slbt_linkcmd_dsolib.c index ac36f06..38ecbd3 100644 --- a/src/logic/linkcmd/slbt_linkcmd_dsolib.c +++ b/src/logic/linkcmd/slbt_linkcmd_dsolib.c @@ -263,7 +263,7 @@ slbt_hidden int slbt_exec_link_create_library( /* step output */ if (!(dctx->cctx->drvflags & SLBT_DRIVER_SILENT)) - if (slbt_output_link(dctx,ectx)) + if (slbt_output_link(ectx)) return slbt_linkcmd_exit( &depsmeta, SLBT_NESTED_ERROR(dctx)); diff --git a/src/logic/linkcmd/slbt_linkcmd_executable.c b/src/logic/linkcmd/slbt_linkcmd_executable.c index fb77acf..bb23701 100644 --- a/src/logic/linkcmd/slbt_linkcmd_executable.c +++ b/src/logic/linkcmd/slbt_linkcmd_executable.c @@ -228,7 +228,7 @@ slbt_hidden int slbt_exec_link_create_executable( /* step output */ if (!(dctx->cctx->drvflags & SLBT_DRIVER_SILENT)) - if (slbt_output_link(dctx,ectx)) + if (slbt_output_link(ectx)) return slbt_linkcmd_exit( &depsmeta, SLBT_NESTED_ERROR(dctx)); diff --git a/src/logic/linkcmd/slbt_linkcmd_implib.c b/src/logic/linkcmd/slbt_linkcmd_implib.c index 810ff10..a9467a3 100644 --- a/src/logic/linkcmd/slbt_linkcmd_implib.c +++ b/src/logic/linkcmd/slbt_linkcmd_implib.c @@ -140,7 +140,7 @@ slbt_hidden int slbt_exec_link_create_import_library( /* step output */ if (!(dctx->cctx->drvflags & SLBT_DRIVER_SILENT)) - if (slbt_output_link(dctx,ectx)) + if (slbt_output_link(ectx)) return SLBT_NESTED_ERROR(dctx); /* dlltool/mdso spawn */ diff --git a/src/logic/slbt_exec_compile.c b/src/logic/slbt_exec_compile.c index d651607..8c5e870 100644 --- a/src/logic/slbt_exec_compile.c +++ b/src/logic/slbt_exec_compile.c @@ -230,7 +230,7 @@ int slbt_exec_compile( return SLBT_NESTED_ERROR(dctx); if (!(cctx->drvflags & SLBT_DRIVER_SILENT)) { - if (slbt_output_compile(dctx,ectx)) { + if (slbt_output_compile(ectx)) { slbt_ectx_free_exec_ctx(actx); return SLBT_NESTED_ERROR(dctx); } @@ -265,7 +265,7 @@ int slbt_exec_compile( return SLBT_NESTED_ERROR(dctx); if (!(cctx->drvflags & SLBT_DRIVER_SILENT)) { - if (slbt_output_compile(dctx,ectx)) { + if (slbt_output_compile(ectx)) { slbt_ectx_free_exec_ctx(actx); return SLBT_NESTED_ERROR(dctx); } diff --git a/src/logic/slbt_exec_execute.c b/src/logic/slbt_exec_execute.c index c9426ab..ec627b1 100644 --- a/src/logic/slbt_exec_execute.c +++ b/src/logic/slbt_exec_execute.c @@ -90,7 +90,7 @@ int slbt_exec_execute( /* step output */ if (!(dctx->cctx->drvflags & SLBT_DRIVER_SILENT)) - if (slbt_output_execute(dctx,ectx)) { + if (slbt_output_execute(ectx)) { slbt_ectx_free_exec_ctx(actx); return SLBT_NESTED_ERROR(dctx); } diff --git a/src/logic/slbt_exec_install.c b/src/logic/slbt_exec_install.c index dc311f8..3677f12 100644 --- a/src/logic/slbt_exec_install.c +++ b/src/logic/slbt_exec_install.c @@ -397,7 +397,7 @@ static int slbt_exec_install_entry( *dst = dest ? 0 : (char *)last->arg; if (!(dctx->cctx->drvflags & SLBT_DRIVER_SILENT)) - if (slbt_output_install(dctx,ectx)) + if (slbt_output_install(ectx)) return SLBT_NESTED_ERROR(dctx); if ((slbt_spawn(ectx,true) < 0) && (ectx->pid < 0)) { @@ -586,7 +586,7 @@ static int slbt_exec_install_entry( *dst = dest ? 0 : dstfile; if (!(dctx->cctx->drvflags & SLBT_DRIVER_SILENT)) - if (slbt_output_install(dctx,ectx)) + if (slbt_output_install(ectx)) return SLBT_NESTED_ERROR(dctx); if ((slbt_spawn(ectx,true) < 0) && (ectx->pid < 0)) { @@ -616,7 +616,7 @@ static int slbt_exec_install_entry( *dst = dest ? 0 : dstfile; if (!(dctx->cctx->drvflags & SLBT_DRIVER_SILENT)) - if (slbt_output_install(dctx,ectx)) + if (slbt_output_install(ectx)) return SLBT_NESTED_ERROR(dctx); if ((slbt_spawn(ectx,true) < 0) && (ectx->pid < 0)) { @@ -901,7 +901,7 @@ int slbt_exec_install( /* spawn */ if (!(dctx->cctx->drvflags & SLBT_DRIVER_SILENT)) - if (slbt_output_install(dctx,ectx)) + if (slbt_output_install(ectx)) return SLBT_NESTED_ERROR(dctx); if ((slbt_spawn(ectx,true) < 0) && (ectx->pid < 0)) { diff --git a/src/logic/slbt_exec_uninstall.c b/src/logic/slbt_exec_uninstall.c index 8dec7cf..7c990bc 100644 --- a/src/logic/slbt_exec_uninstall.c +++ b/src/logic/slbt_exec_uninstall.c @@ -84,7 +84,7 @@ static int slbt_exec_uninstall_fs_entry( *parg = path; if (!(dctx->cctx->drvflags & SLBT_DRIVER_SILENT)) - if (slbt_output_uninstall(dctx,ectx)) + if (slbt_output_uninstall(ectx)) return SLBT_NESTED_ERROR(dctx); /* directory? */ diff --git a/src/output/slbt_output_exec.c b/src/output/slbt_output_exec.c index 0232024..3f95af0 100644 --- a/src/output/slbt_output_exec.c +++ b/src/output/slbt_output_exec.c @@ -90,11 +90,14 @@ static int slbt_output_exec_plain( } int slbt_output_exec( - const struct slbt_driver_ctx * dctx, const struct slbt_exec_ctx * ectx, const char * step) { - int fdout = slbt_driver_fdout(dctx); + const struct slbt_driver_ctx * dctx; + int fdout; + + dctx = (slbt_get_exec_ictx(ectx))->dctx; + fdout = slbt_driver_fdout(dctx); if (dctx->cctx->drvflags & SLBT_DRIVER_ANNOTATE_NEVER) return slbt_output_exec_plain(dctx,ectx,step); @@ -109,37 +112,27 @@ int slbt_output_exec( return slbt_output_exec_plain(dctx,ectx,step); } -int slbt_output_compile( - const struct slbt_driver_ctx * dctx, - const struct slbt_exec_ctx * ectx) +int slbt_output_compile(const struct slbt_exec_ctx * ectx) { - return slbt_output_exec(dctx,ectx,"compile"); + return slbt_output_exec(ectx,"compile"); } -int slbt_output_execute( - const struct slbt_driver_ctx * dctx, - const struct slbt_exec_ctx * ectx) +int slbt_output_execute(const struct slbt_exec_ctx * ectx) { - return slbt_output_exec(dctx,ectx,"execute"); + return slbt_output_exec(ectx,"execute"); } -int slbt_output_install( - const struct slbt_driver_ctx * dctx, - const struct slbt_exec_ctx * ectx) +int slbt_output_install(const struct slbt_exec_ctx * ectx) { - return slbt_output_exec(dctx,ectx,"install"); + return slbt_output_exec(ectx,"install"); } -int slbt_output_link( - const struct slbt_driver_ctx * dctx, - const struct slbt_exec_ctx * ectx) +int slbt_output_link(const struct slbt_exec_ctx * ectx) { - return slbt_output_exec(dctx,ectx,"link"); + return slbt_output_exec(ectx,"link"); } -int slbt_output_uninstall( - const struct slbt_driver_ctx * dctx, - const struct slbt_exec_ctx * ectx) +int slbt_output_uninstall(const struct slbt_exec_ctx * ectx) { - return slbt_output_exec(dctx,ectx,"uninstall"); + return slbt_output_exec(ectx,"uninstall"); } diff --git a/src/util/slbt_copy_file.c b/src/util/slbt_copy_file.c index 30d3f03..e6868de 100644 --- a/src/util/slbt_copy_file.c +++ b/src/util/slbt_copy_file.c @@ -44,13 +44,13 @@ int slbt_util_copy_file( /* step output */ if (!(dctx->cctx->drvflags & SLBT_DRIVER_SILENT)) { if (dctx->cctx->mode == SLBT_MODE_LINK) { - if (slbt_output_link(dctx,ectx)) { + if (slbt_output_link(ectx)) { ectx->argv = oargv; ectx->program = oprogram; return SLBT_NESTED_ERROR(dctx); } } else { - if (slbt_output_install(dctx,ectx)) { + if (slbt_output_install(ectx)) { ectx->argv = oargv; ectx->program = oprogram; return SLBT_NESTED_ERROR(dctx); -- cgit v1.2.3