[waffle] [PATCH 03/10] waffle: remove restrict keyword from public API
Emil Velikov
emil.l.velikov at gmail.com
Fri May 30 19:22:01 PDT 2014
We should have never defined the restrict keyword in
the waffle.h header. The word is used as a hint to the
compiler to provide optimisations re: pointer aliasing.
Keep the symbol around, so that the compiler can still
optimise the library.
v2: Move the symbol definition to its user and update the
man pages.
Resolves #11: https://github.com/waffle-gl/waffle/issues/11
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
include/waffle/waffle.h | 8 ++------
man/waffle_is_extension_in_string.3.xml | 4 ++--
src/waffle/api/waffle_gl_misc.c | 4 ++++
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/waffle/waffle.h b/include/waffle/waffle.h
index d43ddcf..91f3434 100644
--- a/include/waffle/waffle.h
+++ b/include/waffle/waffle.h
@@ -36,10 +36,6 @@
extern "C" {
#endif
-#if __STDC_VERSION__ < 199901L
-# define restrict
-#endif
-
struct waffle_display;
struct waffle_config;
struct waffle_context;
@@ -172,8 +168,8 @@ void*
waffle_get_proc_address(const char *name);
bool
-waffle_is_extension_in_string(const char *restrict extension_string,
- const char *restrict extension_name);
+waffle_is_extension_in_string(const char *extension_string,
+ const char *extension_name);
// ---------------------------------------------------------------------------
// waffle_display
diff --git a/man/waffle_is_extension_in_string.3.xml b/man/waffle_is_extension_in_string.3.xml
index 0aa215a..2734ea2 100644
--- a/man/waffle_is_extension_in_string.3.xml
+++ b/man/waffle_is_extension_in_string.3.xml
@@ -43,8 +43,8 @@
<funcprototype>
<funcdef>bool <function>waffle_is_extension_in_string</function></funcdef>
- <paramdef>const char *restrict <parameter>extension_string</parameter></paramdef>
- <paramdef>const char *restrict <parameter>extension_name</parameter></paramdef>
+ <paramdef>const char * <parameter>extension_string</parameter></paramdef>
+ <paramdef>const char * <parameter>extension_name</parameter></paramdef>
</funcprototype>
</funcsynopsis>
diff --git a/src/waffle/api/waffle_gl_misc.c b/src/waffle/api/waffle_gl_misc.c
index f94b34b..10b4da5 100644
--- a/src/waffle/api/waffle_gl_misc.c
+++ b/src/waffle/api/waffle_gl_misc.c
@@ -34,6 +34,10 @@
#include "wcore_platform.h"
#include "wcore_window.h"
+#if __STDC_VERSION__ < 199901L
+# define restrict
+#endif
+
WAFFLE_API bool
waffle_is_extension_in_string(
const char *restrict extension_string,
--
1.9.3
More information about the waffle
mailing list