diff options
| author | Jesse Jones <jesse9jones@gmail.com> | 2012-12-08 21:45:43 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-12-15 22:38:20 -0800 |
| commit | eca23da98b7b0a9998ef2307a2ae63f30b1f955d (patch) | |
| tree | bdffc655f23eeb51776eff815b9b5ef89370368f | |
| parent | 6bab226fc59f5bd011e243b5a4ec18adcbefdd58 (diff) | |
| download | rust-eca23da98b7b0a9998ef2307a2ae63f30b1f955d.tar.gz rust-eca23da98b7b0a9998ef2307a2ae63f30b1f955d.zip | |
Instead of returning a bool (which everyone ignored) pop asserts
| -rw-r--r-- | src/rt/util/array_list.h | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/rt/util/array_list.h b/src/rt/util/array_list.h index fed22f8d036..eef46856b1b 100644 --- a/src/rt/util/array_list.h +++ b/src/rt/util/array_list.h @@ -35,7 +35,7 @@ public: size_t size() const; int32_t append(T value); int32_t push(T value); - bool pop(T *value); + void pop(T *value); bool replace(T old_value, T new_value); int32_t index_of(T value) const; bool is_empty() const; @@ -81,17 +81,14 @@ array_list<T>::push(T value) { return _size - 1; } -template<typename T> bool +template<typename T> void array_list<T>::pop(T *value) { - if (_size == 0) { - return false; - } + assert(_size > 0); if (value != NULL) { *value = _data[-- _size]; } else { -- _size; } - return true; } /** |
