From b2b1f00d0480a3abfec1a5e3f8eed33cf4accef4 Mon Sep 17 00:00:00 2001 From: Lephe Date: Tue, 19 Mar 2024 19:03:33 +0100 Subject: [PATCH] fs: take const descriptor in open_generic() --- include/gint/fs.h | 2 +- src/fs/fs.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/gint/fs.h b/include/gint/fs.h index 9fd9205..6831dd2 100644 --- a/include/gint/fs.h +++ b/include/gint/fs.h @@ -78,7 +78,7 @@ void fs_free_descriptor(int fd); exact file descriptor reuse_fd is used. (This is useful to reopen standard streams.) In this case, the only possible return values are -1 and reuse_fd itself. */ -int open_generic(fs_descriptor_type_t *type, void *data, int reuse_fd); +int open_generic(fs_descriptor_type_t const *type, void *data, int reuse_fd); /* fs_path_normalize(): Normalize a path to eliminate ., .. and redundant / diff --git a/src/fs/fs.c b/src/fs/fs.c index 09919e4..5bea0db 100644 --- a/src/fs/fs.c +++ b/src/fs/fs.c @@ -42,7 +42,7 @@ void fs_free_descriptor(int fd) fdtable[fd].data = NULL; } -int open_generic(fs_descriptor_type_t *type, void *data, int fd) +int open_generic(fs_descriptor_type_t const *type, void *data, int fd) { if(!fdtable) { errno = ENOMEM; @@ -79,7 +79,7 @@ int open_generic(fs_descriptor_type_t *type, void *data, int fd) /* Standard streams */ -static fs_descriptor_type_t devnull = { +static fs_descriptor_type_t const devnull = { .read = NULL, .write = NULL, .lseek = NULL,