diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-07-30 14:02:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-30 14:02:03 +0200 |
commit | e55965a3d170f60776ffa2d82b2711d9ea3a0211 (patch) | |
tree | b73977b8e71445de9e5947d2db3bf941cc174f42 /source.c | |
parent | 1219d7efa170bf38fb1bf6a10fa0d1f96e62f091 (diff) | |
parent | 156d584e4d0af46c39234ee68a98a16ab4cbe225 (diff) |
Merge pull request #96 from jow-/module-import-export-support
Module import export support
Diffstat (limited to 'source.c')
-rw-r--r-- | source.c | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -196,3 +196,28 @@ uc_source_runpath_set(uc_source_t *source, const char *runpath) source->runpath = xstrdup(runpath); } + +bool +uc_source_export_add(uc_source_t *source, uc_value_t *name) +{ + ssize_t idx = uc_source_export_lookup(source, name); + + if (idx > -1) + return false; + + uc_vector_push(&source->exports, ucv_get(name)); + + return true; +} + +ssize_t +uc_source_export_lookup(uc_source_t *source, uc_value_t *name) +{ + size_t i; + + for (i = 0; i < source->exports.count; i++) + if (ucv_is_equal(source->exports.entries[i], name)) + return i; + + return -1; +} |