Code

code style, indent with tabs III
authorMax Kellermann <max@duempel.org>
Wed, 17 Sep 2008 10:03:43 +0000 (12:03 +0200)
committerMax Kellermann <max@duempel.org>
Wed, 17 Sep 2008 10:03:43 +0000 (12:03 +0200)
Follow the same code style als MPD itself.

src/mpdclient.c
src/screen.c
src/screen_search.c

index 58a3e8fb7152e4a48d0c6a7ec2338bbd0709a495..2318dcffc4465b2a38578f9235ed7962f3d84581 100644 (file)
@@ -739,113 +739,106 @@ mpdclient_playlist_update_changes(mpdclient_t *c)
 mpdclient_filelist_t *
 mpdclient_filelist_free(mpdclient_filelist_t *filelist)
 {
-  GList *list = g_list_first(filelist->list);
-
-  D("mpdclient_filelist_free()\n");
-  if( list == NULL )
-    return NULL;
-  while( list!=NULL )
-    {
-      filelist_entry_t *entry = list->data;
-
-      if( entry->entity )
-       mpd_freeInfoEntity(entry->entity);
-      g_free(entry);
-      list=list->next;
-    }
-  g_list_free(filelist->list);
-  g_free(filelist->path);
-  filelist->path = NULL;
-  filelist->list = NULL;
-  filelist->length = 0;
-  g_free(filelist);
+       GList *list = g_list_first(filelist->list);
+
+       D("mpdclient_filelist_free()\n");
+       if (list == NULL)
+               return NULL;
+       while (list != NULL) {
+               filelist_entry_t *entry = list->data;
+
+               if (entry->entity)
+                       mpd_freeInfoEntity(entry->entity);
+               g_free(entry);
+               list=list->next;
+       }
+       g_list_free(filelist->list);
+       g_free(filelist->path);
+       filelist->path = NULL;
+       filelist->list = NULL;
+       filelist->length = 0;
+       g_free(filelist);
 
-  return NULL;
+       return NULL;
 }
 
 
 mpdclient_filelist_t *
 mpdclient_filelist_get(mpdclient_t *c, const gchar *path)
 {
-  mpdclient_filelist_t *filelist;
-  mpd_InfoEntity *entity;
-  gchar *path_utf8 = locale_to_utf8(path);
-  gboolean has_dirs_only = TRUE;
+       mpdclient_filelist_t *filelist;
+       mpd_InfoEntity *entity;
+       gchar *path_utf8 = locale_to_utf8(path);
+       gboolean has_dirs_only = TRUE;
+
+       D("mpdclient_filelist_get(%s)\n", path);
+       mpd_sendLsInfoCommand(c->connection, path_utf8);
+       filelist = g_malloc0(sizeof(mpdclient_filelist_t));
+       if (path && path[0] && strcmp(path, "/")) {
+               /* add a dummy entry for ./.. */
+               filelist_entry_t *entry = g_malloc0(sizeof(filelist_entry_t));
+               entry->entity = NULL;
+               filelist->list = g_list_append(filelist->list, entry);
+               filelist->length++;
+       }
 
-  D("mpdclient_filelist_get(%s)\n", path);
-  mpd_sendLsInfoCommand(c->connection, path_utf8);
-  filelist = g_malloc0(sizeof(mpdclient_filelist_t));
-  if( path && path[0] && strcmp(path, "/") )
-    {
-      /* add a dummy entry for ./.. */
-      filelist_entry_t *entry = g_malloc0(sizeof(filelist_entry_t));
-      entry->entity = NULL;
-      filelist->list = g_list_append(filelist->list, (gpointer) entry);
-      filelist->length++;
-    }
+       while ((entity=mpd_getNextInfoEntity(c->connection))) {
+               filelist_entry_t *entry = g_malloc0(sizeof(filelist_entry_t));
 
-  while( (entity=mpd_getNextInfoEntity(c->connection)) ) 
-    {
-      filelist_entry_t *entry = g_malloc0(sizeof(filelist_entry_t));
-      
-      entry->entity = entity;
-      filelist->list = g_list_append(filelist->list, (gpointer) entry);
-      filelist->length++;
+               entry->entity = entity;
+               filelist->list = g_list_append(filelist->list, entry);
+               filelist->length++;
 
-      if (has_dirs_only && entity->type != MPD_INFO_ENTITY_TYPE_DIRECTORY)
-       {
-         has_dirs_only = FALSE;
+               if (has_dirs_only && entity->type != MPD_INFO_ENTITY_TYPE_DIRECTORY) {
+                       has_dirs_only = FALSE;
+               }
        }
-    }
-  
-   /* If there's an error, ignore it.  We'll return an empty filelist. */
-   mpdclient_finish_command(c);
-  
-  g_free(path_utf8);
-  filelist->path = g_strdup(path);
-  filelist->updated = TRUE;
 
-  // If there are only directory entities in the filelist, we sort it
-  if (has_dirs_only)
-    {
-      D("mpdclient_filelist_get: only dirs; sorting!\n");
-      filelist->list = g_list_sort(filelist->list, compare_filelistentry_dir);
-    }
+       /* If there's an error, ignore it.  We'll return an empty filelist. */
+       mpdclient_finish_command(c);
 
-  return filelist;
+       g_free(path_utf8);
+       filelist->path = g_strdup(path);
+       filelist->updated = TRUE;
+
+       // If there are only directory entities in the filelist, we sort it
+       if (has_dirs_only) {
+               D("mpdclient_filelist_get: only dirs; sorting!\n");
+               filelist->list = g_list_sort(filelist->list, compare_filelistentry_dir);
+       }
+
+       return filelist;
 }
 
 mpdclient_filelist_t *
-mpdclient_filelist_search_utf8(mpdclient_t *c, 
+mpdclient_filelist_search_utf8(mpdclient_t *c,
                               int exact_match,
-                              int table, 
+                              int table,
                               gchar *filter_utf8)
 {
-  mpdclient_filelist_t *filelist;
-  mpd_InfoEntity *entity;
+       mpdclient_filelist_t *filelist;
+       mpd_InfoEntity *entity;
 
-  D("mpdclient_filelist_search(%s)\n", filter_utf8);
-  if( exact_match )
-    mpd_sendFindCommand(c->connection, table, filter_utf8);
-  else
-    mpd_sendSearchCommand(c->connection, table, filter_utf8);
-  filelist = g_malloc0(sizeof(mpdclient_filelist_t));
+       D("mpdclient_filelist_search(%s)\n", filter_utf8);
+       if (exact_match)
+               mpd_sendFindCommand(c->connection, table, filter_utf8);
+       else
+               mpd_sendSearchCommand(c->connection, table, filter_utf8);
+       filelist = g_malloc0(sizeof(mpdclient_filelist_t));
 
-  while( (entity=mpd_getNextInfoEntity(c->connection)) ) 
-    {
-      filelist_entry_t *entry = g_malloc0(sizeof(filelist_entry_t));
-      
-      entry->entity = entity;
-      filelist->list = g_list_append(filelist->list, (gpointer) entry);
-      filelist->length++;
-    }
-  
-  if( mpdclient_finish_command(c) )
-    return mpdclient_filelist_free(filelist);
+       while ((entity=mpd_getNextInfoEntity(c->connection))) {
+               filelist_entry_t *entry = g_malloc0(sizeof(filelist_entry_t));
+
+               entry->entity = entity;
+               filelist->list = g_list_append(filelist->list, entry);
+               filelist->length++;
+       }
 
-  filelist->updated = TRUE;
+       if (mpdclient_finish_command(c))
+               return mpdclient_filelist_free(filelist);
 
-  return filelist;
+       filelist->updated = TRUE;
+       return filelist;
 }
 
 
index c616715bf884bfb45b383874c3c1a19a919dc1f9..0b335efa903f27bab16bdb1531ead40bddef391d 100644 (file)
@@ -626,17 +626,16 @@ screen_init(mpdclient_t *c)
 
        /* initialize screens */
        i=0;
-       while( screens[i].get_mode_functions )
-               {
-                       struct screen_functions *fn = screens[i].get_mode_functions();
+       while (screens[i].get_mode_functions) {
+               struct screen_functions *fn = screens[i].get_mode_functions();
 
-                       if( fn && fn->init )
-                               fn->init(screen->main_window.w,
-                                        screen->main_window.cols,
-                                        screen->main_window.rows);
+               if (fn && fn->init)
+                       fn->init(screen->main_window.w,
+                                screen->main_window.cols,
+                                screen->main_window.rows);
 
-                       i++;
-               }
+               i++;
+       }
 
 #if 0
        /* broken */
index 9ec189d0e23ae11fa6b5e340be484378560c7ff3..6e2a0d68ccdd93a749ba1d5e4a7c72599fe48cdd 100644 (file)
@@ -179,16 +179,14 @@ static void
 search_clear(mpd_unused screen_t *screen, mpdclient_t *c,
             gboolean clear_pattern)
 {
-  if( filelist )
-    {
-      mpdclient_remove_playlist_callback(c, playlist_changed_callback);
-      filelist = mpdclient_filelist_free(filelist);
-    }
-  if( clear_pattern && pattern )
-    {
-      g_free(pattern);
-      pattern = NULL;
-    }
+       if (filelist) {
+               mpdclient_remove_playlist_callback(c, playlist_changed_callback);
+               filelist = mpdclient_filelist_free(filelist);
+       }
+       if (clear_pattern && pattern) {
+               g_free(pattern);
+               pattern = NULL;
+       }
 }
 
 #ifdef FUTURE
@@ -366,20 +364,22 @@ search_new(screen_t *screen, mpdclient_t *c)
 static void
 init(WINDOW *w, int cols, int rows)
 {
-  lw = list_window_init(w, cols, rows);
+       lw = list_window_init(w, cols, rows);
 }
 
 static void
 quit(void)
 {
-  if( search_history )
-    string_list_free(search_history);
-  if( filelist )
-    filelist = mpdclient_filelist_free(filelist);
-  list_window_free(lw);
-  if( pattern )
-    g_free(pattern);
-  pattern = NULL;
+       if (search_history)
+               string_list_free(search_history);
+       if (filelist)
+               filelist = mpdclient_filelist_free(filelist);
+       list_window_free(lw);
+
+       if (pattern) {
+               g_free(pattern);
+               pattern = NULL;
+       }
 }
 
 static void