↩ revert:

This commit is contained in:
lzy
2024-05-27 02:33:10 +08:00
parent 2336f88407
commit a277dec1fe
136 changed files with 606 additions and 606 deletions

View File

@@ -3,8 +3,8 @@
struct list_head
{
struct list_head* prev;
struct list_head* next;
struct list_head *prev;
struct list_head *next;
};
#define LIST_HEAD_INIT(name) \
@@ -14,9 +14,9 @@ struct list_head
#define LIST_HEAD(name) struct list_head name = LIST_HEAD_INIT(name)
static inline void __list_add(struct list_head* new,
struct list_head* prev,
struct list_head* next)
static inline void __list_add(struct list_head *new,
struct list_head *prev,
struct list_head *next)
{
next->prev = new;
new->next = next;
@@ -24,7 +24,7 @@ static inline void __list_add(struct list_head* new,
prev->next = new;
}
static inline void list_add(struct list_head* new, struct list_head* head)
static inline void list_add(struct list_head *new, struct list_head *head)
{
__list_add(new, head, head->next);
}
@@ -43,12 +43,12 @@ static inline void list_add(struct list_head* new, struct list_head* head)
*
*/
#define offsetof(TYPE, MEMBER) ((size_t) & ((TYPE*)0)->MEMBER)
#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)); \
#define container_of(ptr, type, member) \
({ \
const typeof(((type *)0)->member) *__mptr = (ptr); \
(type *)((char *)__mptr - offsetof(type, member)); \
})
#define list_entry(ptr, type, member) container_of(ptr, type, member)

View File

@@ -14,7 +14,7 @@ struct score_st
int chinese;
};
static void print_s(struct score_st* d)
static void print_s(struct score_st *d)
{
printf("%d %s %d %d \n", d->id, d->name, d->math, d->chinese);
}
@@ -22,8 +22,8 @@ static void print_s(struct score_st* d)
int main( )
{
int i;
struct score_st* datap;
struct list_head* cur;
struct score_st *datap;
struct list_head *cur;
LIST_HEAD(head);