]> git.mdlowis.com Git - archive/afm.git/commitdiff
remove unnecessary variable
authorabellenir <a@bellenir.com>
Sat, 26 Jul 2014 06:58:23 +0000 (06:58 +0000)
committerabellenir <a@bellenir.com>
Sat, 26 Jul 2014 06:58:23 +0000 (06:58 +0000)
source/workdir.c

index 4e1ff2da6b494cffe7a2c37cb5f9630da108effb..4f6b9dc3b17965e09a3da6345138ea86ca5b8761 100644 (file)
@@ -130,19 +130,17 @@ void workdir_ls(WorkDir_T* wd){
     wd->vfiles = vec_new(0);
     if(dd) vec_push_back(wd->vfiles, dd);
     while ((read = getline(&filename, &len, ls)) != -1){
-        char* fullpath = mem_allocate((pathlength+read+1)*sizeof(char), NULL);
-        int filename_offset = pathlength;
         File_T* file = mem_allocate(sizeof(File_T), &file_free);
+        file->path = mem_allocate((pathlength+read+1)*sizeof(char), NULL);
+        int filename_offset = pathlength;
         filename[read-1]=0; //remove ending newline
         //build full path:
-        strcpy(fullpath, wd->path);
+        strcpy(file->path, wd->path);
         if (wd->path[pathlength-1] != '/') {
-            strcat(fullpath, "/");
+            strcat(file->path, "/");
             filename_offset += 1;
         }
-        strcat(fullpath, filename);
-        //build file:
-        file->path = fullpath;
+        strcat(file->path, filename);
         file->name = &(file->path[filename_offset]);
         vec_push_back(wd->vfiles, file);
     }