1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-22 01:04:03 +02:00

Declare "dirp" and "dptr" pointers just before they're needed

This commit is contained in:
Maarten ter Huurne 2015-04-25 15:41:58 +02:00
parent 510d67359c
commit 4159e6925b

View File

@ -81,9 +81,9 @@ Menu::Menu(GMenu2X& gmenu2x)
#ifdef HAVE_LIBOPK
{
struct dirent *dptr;
DIR *dirp = opendir(CARD_ROOT);
if (dirp) {
struct dirent *dptr;
while ((dptr = readdir(dirp))) {
if (dptr->d_type != DT_DIR)
continue;
@ -108,12 +108,10 @@ Menu::~Menu()
void Menu::readSections(std::string const& parentDir)
{
DIR *dirp;
struct dirent *dptr;
dirp = opendir(parentDir.c_str());
DIR *dirp = opendir(parentDir.c_str());
if (!dirp) return;
struct dirent *dptr;
while ((dptr = readdir(dirp))) {
if (dptr->d_name[0] != '.' && dptr->d_type == DT_DIR) {
// Create section if it doesn't exist yet.