summaryrefslogtreecommitdiff
path: root/tbdiff/tbdiff-stat.h
diff options
context:
space:
mode:
authorBen Brewer <ben.brewer@codethink.co.uk>2014-05-30 16:04:21 +0100
committerBen Brewer <ben.brewer@codethink.co.uk>2014-06-02 15:53:42 +0100
commit539ccd77d3017965cd70444ba80ce95799d9337d (patch)
treefd149d1f4c2baf1c42cd46d62dc3da4d981e7cc9 /tbdiff/tbdiff-stat.h
parent5e7c9554d4685026e80c95e9efa8a4dae0f399de (diff)
downloadtbdiff-539ccd77d3017965cd70444ba80ce95799d9337d.tar.gz
Remove use of typedef to avoid naming conflicts with POSIX
POSIX reserves the use of the underscore T postfix for types, since most of the time we don't actually need to typedef the types and since it's more clear to prefix structs and enums with the struct and enum keywords, I've removed all uses of typedef and gone with the more simple approach used in the kernel. One typedef remains which is tbd_cmd_type, since this should be a native type of a fixed size. The postfix changed to type to show that it's a type and to ensure it doesn't collide with POSIX.
Diffstat (limited to 'tbdiff/tbdiff-stat.h')
-rw-r--r--tbdiff/tbdiff-stat.h44
1 files changed, 21 insertions, 23 deletions
diff --git a/tbdiff/tbdiff-stat.h b/tbdiff/tbdiff-stat.h
index e4703d9..6f4c93e 100644
--- a/tbdiff/tbdiff-stat.h
+++ b/tbdiff/tbdiff-stat.h
@@ -27,7 +27,7 @@
#include <stdbool.h>
#include <sys/types.h>
-typedef enum {
+enum tbd_stat_type {
TBD_STAT_TYPE_FILE = 'f',
TBD_STAT_TYPE_DIR = 'd',
TBD_STAT_TYPE_SYMLINK = 'l',
@@ -35,30 +35,28 @@ typedef enum {
TBD_STAT_TYPE_BLKDEV = 'b',
TBD_STAT_TYPE_FIFO = 'p',
TBD_STAT_TYPE_SOCKET = 's'
-} tbd_stat_type_e;
-
-typedef struct tbd_stat_s tbd_stat_t;
+};
-struct tbd_stat_s {
- tbd_stat_t* parent;
- char* name;
- tbd_stat_type_e type;
- time_t mtime;
- uint32_t size; /* Count for directory. */
- uid_t uid;
- gid_t gid;
- mode_t mode;
- uint32_t rdev;
+struct tbd_stat {
+ struct tbd_stat* parent;
+ char* name;
+ enum tbd_stat_type type;
+ time_t mtime;
+ uint32_t size; /* Count for directory. */
+ uid_t uid;
+ gid_t gid;
+ mode_t mode;
+ uint32_t rdev;
};
-tbd_stat_t* tbd_stat(const char *path);
-void tbd_stat_free(tbd_stat_t *file);
-void tbd_stat_print(tbd_stat_t *file);
-tbd_stat_t* tbd_stat_entry(tbd_stat_t *file, uint32_t entry);
-tbd_stat_t* tbd_stat_entry_find(tbd_stat_t *file, const char *name);
-char* tbd_stat_subpath(tbd_stat_t *file, const char *entry);
-char* tbd_stat_path(tbd_stat_t *file);
-int tbd_stat_open(tbd_stat_t *file, int flags);
-FILE* tbd_stat_fopen(tbd_stat_t *file, const char *mode);
+struct tbd_stat* tbd_stat(const char *path);
+void tbd_stat_free(struct tbd_stat *file);
+void tbd_stat_print(struct tbd_stat *file);
+struct tbd_stat* tbd_stat_entry(struct tbd_stat *file, uint32_t entry);
+struct tbd_stat* tbd_stat_entry_find(struct tbd_stat *file, const char *name);
+char* tbd_statubpath(struct tbd_stat *file, const char *entry);
+char* tbd_stat_path(struct tbd_stat *file);
+int tbd_stat_open(struct tbd_stat *file, int flags);
+FILE* tbd_stat_fopen(struct tbd_stat *file, const char *mode);
#endif /* !__TBDIFF_STAT_H__ */