Include <stddef.h> instead of defining offsetof()

commit 24663b62275c969f46203ccca2594323a8e07085
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Prepare for enabling -Wmacro-redefined.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
This commit is contained in:
Bart Van Assche 2022-04-21 15:18:20 -07:00 committed by dongsenhao
parent c8dabbba7a
commit da00029bf5
2 changed files with 2 additions and 5 deletions

View File

@ -15,6 +15,7 @@
#include <unistd.h>
#include <stdio.h>
#include <stdbool.h>
#include <stddef.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
@ -37,7 +38,6 @@
typecheck(unsigned long long, b) && \
((long long)((a) - (b)) > 0))
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#define container_of(ptr, type, member) ({ \
const typeof(((type *)0)->member) * __mptr = (ptr); \
(type *)((char *)__mptr - offsetof(type, member)); })

View File

@ -19,6 +19,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <time.h>
#ifdef HAVE_CONFIG_H
@ -915,10 +916,6 @@ static_assert(sizeof(struct f2fs_extent) == 12, "");
#define F2FS_PIN_FILE 0x40 /* file should not be gced */
#define F2FS_COMPRESS_RELEASED 0x80 /* file released compressed blocks */
#if !defined(offsetof)
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#endif
#define F2FS_EXTRA_ISIZE_OFFSET \
offsetof(struct f2fs_inode, i_extra_isize)
#define F2FS_TOTAL_EXTRA_ATTR_SIZE \