summaryrefslogtreecommitdiffstats
path: root/vmchooser/readLinSess.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vmchooser/readLinSess.cxx')
-rw-r--r--vmchooser/readLinSess.cxx18
1 files changed, 10 insertions, 8 deletions
diff --git a/vmchooser/readLinSess.cxx b/vmchooser/readLinSess.cxx
index 0779937..6aa558b 100644
--- a/vmchooser/readLinSess.cxx
+++ b/vmchooser/readLinSess.cxx
@@ -14,6 +14,7 @@
#include <fstream>
#include <iostream>
#include <cstring>
+#include <vector>
#include "inc/DataEntry.h"
#include "inc/functions.h"
@@ -40,7 +41,7 @@ static glob_t* globber(char* path, const char* filetype)
}
-DataEntry** readLinSess(char* path)
+std::vector<DataEntry> readLinSess(char* path)
{
int MAX_LENGTH = 200;
@@ -49,20 +50,21 @@ DataEntry** readLinSess(char* path)
char* val;
if ( path== NULL) {
- return NULL;
+ std::vector<DataEntry>();
}
glob_t *gResult = (glob_t*) malloc(sizeof(glob_t));
gResult = globber(path, "*.desktop");
if ( gResult== NULL) {
- return NULL;
+ return std::vector<DataEntry>();
}
if ( gResult->gl_pathc == 0 ) {
- return NULL;
+ return std::vector<DataEntry>();
}
- DataEntry** result =
- (DataEntry**) malloc(gResult->gl_pathc * sizeof(DataEntry*) +1);
+ std::vector<DataEntry> result;
+ // DataEntry** result =
+ //(DataEntry**) malloc(gResult->gl_pathc * sizeof(DataEntry*) +1);
int c = 0;
@@ -109,14 +111,14 @@ DataEntry** readLinSess(char* path)
}
if(! (de->short_description.empty() || de->command.empty()) ) {
- result[c] = de;
+ result.push_back(*de);
c++;
}
else {
delete de;
}
}
- result[c] = NULL;
+ //result[c] = NULL;
return result;
}