summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2016-04-20 22:38:08 (GMT)
committer Vincent Sanders <vince@kyllikki.org>2016-04-20 22:38:08 (GMT)
commitdd31499bf969baa68e66fca81b9f95447b6f3f2a (patch)
treefac0255aa3b4b3b696a2573a51e8469843db051d
parent7ba291037b1dbd0cd205ba07e6444293596a3761 (diff)
downloadnetsurf-dd31499bf969baa68e66fca81b9f95447b6f3f2a.tar.gz
netsurf-dd31499bf969baa68e66fca81b9f95447b6f3f2a.tar.bz2
move remove underscores utility to alongside the single gtk call site
-rw-r--r--gtk/toolbar.c28
-rw-r--r--utils/utils.c22
-rw-r--r--utils/utils.h9
3 files changed, 28 insertions, 31 deletions
diff --git a/gtk/toolbar.c b/gtk/toolbar.c
index f5aa7fd..8012598 100644
--- a/gtk/toolbar.c
+++ b/gtk/toolbar.c
@@ -91,6 +91,34 @@ struct nsgtk_theme {
};
/**
+ * returns a string without its underscores
+ *
+ * \param s The string to change.
+ * \param replacespace true to insert a space where there was an underscore
+ * \return The altered string
+ */
+static char *remove_underscores(const char *s, bool replacespace)
+{
+ size_t i, ii, len;
+ char *ret;
+ len = strlen(s);
+ ret = malloc(len + 1);
+ if (ret == NULL) {
+ return NULL;
+ }
+ for (i = 0, ii = 0; i < len; i++) {
+ if (s[i] != '_') {
+ ret[ii++] = s[i];
+ } else if (replacespace) {
+ ret[ii++] = ' ';
+ }
+ }
+ ret[ii] = '\0';
+ return ret;
+}
+
+
+/**
* get default image for buttons / menu items from gtk stock items.
*
* \param tbbutton button reference
diff --git a/utils/utils.c b/utils/utils.c
index 19d5bf0..cde3fa3 100644
--- a/utils/utils.c
+++ b/utils/utils.c
@@ -43,28 +43,6 @@
#include "utils/utils.h"
/* exported interface documented in utils/utils.h */
-char *remove_underscores(const char *s, bool replacespace)
-{
- size_t i, ii, len;
- char *ret;
- len = strlen(s);
- ret = malloc(len + 1);
- if (ret == NULL) {
- return NULL;
- }
- for (i = 0, ii = 0; i < len; i++) {
- if (s[i] != '_') {
- ret[ii++] = s[i];
- } else if (replacespace) {
- ret[ii++] = ' ';
- }
- }
- ret[ii] = '\0';
- return ret;
-}
-
-
-/* exported interface documented in utils/utils.h */
char *squash_whitespace(const char *s)
{
char *c;
diff --git a/utils/utils.h b/utils/utils.h
index 6121ebe..71316af 100644
--- a/utils/utils.h
+++ b/utils/utils.h
@@ -128,15 +128,6 @@ struct dirent;
char * squash_whitespace(const char * s);
/**
- * returns a string without its underscores
- *
- * \param s The string to change.
- * \param replacespace true to insert a space where there was an underscore
- * \return The altered string
- */
-char *remove_underscores(const char *s, bool replacespace);
-
-/**
* Converts NUL terminated UTF-8 encoded string s containing zero or more
* spaces (char 32) or TABs (char 9) to non-breaking spaces
* (0xC2 + 0xA0 in UTF-8 encoding).