Code

screen_search: moved search calls to do_search()
authorMax Kellermann <max@duempel.org>
Fri, 2 Oct 2009 08:53:47 +0000 (10:53 +0200)
committerMax Kellermann <max@duempel.org>
Fri, 2 Oct 2009 08:53:47 +0000 (10:53 +0200)
src/screen_search.c

index 269fedd058649529aca768d476e2de67c5bb6860..1710f5af0705df86f14728c11589be7cb3bf8726 100644 (file)
@@ -297,6 +297,20 @@ search_advanced_query(char *query, struct mpdclient *c)
        return fl;
 }
 
+static struct filelist *
+do_search(struct mpdclient *c, char *query)
+{
+       struct filelist *fl;
+
+       fl = search_advanced_query(query, c);
+       if (!advanced_search_mode && browser.filelist == NULL)
+               return filelist_search(c, FALSE,
+                                      mode[options.search_mode].table,
+                                      query);
+
+       return fl;
+}
+
 static void
 search_new(struct mpdclient *c)
 {
@@ -321,12 +335,7 @@ search_new(struct mpdclient *c)
                browser.filelist = NULL;
        }
 
-       browser.filelist = search_advanced_query(pattern, c);
-       if (!advanced_search_mode && browser.filelist == NULL)
-               browser.filelist = filelist_search(c, FALSE,
-                                                 mode[options.search_mode].table,
-                                                 pattern);
-
+       browser.filelist = do_search(c, pattern);
        if (browser.filelist == NULL)
                browser.filelist = filelist_new();