diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2011-02-22 16:23:36 +0100 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2011-02-22 16:23:36 +0100 |
commit | 43e8868875e1d5287979e5b9060a9b16be45cc79 (patch) | |
tree | d6df0587b107de28641b429048dff002e3c2387f /src/trie.cpp | |
parent | 98ccff1a24a056aef15372b131eee1c1bf8f62ca (diff) |
Added explicit error message in case of memory exhaustion
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/trie.cpp')
-rw-r--r-- | src/trie.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/trie.cpp b/src/trie.cpp index b1b4d95..4d0db16 100644 --- a/src/trie.cpp +++ b/src/trie.cpp @@ -73,7 +73,7 @@ void zmq::trie_t::add (unsigned char *prefix_, size_t size_) count = (min < c ? c - min : min - c) + 1; next.table = (trie_t**) malloc (sizeof (trie_t*) * count); - zmq_assert (next.table); + alloc_assert (next.table); for (unsigned short i = 0; i != count; ++i) next.table [i] = 0; min = std::min (min, c); @@ -110,14 +110,14 @@ void zmq::trie_t::add (unsigned char *prefix_, size_t size_) if (count == 1) { if (!next.node) { next.node = new (std::nothrow) trie_t; - zmq_assert (next.node); + alloc_assert (next.node); } next.node->add (prefix_ + 1, size_ - 1); } else { if (!next.table [c - min]) { next.table [c - min] = new (std::nothrow) trie_t; - zmq_assert (next.table [c - min]); + alloc_assert (next.table [c - min]); } next.table [c - min]->add (prefix_ + 1, size_ - 1); } |