summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Herlant <aerostitch@debian.org>2019-10-20 16:01:48 -0700
committerJoseph Herlant <aerostitch@debian.org>2019-10-20 16:01:48 -0700
commitb9f310f3ef4883f7e5f6b52170f7c4265b10b47a (patch)
tree8b7ad8495d105a18ff3a8422b243324ce9b54dae
parentf1c04298943f3fe480ba0240485013b03b6d7f67 (diff)
downloadnavit-b9f310f3ef4883f7e5f6b52170f7c4265b10b47a.tar.gz
cleanup:search:Remove duplicate code for search_fix_spaces
-rw-r--r--navit/android.c29
-rw-r--r--navit/search.c2
-rw-r--r--navit/search.h1
3 files changed, 2 insertions, 30 deletions
diff --git a/navit/android.c b/navit/android.c
index f35cb274a..bddc48be8 100644
--- a/navit/android.c
+++ b/navit/android.c
@@ -680,35 +680,6 @@ static void android_search_idle(struct android_search_priv *search_priv) {
dbg(lvl_info, "leave");
}
-static char *search_fix_spaces(const char *str) {
- int i;
- int len=strlen(str);
- char c,*s,*d,*ret=g_strdup(str);
-
- for (i = 0 ; i < len ; i++) {
- if (ret[i] == ',' || ret[i] == '/')
- ret[i]=' ';
- }
- s=ret;
- d=ret;
- len=0;
- do {
- c=*s++;
- if (c != ' ' || len != 0) {
- *d++=c;
- len++;
- }
- while (c == ' ' && *s == ' ')
- s++;
- if (c == ' ' && *s == '\0') {
- d--;
- len--;
- }
- } while (c);
-
- return ret;
-}
-
static void start_search(struct android_search_priv *search_priv, const char *search_string) {
dbg(lvl_debug,"enter %s", search_string);
char *str=search_fix_spaces(search_string);
diff --git a/navit/search.c b/navit/search.c
index 06afcbfe6..27d5de10f 100644
--- a/navit/search.c
+++ b/navit/search.c
@@ -141,7 +141,7 @@ static char *search_fix_spaces(char *str) {
char c,*s,*d,*ret=g_strdup(str);
for (i = 0 ; i < len ; i++) {
- if (ret[i] == ',' || ret[i] == ',' || ret[i] == '/')
+ if (ret[i] == ',' || ret[i] == '/')
ret[i]=' ';
}
s=ret;
diff --git a/navit/search.h b/navit/search.h
index 50756606f..8d7976669 100644
--- a/navit/search.h
+++ b/navit/search.h
@@ -87,6 +87,7 @@ char *search_list_get_unique(struct search_list *this_, char *unique);
struct search_list_result *search_list_get_result(struct search_list *this_);
void search_list_destroy(struct search_list *this_);
void search_init(void);
+static char *search_fix_spaces(char *str);
/* end of prototypes */
#ifdef __cplusplus
}