summaryrefslogtreecommitdiffhomepage
path: root/source.c
diff options
context:
space:
mode:
Diffstat (limited to 'source.c')
-rw-r--r--source.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/source.c b/source.c
index b8f2e91..902ad4c 100644
--- a/source.c
+++ b/source.c
@@ -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;
+}