change local_resource_new signature

Sun, 14 Apr 2019 19:39:08 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 14 Apr 2019 19:39:08 +0200
changeset 573
b8f798d240ab
parent 572
1eac93fcef77
child 574
c36eddf167a8

change local_resource_new signature

dav/sync.c file | annotate | diff | comparison | revisions
dav/sync.h file | annotate | diff | comparison | revisions
--- a/dav/sync.c	Sun Apr 14 16:28:36 2019 +0200
+++ b/dav/sync.c	Sun Apr 14 19:39:08 2019 +0200
@@ -2332,9 +2332,8 @@
                 }
                 
                 char *new_path = util_concat_path(p, ent->name);
-                int isdir = 0;
-                LocalResource *res = local_resource_new(dir, db, new_path, &isdir);
-                if(isdir) {
+                LocalResource *res = local_resource_new(dir, db, new_path);
+                if(res->isdirectory) {
                     resources = ucx_list_append(resources, res);
                     stack = ucx_list_prepend(stack, new_path);
                 } else if(res) {
@@ -2383,8 +2382,7 @@
             value = sstrdup(value);
             
             if(!sstrcmp(name, S("put"))) {
-                int isdir;
-                LocalResource *res = local_resource_new(dir, db, value.ptr, &isdir);
+                LocalResource *res = local_resource_new(dir, db, value.ptr);
                 if(res) {
                     resources = ucx_list_append(resources, res);
                 }
@@ -2400,7 +2398,7 @@
     return resources;
 }
 
-LocalResource* local_resource_new(SyncDirectory *dir, SyncDatabase *db, char *path, int *isdir) {
+LocalResource* local_resource_new(SyncDirectory *dir, SyncDatabase *db, char *path) {
     char *file_path = create_local_path(dir, path);
     SYS_STAT s;
     if(sys_stat(file_path, &s)) {
@@ -2411,7 +2409,6 @@
     free(file_path);
 
     if(!S_ISDIR(s.st_mode)) {
-        *isdir = 0;
         LocalResource *res = calloc(1, sizeof(LocalResource));
         res->path = strdup(path);
         res->etag = NULL;
@@ -2422,7 +2419,6 @@
         res->gid = s.st_gid;
         return res;
     } else {
-        *isdir = 1;
         LocalResource *res = calloc(1, sizeof(LocalResource));
         res->path = util_concat_path(path, "/");
         res->last_modified = s.st_mtime;
--- a/dav/sync.h	Sun Apr 14 16:28:36 2019 +0200
+++ b/dav/sync.h	Sun Apr 14 19:39:08 2019 +0200
@@ -129,7 +129,7 @@
 
 UcxList* local_scan(SyncDirectory *dir, SyncDatabase *db);
 UcxList* read_changes(SyncDirectory *dir, SyncDatabase *db);
-LocalResource* local_resource_new(SyncDirectory *dir, SyncDatabase *db, char *path, int *isdir);
+LocalResource* local_resource_new(SyncDirectory *dir, SyncDatabase *db, char *path);
 int local_resource_is_changed(
         SyncDirectory *dir,
         SyncDatabase *db,

mercurial