diff options
author | Joseph Hunkeler <jhunkeler@users.noreply.github.com> | 2020-06-03 00:10:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-03 00:10:25 -0400 |
commit | d12170bb0cb936f1e48a677dbd96822db55bbda3 (patch) | |
tree | 1bd69fbd6460dff6f50e7a13e54693a534590104 /include/fs.h | |
parent | 6c140c35ae7bf2b5e6633f63e2bc2fba14fc22bc (diff) | |
download | spmc-d12170bb0cb936f1e48a677dbd96822db55bbda3.tar.gz |
Refactor fstree (#39)
* Refactor fstree, fstree_free, FSTree type
* Add FSRec structure
* Refactor fstree usage
* Decrease starting size of FSTree structure
* Check if ManifestPackage is NULL, not if the requirements array if NULL
* Use num_requirements instead of '!= NULL'
* Add fstree test
Diffstat (limited to 'include/fs.h')
-rw-r--r-- | include/fs.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/include/fs.h b/include/fs.h index 81acd92..0698871 100644 --- a/include/fs.h +++ b/include/fs.h @@ -11,11 +11,15 @@ #define SPM_FSTREE_FLT_RELATIVE 1 << 4 typedef struct { + char *name; + struct stat *st; +} FSRec; + +typedef struct { char *root; - char **dirs; - size_t dirs_length; - char **files; - size_t files_length; + FSRec **record; + size_t num_records; + size_t _num_alloc; } FSTree; typedef struct { @@ -28,6 +32,7 @@ typedef struct { int _fstree_compare(const FTSENT **a, const FTSENT **b); FSTree *fstree(const char *_path, char **filter_by, unsigned int filter_mode); void fstree_free(FSTree *fsdata); +char *fstree_search(FSTree *fsdata, char *path); FSList *fslist(const char *path); void fslist_free(FSList *fsdata); int exists(const char *filename); |