[mutter/wip/nielsdg/cleanup-cogl-util: 1/5] cogl: Remove cogl_util_memmem() macro



commit be72b229641b0c8c4a738d5ad761001feb960736
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Mon Jun 17 23:20:10 2019 +0200

    cogl: Remove cogl_util_memmem() macro
    
    `cogl_util_memmem` was used as a wrapper in case `memmem` wasn't
    defined, but since commit 46942c24 these are required. In case of
    `memmem`, we didn't explicitly require this in the meson build files, so
    add that as well.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/629

 cogl/cogl/cogl-gles2-context.c | 16 ++++++++--------
 cogl/cogl/cogl-util.h          |  2 --
 meson.build                    |  1 +
 3 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/cogl/cogl/cogl-gles2-context.c b/cogl/cogl/cogl-gles2-context.c
index 784c68c25..2f6b87b55 100644
--- a/cogl/cogl/cogl-gles2-context.c
+++ b/cogl/cogl/cogl-gles2-context.c
@@ -159,10 +159,10 @@ replace_token (char *string,
 
   /* NOTE: this assumes token and replacement are the same length */
 
-  while ((token_pos = _cogl_util_memmem (last_pos,
-                                         end - last_pos,
-                                         token,
-                                         token_length)))
+  while ((token_pos = memmem (last_pos,
+                              end - last_pos,
+                              token,
+                              token_length)))
     {
       /* Make sure this isn't in the middle of some longer token */
       if ((token_pos <= string ||
@@ -908,10 +908,10 @@ gl_get_shader_source_wrapper (GLuint shader,
 
       /* Strip out the wrapper snippet we added when the source was
        * specified */
-      wrapper_start = _cogl_util_memmem (source,
-                                         copy_length,
-                                         wrapper_marker,
-                                         sizeof (wrapper_marker) - 1);
+      wrapper_start = memmem (source,
+                              copy_length,
+                              wrapper_marker,
+                              sizeof (wrapper_marker) - 1);
       if (wrapper_start)
         {
           length = wrapper_start - source;
diff --git a/cogl/cogl/cogl-util.h b/cogl/cogl/cogl-util.h
index 4e4bd3247..912cc893e 100644
--- a/cogl/cogl/cogl-util.h
+++ b/cogl/cogl/cogl-util.h
@@ -163,8 +163,6 @@ _cogl_util_pixel_format_from_masks (unsigned long r_mask,
 #define _COGL_STATIC_ASSERT(EXPRESSION, MESSAGE) \
   _Static_assert (EXPRESSION, MESSAGE);
 
-#define _cogl_util_memmem memmem
-
 static inline void
 _cogl_util_scissor_intersect (int rect_x0,
                               int rect_y0,
diff --git a/meson.build b/meson.build
index db316507e..adc9faacc 100644
--- a/meson.build
+++ b/meson.build
@@ -272,6 +272,7 @@ endif
 required_functions = [
   'ffs',
   'clz',
+  'memmem',
 ]
 foreach function : required_functions
   if not cc.has_function(function)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]