aboutsummaryrefslogtreecommitdiff
path: root/src/list.hpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2015-08-05 17:44:05 -0700
committerAndrew Kelley <superjoe30@gmail.com>2015-08-05 17:44:05 -0700
commite09932928ac16681d71127f3d5cc0c488f2fdcc5 (patch)
tree57ded4c21186e13a5e0283a6e5fa30bbe07738f6 /src/list.hpp
parent899c9fe94e04f50c6176644b61e2d89cb74a8886 (diff)
downloadzig-e09932928ac16681d71127f3d5cc0c488f2fdcc5.tar.gz
zig-e09932928ac16681d71127f3d5cc0c488f2fdcc5.zip
tokenize
Diffstat (limited to 'src/list.hpp')
-rw-r--r--src/list.hpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/list.hpp b/src/list.hpp
index 35c632823b..434ff9ffe6 100644
--- a/src/list.hpp
+++ b/src/list.hpp
@@ -5,24 +5,21 @@
* See http://opensource.org/licenses/MIT
*/
-#ifndef GROOVE_LIST_HPP
-#define GROOVE_LIST_HPP
+#ifndef ZIG_LIST_HPP
+#define ZIG_LIST_HPP
#include "util.hpp"
#include <assert.h>
template<typename T>
-struct GrooveList {
+struct ZigList {
void deinit() {
deallocate(items);
}
void append(T item) {
- int err = ensure_capacity(length + 1);
- if (err)
- return err;
+ ensure_capacity(length + 1);
items[length++] = item;
- return 0;
}
// remember that the pointer to this item is invalid after you
// modify the length of the list
@@ -57,11 +54,8 @@ struct GrooveList {
void resize(int new_length) {
assert(new_length >= 0);
- int err = ensure_capacity(new_length);
- if (err)
- return err;
+ ensure_capacity(new_length);
length = new_length;
- return 0;
}
void clear() {
@@ -76,7 +70,6 @@ struct GrooveList {
items = reallocate_nonzero(items, better_capacity);
capacity = better_capacity;
}
- return 0;
}
T * items;