}
/*
- * 0 terminated integer/float attribute list.
+ * attribute list, terminated by the given terminator.
*/
template<class T>
static inline size_t
-__AttribList_size(const T *pAttribList)
+__AttribList_size(const T *pAttribList, const T terminator = 0)
{
size_t size = 0;
if (pAttribList) {
do {
++size;
- } while (*pAttribList++);
+ } while (*pAttribList++ != terminator);
}
return size;
*/
template<class T>
static inline size_t
-__AttribList_size(const T *pAttribList, T terminator)
+__AttribPairList_size(const T *pAttribList, const T terminator = 0)
{
size_t size = 0;
if (pAttribList) {
- while (pAttribList[size] != terminator)
+ while (pAttribList[size] != terminator) {
size += 2;
+ }
// terminator also counts
- size++;
+ ++size;
}
return size;
eglapi = API("EGL")
-EGLAttribList = Array(Const(EGLattrib), "__AttribList_size(attrib_list, EGL_NONE)")
+EGLAttribList = Array(Const(EGLattrib), "__AttribPairList_size(attrib_list, EGL_NONE)")
PROC = Opaque("__eglMustCastToProperFunctionPointerType")