summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2009-12-11 00:17:10 +0100
committerJohannes Weiner <hannes@cmpxchg.org>2009-12-11 00:17:10 +0100
commiteafe0ff1a108be5cc6980e6b39346d1bb9e4666e (patch)
tree4aeb93685309ae965140a51ef8066190c4bc1232
parent3b4b64c13cad7de92c845999860c5631d5b723b7 (diff)
vm: drop sheep_vm_bind()
Make this sheep_vm_variable() instead, returning the slot value. Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
-rw-r--r--include/sheep/vm.h5
-rw-r--r--sheep/vm.c9
2 files changed, 3 insertions, 11 deletions
diff --git a/include/sheep/vm.h b/include/sheep/vm.h
index 635bae9..8abee73 100644
--- a/include/sheep/vm.h
+++ b/include/sheep/vm.h
@@ -43,10 +43,7 @@ static inline unsigned int sheep_vm_global(struct sheep_vm *vm)
return sheep_vector_push(&vm->globals, NULL);
}
-unsigned int sheep_vm_bind(struct sheep_vm *, struct sheep_map *,
- const char *, sheep_t);
-
-void sheep_vm_variable(struct sheep_vm *, const char *, sheep_t);
+unsigned int sheep_vm_variable(struct sheep_vm *, const char *, sheep_t);
void sheep_vm_function(struct sheep_vm *, const char *, sheep_alien_t);
void sheep_vm_init(struct sheep_vm *);
diff --git a/sheep/vm.c b/sheep/vm.c
index fc0900c..9e53765 100644
--- a/sheep/vm.c
+++ b/sheep/vm.c
@@ -37,21 +37,16 @@ void sheep_vm_mark(struct sheep_vm *vm)
sheep_mark(vm->stack.items[i]);
}
-unsigned int sheep_vm_bind(struct sheep_vm *vm, struct sheep_map *env,
+unsigned int sheep_vm_variable(struct sheep_vm *vm,
const char *name, sheep_t value)
{
unsigned int slot;
slot = sheep_vm_constant(vm, value);
- sheep_map_set(env, name, (void *)(unsigned long)slot);
+ sheep_map_set(&vm->builtins, name, (void *)(unsigned long)slot);
return slot;
}
-void sheep_vm_variable(struct sheep_vm *vm, const char *name, sheep_t value)
-{
- sheep_vm_bind(vm, &vm->builtins, name, value);
-}
-
void sheep_vm_function(struct sheep_vm *vm, const char *name, sheep_alien_t f)
{
sheep_vm_variable(vm, name, sheep_make_alien(vm, f, name));