public
/
ack.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b975772
)
Fix bug where pop would return the wrong value.
author
David Given
<dg@cowlark.com>
Sat, 21 Jan 2017 22:21:55 +0000
(23:21 +0100)
committer
David Given
<dg@cowlark.com>
Sat, 21 Jan 2017 22:21:55 +0000
(23:21 +0100)
modules/src/data/array.c
patch
|
blob
|
history
diff --git
a/modules/src/data/array.c
b/modules/src/data/array.c
index
363e603
..
2168c7d
100644
(file)
--- a/
modules/src/data/array.c
+++ b/
modules/src/data/array.c
@@
-21,8
+21,7
@@
void array_append(void* arrayp, void* value)
struct array* array = arrayp;
extend(array);
- array->item[array->count] = value;
- array->count++;
+ array->item[array->count++] = value;
}
int array_indexof(void* arrayp, void* value)
@@
-99,7
+98,7
@@
void* array_pop(void* arrayp)
struct array* array = arrayp;
assert(array->count > 0);
- return array->item[
array->count--
];
+ return array->item[
--array->count
];
}
void array_appendall(void* arrayp, void* srcp)