From 947ef7edea90b134c9dd06d70fa05adab3a4fb0f Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Fri, 19 Aug 2016 05:05:30 -0700 Subject: [PATCH] Util: Add Vector GetConstPointer --- CHANGES | 1 + src/util/vector.h | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGES b/CHANGES index aa574d0a3..b6a5b67ff 100644 --- a/CHANGES +++ b/CHANGES @@ -61,6 +61,7 @@ Misc: - GBA Video: Optimize mode 0 rendering - Qt: Remove default autofire mappings - PSP2: Allow UTF-8 filenames + - Util: Add Vector GetConstPointer 0.4.1: (2016-07-11) Bugfixes: diff --git a/src/util/vector.h b/src/util/vector.h index f809f0084..dee7ed77a 100644 --- a/src/util/vector.h +++ b/src/util/vector.h @@ -17,6 +17,7 @@ void NAME ## Init(struct NAME* vector, size_t capacity); \ void NAME ## Deinit(struct NAME* vector); \ TYPE* NAME ## GetPointer(struct NAME* vector, size_t location); \ + TYPE const* NAME ## GetConstPointer(const struct NAME* vector, size_t location); \ TYPE* NAME ## Append(struct NAME* vector); \ void NAME ## Clear(struct NAME* vector); \ void NAME ## Resize(struct NAME* vector, ssize_t change); \ @@ -43,6 +44,9 @@ TYPE* NAME ## GetPointer(struct NAME* vector, size_t location) { \ return &vector->vector[location]; \ } \ + TYPE const* NAME ## GetConstPointer(const struct NAME* vector, size_t location) { \ + return &vector->vector[location]; \ + } \ TYPE* NAME ## Append(struct NAME* vector) { \ NAME ## Resize(vector, 1); \ return &vector->vector[vector->size - 1]; \