1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-16 23:15:19 +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 #ifdef HAVE_LIBOPK
{ {
struct dirent *dptr;
DIR *dirp = opendir(CARD_ROOT); DIR *dirp = opendir(CARD_ROOT);
if (dirp) { if (dirp) {
struct dirent *dptr;
while ((dptr = readdir(dirp))) { while ((dptr = readdir(dirp))) {
if (dptr->d_type != DT_DIR) if (dptr->d_type != DT_DIR)
continue; continue;
@ -108,12 +108,10 @@ Menu::~Menu()
void Menu::readSections(std::string const& parentDir) void Menu::readSections(std::string const& parentDir)
{ {
DIR *dirp; DIR *dirp = opendir(parentDir.c_str());
struct dirent *dptr;
dirp = opendir(parentDir.c_str());
if (!dirp) return; if (!dirp) return;
struct dirent *dptr;
while ((dptr = readdir(dirp))) { while ((dptr = readdir(dirp))) {
if (dptr->d_name[0] != '.' && dptr->d_type == DT_DIR) { if (dptr->d_name[0] != '.' && dptr->d_type == DT_DIR) {
// Create section if it doesn't exist yet. // Create section if it doesn't exist yet.