diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-08-28 19:15:09 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-08-28 19:15:09 +0200 |
commit | ed63e01a2682249b889c2e33d849001dc66f0d25 (patch) | |
tree | 7aaf73243fee554b40f496b261e5390a9174260c | |
parent | doc proto-util (diff) | |
download | mds-ed63e01a2682249b889c2e33d849001dc66f0d25.tar.gz mds-ed63e01a2682249b889c2e33d849001dc66f0d25.tar.bz2 mds-ed63e01a2682249b889c2e33d849001dc66f0d25.tar.xz |
everything except mds-kkbd and mds-vt compiles with musl; mds-kkbd and mds-vt does not because they require <linux/> headers
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r-- | doc/info/mds.texinfo | 4 | ||||
-rw-r--r-- | src/libmdsserver/linked-list.h | 6 | ||||
-rw-r--r-- | src/libmdsserver/util.h | 14 | ||||
-rw-r--r-- | src/mds-registry/slave.h | 1 | ||||
-rw-r--r-- | src/mds-server/client.h | 1 |
5 files changed, 21 insertions, 5 deletions
diff --git a/doc/info/mds.texinfo b/doc/info/mds.texinfo index a090f7b..9c1ec22 100644 --- a/doc/info/mds.texinfo +++ b/doc/info/mds.texinfo @@ -7053,6 +7053,10 @@ Also, instead of returning the length of the message, it returns zero on success and @code{-1} on error. @end table +@fnindex @code{rawmemchr}. +@file{<libmdsserver/util.h>} also defines @code{rawmemchr} +if not already defined. + @node Data Structures diff --git a/src/libmdsserver/linked-list.h b/src/libmdsserver/linked-list.h index a99204c..b7bcefb 100644 --- a/src/libmdsserver/linked-list.h +++ b/src/libmdsserver/linked-list.h @@ -46,11 +46,7 @@ /** * Sentinel value indicating that the position is unused */ -#if __WORDSIZE == 64 -# define LINKED_LIST_UNUSED (-__INT64_C(9223372036854775807) - 1) -#else -# define LINKED_LIST_UNUSED (-2147483647 - 1) -#endif +#define LINKED_LIST_UNUSED (-((ssize_t)(SIZE_MAX >> 1)) - 1) diff --git a/src/libmdsserver/util.h b/src/libmdsserver/util.h index b86ffd5..543a1c9 100644 --- a/src/libmdsserver/util.h +++ b/src/libmdsserver/util.h @@ -24,6 +24,20 @@ #include <sys/types.h> + +#ifndef __USE_GNU +__attribute__((pure, nonnull)) +static inline void* rawmemchr(const void* str, int chr) +{ + intptr_t str_address = (intptr_t)str; + void* str_nonconst = (void*)str_address; + char* s = str_nonconst; + while ((int)*s++ != chr); + return s - 1; +} +#endif + + /** * Convert a client ID string into a client ID integer * diff --git a/src/mds-registry/slave.h b/src/mds-registry/slave.h index 1213aaa..d765ebb 100644 --- a/src/mds-registry/slave.h +++ b/src/mds-registry/slave.h @@ -21,6 +21,7 @@ #include <libmdsserver/hash-table.h> +#include <unistd.h> #include <stdlib.h> #include <stdint.h> #include <pthread.h> diff --git a/src/mds-server/client.h b/src/mds-server/client.h index e60a0ed..72304d7 100644 --- a/src/mds-server/client.h +++ b/src/mds-server/client.h @@ -27,6 +27,7 @@ #include <stdlib.h> #include <pthread.h> #include <stdint.h> +#include <unistd.h> |