[gnome-software/gnome-3-20] Use as_utils_string_replace() rather than our own buggy version
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/gnome-3-20] Use as_utils_string_replace() rather than our own buggy version
- Date: Mon, 14 Mar 2016 11:25:44 +0000 (UTC)
commit b15db5119bfee79bb3367bfbff5c972e44583207
Author: Richard Hughes <richard hughsie com>
Date: Fri Mar 4 08:38:11 2016 +0000
Use as_utils_string_replace() rather than our own buggy version
configure.ac | 2 +-
src/gs-app-addon-row.c | 2 +-
src/gs-app-row.c | 2 +-
src/gs-utils.c | 37 -------------------------------
src/gs-utils.h | 3 --
src/plugins/gs-plugin-xdg-app-reviews.c | 2 +-
6 files changed, 4 insertions(+), 44 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d0a606b..4a5643a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,7 +61,7 @@ dnl ---------------------------------------------------------------------------
dnl - Check library dependencies
dnl ---------------------------------------------------------------------------
PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.18.2 gio-unix-2.0 gtkspell3-3.0)
-PKG_CHECK_MODULES(APPSTREAM, appstream-glib >= 0.5.10)
+PKG_CHECK_MODULES(APPSTREAM, appstream-glib >= 0.5.11)
PKG_CHECK_MODULES(GDK_PIXBUF, gdk-pixbuf-2.0 >= 2.31.5)
PKG_CHECK_MODULES(JSON_GLIB, json-glib-1.0 >= 1.1.1)
PKG_CHECK_MODULES(SQLITE, sqlite3)
diff --git a/src/gs-app-addon-row.c b/src/gs-app-addon-row.c
index c488b41..9682a97 100644
--- a/src/gs-app-addon-row.c
+++ b/src/gs-app-addon-row.c
@@ -79,7 +79,7 @@ gs_app_addon_row_refresh (GsAppAddonRow *row)
/* join the lines */
str = gs_app_addon_row_get_summary (row);
- gs_string_replace (str, "\n", " ");
+ as_utils_string_replace (str, "\n", " ");
gtk_label_set_markup (GTK_LABEL (row->description_label), str->str);
gtk_label_set_label (GTK_LABEL (row->name_label),
gs_app_get_name (row->app));
diff --git a/src/gs-app-row.c b/src/gs-app-row.c
index 3cba9c9..a4bf018 100644
--- a/src/gs-app-row.c
+++ b/src/gs-app-row.c
@@ -145,7 +145,7 @@ gs_app_row_refresh (GsAppRow *app_row)
/* join the description lines */
str = gs_app_row_get_description (app_row);
if (str != NULL) {
- gs_string_replace (str, "\n", " ");
+ as_utils_string_replace (str, "\n", " ");
gtk_label_set_markup (GTK_LABEL (priv->description_label), str->str);
g_string_free (str, TRUE);
} else {
diff --git a/src/gs-utils.c b/src/gs-utils.c
index 22c8a2a..2201c46 100644
--- a/src/gs-utils.c
+++ b/src/gs-utils.c
@@ -342,43 +342,6 @@ gs_app_show_url (GsApp *app, AsUrlKind kind)
g_warning ("spawn of '%s' failed", url);
}
-guint
-gs_string_replace (GString *string, const gchar *search, const gchar *replace)
-{
- gchar *tmp;
- guint count = 0;
- guint replace_len;
- guint search_len;
-
- search_len = strlen (search);
- replace_len = strlen (replace);
-
- do {
- tmp = g_strstr_len (string->str, -1, search);
- if (tmp == NULL)
- goto out;
-
- /* reallocate the string if required */
- if (search_len > replace_len) {
- g_string_erase (string,
- tmp - string->str,
- search_len - replace_len);
- }
- if (search_len < replace_len) {
- g_string_insert_len (string,
- tmp - string->str,
- search,
- replace_len - search_len);
- }
-
- /* just memcmp in the new string */
- memcpy (tmp, replace, replace_len);
- count++;
- } while (TRUE);
-out:
- return count;
-}
-
/**
* gs_mkdir_parent:
**/
diff --git a/src/gs-utils.h b/src/gs-utils.h
index 2abdbf3..f65e6e5 100644
--- a/src/gs-utils.h
+++ b/src/gs-utils.h
@@ -47,9 +47,6 @@ GtkResponseType
void gs_app_show_url (GsApp *app,
AsUrlKind kind);
-guint gs_string_replace (GString *string,
- const gchar *search,
- const gchar *replace);
gboolean gs_mkdir_parent (const gchar *path,
GError **error);
diff --git a/src/plugins/gs-plugin-xdg-app-reviews.c b/src/plugins/gs-plugin-xdg-app-reviews.c
index 1ec77f1..395b110 100644
--- a/src/plugins/gs-plugin-xdg-app-reviews.c
+++ b/src/plugins/gs-plugin-xdg-app-reviews.c
@@ -958,7 +958,7 @@ gs_plugin_create_app_dummy (const gchar *id)
GsApp *app = gs_app_new (id);
g_autoptr(GString) str = NULL;
str = g_string_new (id);
- gs_string_replace (str, ".desktop", "");
+ as_utils_string_replace (str, ".desktop", "");
g_string_prepend (str, "No description is available for ");
gs_app_set_name (app, GS_APP_QUALITY_LOWEST, "Unknown Application");
gs_app_set_summary (app, GS_APP_QUALITY_LOWEST, "Application not found");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]