[recipes] Move strv helpers to gr-utils



commit 9d374599d18582f8ff3db4a336bd2b370ba58522
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun May 7 08:59:47 2017 -0400

    Move strv helpers to gr-utils
    
    This is where they belong.

 src/gr-recipe-store.c |   43 -------------------------------------------
 src/gr-utils.c        |   42 ++++++++++++++++++++++++++++++++++++++++++
 src/gr-utils.h        |    7 +++++++
 3 files changed, 49 insertions(+), 43 deletions(-)
---
diff --git a/src/gr-recipe-store.c b/src/gr-recipe-store.c
index 118c484..c9bce32 100644
--- a/src/gr-recipe-store.c
+++ b/src/gr-recipe-store.c
@@ -1637,49 +1637,6 @@ gr_recipe_store_get_all_ingredients (GrRecipeStore *self,
         return result;
 }
 
-static void
-strv_prepend (char       ***strv_in,
-              const char   *s)
-{
-        char **strv;
-        int length;
-        int i;
-
-        length = g_strv_length (*strv_in);
-        strv = g_new (char *, length + 2);
-        strv[0] = g_strdup (s);
-        for (i = 0; i < length; i++)
-                strv[i + 1] = (*strv_in)[i];
-        strv[length + 1] = NULL;
-
-        g_free (*strv_in);
-        *strv_in = strv;
-}
-
-static void
-strv_remove (char       ***strv_in,
-             const char   *s)
-{
-        int i, j;
-        char **strv;
-        int length;
-
-        length = g_strv_length (*strv_in);
-        strv = g_new (char *, length + 1);
-
-        for (i = 0, j = 0; i < length; i++) {
-                if (strcmp ((*strv_in)[i], s) == 0) {
-                        g_free ((*strv_in)[i]);
-                        continue;
-                }
-                strv[j++] = (*strv_in)[i];
-        }
-        strv[j] = NULL;
-
-        g_free (*strv_in);
-        *strv_in = strv;
-}
-
 void
 gr_recipe_store_add_favorite (GrRecipeStore *self,
                               GrRecipe      *recipe)
diff --git a/src/gr-utils.c b/src/gr-utils.c
index c059be5..93f4d68 100644
--- a/src/gr-utils.c
+++ b/src/gr-utils.c
@@ -796,3 +796,45 @@ pixbuf_blur (GdkPixbuf *src, gint radius, gint iterations)
                 pixbuf_blur_private (src, tmp, radius, div_kernel_size);
 }
 
+void
+strv_prepend (char       ***strv_in,
+              const char   *s)
+{
+        char **strv;
+        int length;
+        int i;
+
+        length = g_strv_length (*strv_in);
+        strv = g_new (char *, length + 2);
+        strv[0] = g_strdup (s); 
+        for (i = 0; i < length; i++)
+                strv[i + 1] = (*strv_in)[i];
+        strv[length + 1] = NULL;
+
+        g_free (*strv_in);
+        *strv_in = strv;
+}
+
+void
+strv_remove (char       ***strv_in,
+             const char   *s)
+{
+        int i, j;
+        char **strv;
+        int length;
+
+        length = g_strv_length (*strv_in);
+        strv = g_new (char *, length + 1);
+
+        for (i = 0, j = 0; i < length; i++) {
+                if (strcmp ((*strv_in)[i], s) == 0) {
+                        g_free ((*strv_in)[i]);
+                        continue;
+                }
+                strv[j++] = (*strv_in)[i];
+        }
+        strv[j] = NULL;
+
+        g_free (*strv_in);
+        *strv_in = strv;
+}
diff --git a/src/gr-utils.h b/src/gr-utils.h
index 3a8c79a..3367ef6 100644
--- a/src/gr-utils.h
+++ b/src/gr-utils.h
@@ -81,3 +81,10 @@ char *import_image (const char *path);
 char *rotate_image (const char *path,
                     int         angle);
 void  remove_image (const char *path);
+
+void strv_remove (char       ***strv_in,
+                  const char   *s);
+void strv_prepend (char       ***strv_in,
+                   const char   *s);
+
+


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