]> git.tuebingen.mpg.de Git - paraslash.git/commit - fd.c
Avoid gcc warning on FreeBSD.
authorAndre Noll <maan@systemlinux.org>
Tue, 23 Jul 2013 07:23:32 +0000 (09:23 +0200)
committerAndre Noll <maan@systemlinux.org>
Wed, 4 Sep 2013 22:23:13 +0000 (22:23 +0000)
commitfb9209248297242c899ac270afa5ad45b2d084f7
tree639636c20242580df317a9f07a37605074730aa9
parent778af7a6c357d7c784e6e32781c06351cdff56a7
Avoid gcc warning on FreeBSD.

FreeBSD 9.1 ships a patched gcc-4.2.1 which complains about use of
an initialized variable:

fd.c: In function 'for_each_file_in_dir':
fd.c:728: warning: 'dir' may be used uninitialized in this function

This warning is bogus since para_opendir() only leaves the dir
pointer unset on failures. But in this case for_each_file_in_dir()
returns early without using the pointer.

This commit changes para_opendir() to set dir to NULL before doing
anything else. This avoids the warning at almost no cost.
fd.c