[Cogl] [PATCH] Move inclusion of strings.h to cogl-util.h and make it conditional

Neil Roberts neil at linux.intel.com
Thu Mar 14 08:31:07 PDT 2013


Thanks for the patch. I think it might be better to include strings.h
from cogl-util.h instead because it is only needed for the wrapper for
the ffs function which is defined there. Perhaps this patch would be
better?

Regards,
- Neil

-- >8 --

strings.h is needed to use the ffs function which is wrapped by the
_cogl_util_ffs macro in cogl-util.h. Previously the inclusion of
strings.h was in cogl-texture-gl.c but it makes more sense to have it
in cogl-util.h where the wrapper is defined. It also needs to be made
conditional because the header is not always available.

Based on a patch by Fan Chun-wei.
---
 cogl/cogl-util.h                 | 4 ++++
 cogl/driver/gl/cogl-texture-gl.c | 2 --
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/cogl/cogl-util.h b/cogl/cogl-util.h
index 9f6bfff..05dd0b2 100644
--- a/cogl/cogl-util.h
+++ b/cogl/cogl-util.h
@@ -27,6 +27,10 @@
 #include <glib.h>
 #include <math.h>
 
+#ifdef HAVE_FFS
+#include <strings.h>
+#endif
+
 #include <cogl/cogl-defines.h>
 #include "cogl-types.h"
 
diff --git a/cogl/driver/gl/cogl-texture-gl.c b/cogl/driver/gl/cogl-texture-gl.c
index a7dfc68..d4d1e4b 100644
--- a/cogl/driver/gl/cogl-texture-gl.c
+++ b/cogl/driver/gl/cogl-texture-gl.c
@@ -24,8 +24,6 @@
 #include "config.h"
 #endif
 
-#include <strings.h>
-
 #include "cogl-context-private.h"
 #include "cogl-util-gl-private.h"
 #include "cogl-texture-gl-private.h"
-- 
1.7.11.3.g3c3efa5



More information about the Cogl mailing list