]> git.cworth.org Git - fips/blobdiff - glwrap.h
Add a new GLWRAP_DEFER_WITH_RETURN macro.
[fips] / glwrap.h
index 9195007c4b51b15cd8eb38eea9439ee0c15d4579..bd2e265dac5e9d26c7d7a12821e08ea9f0c0e40a 100644 (file)
--- a/glwrap.h
+++ b/glwrap.h
@@ -37,4 +37,12 @@ glwrap_lookup (char *name);
        real_ ## function(__VA_ARGS__);                         \
 } while (0);
 
+/* As GLWRAP_DEFER, but also set 'ret' to the return value */
+#define GLWRAP_DEFER_WITH_RETURN(ret, function,...) do {       \
+       static typeof(&function) real_ ## function;             \
+       if (! real_ ## function)                                \
+               real_ ## function = glwrap_lookup (#function);  \
+       (ret) = real_ ## function(__VA_ARGS__);                 \
+} while (0);
+
 #endif