[PATCH 5/7] add support for (key, val) attribute list
Chia-I Wu
olvaffe at gmail.com
Thu Nov 3 03:56:57 PDT 2011
A (key, val) attribute list has this format
{ key1, val1, ..., keyN, valN, terminator }
and the size is 2*N + 1
---
glsize.hpp | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/glsize.hpp b/glsize.hpp
index 00356ae..a042a14 100644
--- a/glsize.hpp
+++ b/glsize.hpp
@@ -758,4 +758,24 @@ __AttribList_size(const T *pAttribList)
}
+/*
+ * (key, value) attribute list, terminated by the given terminator.
+ */
+template<class T>
+static inline size_t
+__AttribList_size(const T *pAttribList, T terminator)
+{
+ size_t size = 0;
+
+ if (pAttribList) {
+ while (pAttribList[size] != terminator)
+ size += 2;
+ // terminator also counts
+ size++;
+ }
+
+ return size;
+}
+
+
#endif /* _GL_SIZE_HPP_ */
--
1.7.6.3
More information about the apitrace
mailing list