Austin Schuh | 40485ed | 2019-10-26 21:51:44 -0700 | [diff] [blame] | 1 | #include "aos/flatbuffers.h" |
| 2 | |
| 3 | #include "glog/logging.h" |
| 4 | |
| 5 | namespace aos { |
| 6 | |
| 7 | uint8_t *FixedAllocatorBase::allocate(size_t) { |
| 8 | if (is_allocated_) { |
Austin Schuh | 3da7b27 | 2020-01-06 18:41:40 -0800 | [diff] [blame] | 9 | LOG(FATAL) << "Can't allocate more memory with a fixed size allocator. " |
| 10 | "Increase the memory reserved."; |
Austin Schuh | 40485ed | 2019-10-26 21:51:44 -0700 | [diff] [blame] | 11 | } |
| 12 | |
| 13 | is_allocated_ = true; |
| 14 | return data(); |
| 15 | } |
| 16 | |
| 17 | uint8_t *FixedAllocatorBase::reallocate_downward(uint8_t *, size_t, size_t, |
| 18 | size_t, size_t) { |
Austin Schuh | 3da7b27 | 2020-01-06 18:41:40 -0800 | [diff] [blame] | 19 | LOG(FATAL) << "Can't allocate more memory with a fixed size allocator. " |
| 20 | "Increase the memory reserved."; |
Austin Schuh | 40485ed | 2019-10-26 21:51:44 -0700 | [diff] [blame] | 21 | return nullptr; |
| 22 | } |
| 23 | |
| 24 | } // namespace aos |