Skip to content

Commit 6e1825a

Browse files
Merge pull request #458 from triplef/fix-missing-queue-defs
Added missing queue macros for building on Android
2 parents cbd70d1 + e99287b commit 6e1825a

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

src/internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,12 +269,12 @@ upcast(dispatch_object_t dou)
269269
#if defined(_WIN32)
270270
#include <time.h>
271271
#else
272-
#include <sys/queue.h>
273272
#include <sys/mount.h>
274273
#ifdef __ANDROID__
275274
#include <linux/sysctl.h>
276275
#else
277276
#include <sys/sysctl.h>
277+
#include <sys/queue.h>
278278
#endif /* __ANDROID__ */
279279
#include <sys/socket.h>
280280
#include <sys/time.h>

src/shims.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,12 @@
3131
#include <pthread.h>
3232
#else // defined(_WIN32)
3333
#include "shims/generic_win_stubs.h"
34-
#include "shims/generic_sys_queue.h"
3534
#endif // defined(_WIN32)
3635

36+
#if defined(_WIN32) || defined(__ANDROID__)
37+
#include "shims/generic_sys_queue.h"
38+
#endif
39+
3740
#ifdef __ANDROID__
3841
#include "shims/android_stubs.h"
3942
#endif // __ANDROID__

src/shims/generic_sys_queue.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,24 @@
110110
struct type *le_prev; \
111111
}
112112

113+
#define LIST_EMPTY(head) ((head)->lh_first == NULL)
114+
113115
#define LIST_FIRST(head) ((head)->lh_first)
114116

115117
#define LIST_FOREACH(var, head, field) \
116118
for ((var) = LIST_FIRST((head)); \
117119
(var); \
118120
(var) = LIST_NEXT((var), field))
119121

122+
#define LIST_FOREACH_SAFE(var, head, field, tvar) \
123+
for ((var) = LIST_FIRST((head)); \
124+
(var) && ((tvar) = LIST_NEXT((var), field), 1); \
125+
(var) = (tvar))
126+
127+
#define LIST_INIT(head) do { \
128+
LIST_FIRST((head)) = NULL; \
129+
} while (0)
130+
120131
#define LIST_NEXT(elm, field) ((elm)->field.le_next)
121132

122133
#define LIST_REMOVE(elm, field) do { \

0 commit comments

Comments
 (0)