aboutsummaryrefslogtreecommitdiff
path: root/src/stem.c
diff options
context:
space:
mode:
authorPreston Pan <preston@nullring.xyz>2024-01-22 18:34:19 -0800
committerPreston Pan <preston@nullring.xyz>2024-01-22 18:34:19 -0800
commit2750e54a2ad5afeabb7093fc10e9fb686b6f6059 (patch)
tree114b0e79cc9bb92d8be32fbb30100cab507a15e0 /src/stem.c
parentab4eaabe940c1593ac060d91c652fcdb587786c0 (diff)
add unglue
Diffstat (limited to 'src/stem.c')
-rw-r--r--src/stem.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/stem.c b/src/stem.c
index 5c2e379..f5a13ad 100644
--- a/src/stem.c
+++ b/src/stem.c
@@ -39,15 +39,15 @@ void array_append(array_t *a, value_t *v) {
a->size++;
}
-void array_curry(array_t *a, value_t *v) {
+void array_add(array_t *a, value_t *v, int index) {
if (a->size >= a->capacity - 3) {
a->capacity = a->capacity * 2;
a->items = realloc(a->items, a->capacity * sizeof(value_t *));
}
- for (int i = a->size - 1; i >= 0; i--) {
+ for (int i = a->size - 1; i >= index; i--) {
a->items[i + 1] = a->items[i];
}
- a->items[0] = v;
+ a->items[index] = v;
a->size++;
}