summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-08-03 23:16:42 +0000
committermidipix <writeonce@midipix.org>2018-08-03 21:13:31 -0400
commit2f4c03923b250a3bbf96188ceb91979841a95e91 (patch)
tree0b0a3fe3c47081345b72e9d7caa25b834c1cfbe9 /src/util
parent1c93c26f73c2e8746defed21d22d83d08ac16eaf (diff)
downloadmdso-2f4c03923b250a3bbf96188ceb91979841a95e91.tar.bz2
mdso-2f4c03923b250a3bbf96188ceb91979841a95e91.tar.xz
library interfaces: archive generation: simplify, re-implement with mmap.
Diffstat (limited to 'src/util')
-rw-r--r--src/util/mdso_create_implib_archive.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/util/mdso_create_implib_archive.c b/src/util/mdso_create_implib_archive.c
index e5e5d01..11373b4 100644
--- a/src/util/mdso_create_implib_archive.c
+++ b/src/util/mdso_create_implib_archive.c
@@ -15,8 +15,7 @@
static void mdso_free_uctx_vector(
struct mdso_unit_ctx ** uctxv,
const char ** symv,
- int * stype,
- FILE * fout)
+ int * stype)
{
struct mdso_unit_ctx ** puctx;
@@ -30,16 +29,14 @@ static void mdso_free_uctx_vector(
mdso_free_unit_ctx(*puctx);
free(uctxv);
- fclose(fout);
}
int mdso_create_implib_archive(const struct mdso_driver_ctx * dctx)
{
- int ret;
- FILE * fout;
size_t nsym;
struct mdso_unit_ctx ** uctxv;
struct mdso_unit_ctx ** puctx;
+ struct mdso_object obj;
const char * const * dsym;
const char ** unit;
const char ** psym;
@@ -55,12 +52,9 @@ int mdso_create_implib_archive(const struct mdso_driver_ctx * dctx)
if (!(uctxv = calloc(++unit - dctx->units,sizeof(*uctxv))))
return MDSO_SYSTEM_ERROR(dctx);
- if (!(fout = mdso_create_archive(dctx,dctx->cctx->implib)))
- return MDSO_NESTED_ERROR(dctx);
-
for (puctx=uctxv,unit=dctx->units; *unit; unit++) {
if (mdso_get_unit_ctx(dctx,*unit,puctx++)) {
- mdso_free_uctx_vector(uctxv,0,0,fout);
+ mdso_free_uctx_vector(uctxv,0,0);
return MDSO_NESTED_ERROR(dctx);
}
}
@@ -70,12 +64,12 @@ int mdso_create_implib_archive(const struct mdso_driver_ctx * dctx)
nsym++;
if (!(symv = calloc(nsym+1,sizeof(const char *)))) {
- mdso_free_uctx_vector(uctxv,0,0,fout);
+ mdso_free_uctx_vector(uctxv,0,0);
return MDSO_SYSTEM_ERROR(dctx);
}
if (!(stype = calloc(nsym+1,sizeof(int)))) {
- mdso_free_uctx_vector(uctxv,symv,0,fout);
+ mdso_free_uctx_vector(uctxv,symv,0);
return MDSO_SYSTEM_ERROR(dctx);
}
@@ -86,8 +80,13 @@ int mdso_create_implib_archive(const struct mdso_driver_ctx * dctx)
}
}
- ret = mdso_argen_common(dctx,symv,stype,fout,0);
- mdso_free_uctx_vector(uctxv,symv,stype,fout);
+ memset(&obj,0,sizeof(obj));
+ obj.name = dctx->cctx->implib;
+
+ if (mdso_argen_common(dctx,symv,stype,&obj) < 0) {
+ mdso_free_uctx_vector(uctxv,symv,stype);
+ return MDSO_NESTED_ERROR(dctx);
+ }
- return ret ? MDSO_NESTED_ERROR(dctx) : 0;
+ return 0;
}