diff options
author | midipix <writeonce@midipix.org> | 2018-07-30 12:04:46 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2018-08-03 21:13:29 -0400 |
commit | 551500bc329826026634c6ecefa9fcc9074281fd (patch) | |
tree | 43a7ef87b6fe9092156cb6d55798c51a7dff1cd9 /src | |
parent | f1dbc60ab6cc4bc2422441c9028c7edc56684b82 (diff) | |
download | mdso-551500bc329826026634c6ecefa9fcc9074281fd.tar.bz2 mdso-551500bc329826026634c6ecefa9fcc9074281fd.tar.xz |
mdso_output_export_symbols(): revised API and impl. to use fdctx and pure fdio.
Diffstat (limited to 'src')
-rw-r--r-- | src/driver/mdso_amain.c | 3 | ||||
-rw-r--r-- | src/output/mdso_output_export_symbols.c | 31 |
2 files changed, 20 insertions, 14 deletions
diff --git a/src/driver/mdso_amain.c b/src/driver/mdso_amain.c index 02daefb..ee02363 100644 --- a/src/driver/mdso_amain.c +++ b/src/driver/mdso_amain.c @@ -54,8 +54,7 @@ static void mdso_perform_unit_actions( struct mdso_unit_ctx * uctx) { if (uctx->cctx->fmtflags & MDSO_OUTPUT_EXPORT_SYMS) - mdso_output_export_symbols( - dctx,uctx,stdout); + mdso_output_export_symbols(dctx,uctx); } static int mdso_exit(struct mdso_driver_ctx * dctx, int ret) diff --git a/src/output/mdso_output_export_symbols.c b/src/output/mdso_output_export_symbols.c index 5c8dc66..6f36a6d 100644 --- a/src/output/mdso_output_export_symbols.c +++ b/src/output/mdso_output_export_symbols.c @@ -12,39 +12,46 @@ #include <mdso/mdso.h> #include <mdso/mdso_output.h> +#include "mdso_driver_impl.h" +#include "mdso_dprintf_impl.h" #include "mdso_errinfo_impl.h" -static int pretty_header(const struct mdso_common_ctx * cctx, FILE * fout) +static int pretty_header(int fdout, const struct mdso_common_ctx * cctx) { return (cctx->fmtflags & MDSO_PRETTY_YAML) - ? fputs("exports:\n",fout) + ? mdso_dprintf(fdout,"exports:\n") : 0; } -static int pretty_export_item(const struct mdso_common_ctx * cctx, const char * name, FILE * fout) +static int pretty_export_item( + int fdout, + const struct mdso_common_ctx * cctx, + const char * name) { if (cctx->fmtflags & MDSO_PRETTY_YAML) - return fprintf(fout,"- %s\n",name); + return mdso_dprintf(fdout,"- %s\n",name); else - return fprintf(fout,"%s\n",name); + return mdso_dprintf(fdout,"%s\n",name); } int mdso_output_export_symbols( const struct mdso_driver_ctx * dctx, - const struct mdso_unit_ctx * uctx, - FILE * fout) + const struct mdso_unit_ctx * uctx) { - const char * const * sym; + int fdout; + const char * const * sym; + + fdout = mdso_driver_fdout(dctx); if (!uctx->syms[0]) return 0; - if ((pretty_header(dctx->cctx,fout)) < 0) - return MDSO_FILE_ERROR(dctx); + if ((pretty_header(fdout,dctx->cctx)) < 0) + return MDSO_SYSTEM_ERROR(dctx); for (sym=uctx->syms; *sym; sym++) - if ((pretty_export_item(dctx->cctx,*sym,fout)) < 0) - return MDSO_FILE_ERROR(dctx); + if ((pretty_export_item(fdout,dctx->cctx,*sym)) < 0) + return MDSO_SYSTEM_ERROR(dctx); return 0; } |