Skip to content

Commit

Permalink
fs: explicitly initialize fs_file_t and fs_dir_t
Browse files Browse the repository at this point in the history
C++ compilers forbid usage of compound literals with -Wpedantic enabled.
They also forbid the usage of designated initializers for standards
lower than c++20.
So switch to explicit initialization, that would not make compilers
angry at us.

Signed-off-by: Mykyta Poturai <[email protected]>
  • Loading branch information
Deedone committed Apr 9, 2024
1 parent bb843df commit e71da50
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions include/zephyr/fs/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ struct fs_statvfs {
*/
static inline void fs_file_t_init(struct fs_file_t *zfp)
{
*zfp = (struct fs_file_t){ 0 };
zfp->filep = NULL;
zfp->mp = NULL;
zfp->flags = 0;
}

/**
Expand All @@ -245,7 +247,8 @@ static inline void fs_file_t_init(struct fs_file_t *zfp)
*/
static inline void fs_dir_t_init(struct fs_dir_t *zdp)
{
*zdp = (struct fs_dir_t){ 0 };
zdp->dirp = NULL;
zdp->mp = NULL;
}

/**
Expand Down

0 comments on commit e71da50

Please sign in to comment.