[waffle] [PATCH 06/17] core: Define intptr_t variants of wcore_attrib_list functions (v2)
Chad Versace
chad.versace at intel.com
Sun Jan 4 14:02:59 PST 2015
When designing the original Waffle 1.0 API, I made a mistake when
I chose to declare attribute lists as arrays of int32_t. Instead, they
should have been arrays of intptr_t.
A new public function, waffle_window_create2, will have a `const
intptr_t attrib_list[]` parameter. Therefore waffle needs intptr_t
variants of the wcore_attrib_list functions.
Signed-off-by: Chad Versace <chad.versace at intel.com>
---
src/waffle/core/wcore_attrib_list.c | 6 ++++++
src/waffle/core/wcore_attrib_list.h | 23 +++++++++++++++++++++++
2 files changed, 29 insertions(+)
v2:
- Remove duplicate code by defining functions with type-generic macro.
diff --git a/src/waffle/core/wcore_attrib_list.c b/src/waffle/core/wcore_attrib_list.c
index f8c2e6d..abba921 100644
--- a/src/waffle/core/wcore_attrib_list.c
+++ b/src/waffle/core/wcore_attrib_list.c
@@ -113,3 +113,9 @@ WCORE_ATTRIB_LIST_COMMON_FUNCS(int32_t,
wcore_attrib_list32_get,
wcore_attrib_list32_get_with_default,
wcore_attrib_list32_update)
+
+WCORE_ATTRIB_LIST_COMMON_FUNCS(intptr_t,
+ wcore_attrib_list_length,
+ wcore_attrib_list_get,
+ wcore_attrib_list_get_with_default,
+ wcore_attrib_list_update)
diff --git a/src/waffle/core/wcore_attrib_list.h b/src/waffle/core/wcore_attrib_list.h
index 15bd8ba..8d49d10 100644
--- a/src/waffle/core/wcore_attrib_list.h
+++ b/src/waffle/core/wcore_attrib_list.h
@@ -28,6 +28,29 @@
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
+#include <stdlib.h>
+
+size_t
+wcore_attrib_list_length(const intptr_t attrib_list[]);
+
+bool
+wcore_attrib_list_get(
+ const intptr_t *attrib_list,
+ intptr_t key,
+ intptr_t *value);
+
+bool
+wcore_attrib_list_get_with_default(
+ const intptr_t attrib_list[],
+ intptr_t key,
+ intptr_t *value,
+ intptr_t default_value);
+
+bool
+wcore_attrib_list_update(
+ intptr_t *attrib_list,
+ intptr_t key,
+ intptr_t value);
size_t
wcore_attrib_list32_length(const int32_t attrib_list[]);
--
2.2.0
More information about the waffle
mailing list