diff options
Diffstat (limited to 'src/arbits/output/slbt_ar_output_mapfile.c')
-rw-r--r-- | src/arbits/output/slbt_ar_output_mapfile.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/arbits/output/slbt_ar_output_mapfile.c b/src/arbits/output/slbt_ar_output_mapfile.c index 09774bd..3455c37 100644 --- a/src/arbits/output/slbt_ar_output_mapfile.c +++ b/src/arbits/output/slbt_ar_output_mapfile.c @@ -20,21 +20,31 @@ static int slbt_ar_output_mapfile_impl( struct slbt_archive_meta_impl * mctx, int fdout) { + bool fsort; const char * regex; const char ** symv; + const char ** symstrv; regex_t regctx; regmatch_t pmatch[2] = {0}; + fsort = true; + if (slbt_dprintf(fdout,"{\n" "\t" "global:\n") < 0) return SLBT_SYSTEM_ERROR(dctx,0); + if (fsort && !mctx->mapstrv) + if (slbt_update_mapstrv(dctx,mctx) < 0) + return SLBT_NESTED_ERROR(dctx); + if ((regex = dctx->cctx->regex)) if (regcomp(®ctx,regex,REG_NEWLINE)) return SLBT_CUSTOM_ERROR( dctx, SLBT_ERR_FLOW_ERROR); - for (symv=mctx->symstrv; *symv; symv++) + symstrv = fsort ? mctx->mapstrv : mctx->symstrv; + + for (symv=symstrv; *symv; symv++) if (!regex || !regexec(®ctx,*symv,1,pmatch,0)) if (slbt_dprintf(fdout,"\t\t%s;\n",*symv) < 0) return SLBT_SYSTEM_ERROR(dctx,0); |