Fix assumptions of "dir.list->len == 0".
commitbb45f8407167650b2bdbbc898f2423207db8b084
authorMooffie <mooffie@gmail.com>
Fri, 3 Mar 2017 13:30:19 +0000 (3 15:30 +0200)
committerMooffie <mooffie@gmail.com>
Tue, 18 Apr 2017 17:09:44 +0000 (18 20:09 +0300)
tree99ccd9990184ff98441c6991d92c85c777f39d1b
parentc9f058e65bc18ee1e6b1874733863df4746d075f
Fix assumptions of "dir.list->len == 0".

`dir.list->len` can't be zero because we're always checking it after a call to
dir_list_init(), which populated the list with "..".

Therefore any code that checks for zero is either superfluous or a bug.

As for the modifications in find.c:

  - The bug caused us not to call panel_clean_dir(), and this caused:
    - Memory leaks resulting from calling dir_list_init() without
      dir_list_clean() first.
    - The "total size" of selected files (for example) wasn't getting cleared.

  - We remove the `if (list->len != 0)` around the
    `current_panel->is_panelized = TRUE; ...` for several reasons:
    - The code isn't called anyway if no files were found.
    - Conceptually, there's no point in distinguishing an empty listing from an
      empty panelized listing.
    - It's the de-facto current behavior (as `list->len != 0` always)

Signed-off-by: Mooffie <mooffie@gmail.com>
src/filemanager/find.c
src/filemanager/panelize.c