зеркало из https://github.com/mozilla/gecko-dev.git
Bug 916589 - Rename __offsetof() to avoid conflict with platform-specific definition. r=docfaraday
This commit is contained in:
Родитель
c49f8a2459
Коммит
6acd76ea4b
|
@ -33,9 +33,10 @@
|
||||||
#ifndef _SYS_QUEUE_H_
|
#ifndef _SYS_QUEUE_H_
|
||||||
#define _SYS_QUEUE_H_
|
#define _SYS_QUEUE_H_
|
||||||
|
|
||||||
#if !defined(__FreeBSD__) && !defined(DARWIN)
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#define __offsetof offsetof
|
|
||||||
|
#ifndef offsetof
|
||||||
|
#define offsetof(type, field) ((size_t)(&((type *)0)->field))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
|
#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
|
||||||
|
@ -43,8 +44,6 @@
|
||||||
(var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
|
(var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
|
||||||
(var) = (tvar))
|
(var) = (tvar))
|
||||||
|
|
||||||
// #define __offsetof(type, field) ((size_t)(&((type *)0)->field))
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file defines four types of data structures: singly-linked lists,
|
* This file defines four types of data structures: singly-linked lists,
|
||||||
* singly-linked tail queues, lists and tail queues.
|
* singly-linked tail queues, lists and tail queues.
|
||||||
|
@ -285,7 +284,7 @@ struct { \
|
||||||
(STAILQ_EMPTY((head)) ? \
|
(STAILQ_EMPTY((head)) ? \
|
||||||
NULL : \
|
NULL : \
|
||||||
((struct type *) \
|
((struct type *) \
|
||||||
((char *)((head)->stqh_last) - __offsetof(struct type, field))))
|
((char *)((head)->stqh_last) - offsetof(struct type, field))))
|
||||||
|
|
||||||
#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
|
#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче