Code

apply whitespace cosmetics to the license comments
[ncmpc.git] / src / filelist.c
index 46b9a1c8d82820d263be67aaee84a119d4b7a0fd..5138fdbcee86f25d65eb8e0941eb43a6ef2dc172 100644 (file)
@@ -1,21 +1,21 @@
 /* ncmpc (Ncurses MPD Client)
- * (c) 2004-2009 The Music Player Daemon Project
+ * (c) 2004-2010 The Music Player Daemon Project
  * Project homepage: http://musicpd.org
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
-
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
-
+ *
  * You should have received a copy of the GNU General Public License along
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
+ */
 
 #include "filelist.h"
 
@@ -139,15 +139,11 @@ filelist_sort_dir_play(struct filelist *filelist, GCompareFunc compare_func)
 
        if (filelist->entries->len < 2)
                return;
+
+       /* If the first entry is NULL, skip it, because NULL stands for "[..]" */
        iter = ((struct filelist_entry*) g_ptr_array_index(filelist->entries, 0))->entity;
-       /* This can only happen at the beginning of the filelist,
-        * because NULL stands for "[..]" */
-       if (iter == NULL) {
-               iter = ((struct filelist_entry*) g_ptr_array_index(filelist->entries, 1))->entity;
-               first = 1;
-       }
-       else
-               first = 0;
+       first = (iter == NULL)? 1 : 0;
+
        /* find the last directory entry */
        for (last = first+1; last < filelist->entries->len; last++) {
                iter = ((struct filelist_entry*) g_ptr_array_index(filelist->entries, last))->entity;