commit 5b54b189c3ffc6baa175cf6d5d2016338b13793b
parent 1fd32e5b1d0120857f5162a9c9255b5393a2d2e5
Author: Kyle Milz <kyle@0x30.net>
Date: Sun, 11 Dec 2016 13:20:15 -0700
src: pass back concrete vector instead of pointer
Diffstat:
3 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/src/gl_main.cc b/src/gl_main.cc
@@ -93,12 +93,9 @@ add_new_process(std::string const &file_name)
void
next_frame(View *vu)
{
- std::vector<std::string> *new_files = m_pdir.scan();
- for (std::string &file_name : *new_files)
+ for (std::string &file_name : m_pdir.scan())
add_new_process(file_name);
- delete new_files;
-
for (auto &rp : drawables) {
// rp.read_executions();
@@ -115,8 +112,6 @@ next_frame(View *vu)
}
std::cout << "tick" << std::endl;
}
-
- // glutPostRedisplay ();
}
static void
diff --git a/src/process_dir.cc b/src/process_dir.cc
@@ -14,14 +14,12 @@ ProcessDir::ProcessDir()
err(1, "opendir");
}
-std::vector<std::string> *
+std::vector<std::string>
ProcessDir::scan()
{
- std::vector<std::string> *new_files;
+ std::vector<std::string> new_files;
struct dirent *dp;
- new_files = new std::vector<std::string>();
-
rewinddir(m_dirp);
while ((dp = readdir(m_dirp)) != NULL) {
@@ -37,7 +35,7 @@ ProcessDir::scan()
continue;
m_known_files.insert(p);
- new_files->push_back(p);
+ new_files.push_back(p);
}
return new_files;
diff --git a/src/process_dir.h b/src/process_dir.h
@@ -8,7 +8,7 @@
class ProcessDir {
public:
ProcessDir();
- std::vector<std::string> *scan();
+ std::vector<std::string> scan();
private:
const char *m_procdir;