Skip to content

Added missing queue macros for building on Android #458

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,12 @@ upcast(dispatch_object_t dou)
#if defined(_WIN32)
#include <time.h>
#else
#include <sys/queue.h>
#include <sys/mount.h>
#ifdef __ANDROID__
#include <linux/sysctl.h>
#else
#include <sys/sysctl.h>
#include <sys/queue.h>
#endif /* __ANDROID__ */
#include <sys/socket.h>
#include <sys/time.h>
Expand Down
5 changes: 4 additions & 1 deletion src/shims.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@
#include <pthread.h>
#else // defined(_WIN32)
#include "shims/generic_win_stubs.h"
#include "shims/generic_sys_queue.h"
#endif // defined(_WIN32)

#if defined(_WIN32) || defined(__ANDROID__)
#include "shims/generic_sys_queue.h"
#endif

#ifdef __ANDROID__
#include "shims/android_stubs.h"
#endif // __ANDROID__
Expand Down
11 changes: 11 additions & 0 deletions src/shims/generic_sys_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,24 @@
struct type *le_prev; \
}

#define LIST_EMPTY(head) ((head)->lh_first == NULL)

#define LIST_FIRST(head) ((head)->lh_first)

#define LIST_FOREACH(var, head, field) \
for ((var) = LIST_FIRST((head)); \
(var); \
(var) = LIST_NEXT((var), field))

#define LIST_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = LIST_FIRST((head)); \
(var) && ((tvar) = LIST_NEXT((var), field), 1); \
(var) = (tvar))

#define LIST_INIT(head) do { \
LIST_FIRST((head)) = NULL; \
} while (0)

#define LIST_NEXT(elm, field) ((elm)->field.le_next)

#define LIST_REMOVE(elm, field) do { \
Expand Down