mirror of https://github.com/omar-polo/gmid.git
add compat for sys/tree.h
This commit is contained in:
parent
207b3e80d8
commit
492a274fd7
File diff suppressed because it is too large
Load Diff
|
@ -254,6 +254,7 @@ runtest setproctitle SETPROCTITLE || true
|
|||
runtest strlcat STRLCAT || true
|
||||
runtest strlcpy STRLCPY || true
|
||||
runtest strtonum STRTONUM || true
|
||||
runtest tree_h TREE_H || true
|
||||
runtest vasprintf VASPRINTF "" -D_GNU_SOURCE || true
|
||||
|
||||
if [ ${HAVE_LIBTLS} -eq 0 ]; then
|
||||
|
@ -274,7 +275,7 @@ if [ ${HAVE_LIBEVENT} -eq 0 ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [ ${HAVE_QUEUE_H} -eq 0 -o ${HAVE_IMSG} -eq 0 ]; then
|
||||
if [ ${HAVE_QUEUE_H} -eq 0 -o ${HAVE_IMSG} -eq 0 -o ${HAVE_TREE_H} -eq 0 ]; then
|
||||
CFLAGS="${CFLAGS} -I ${PWD}/compat"
|
||||
fi
|
||||
|
||||
|
@ -302,6 +303,12 @@ else
|
|||
echo "#include <queue.h>"
|
||||
fi
|
||||
|
||||
if [ ${HAVE_TREE_H} -eq 1 ]; then
|
||||
echo "#include <sys/tree.h>"
|
||||
else
|
||||
echo "#include <tree.h>"
|
||||
fi
|
||||
|
||||
echo "#include <sys/types.h>"
|
||||
echo "#include <sys/uio.h>"
|
||||
echo "#include <stdint.h>"
|
||||
|
@ -331,6 +338,7 @@ cat <<__HEREDOC__
|
|||
#define HAVE_STRLCAT ${HAVE_STRLCAT}
|
||||
#define HAVE_STRLCPY ${HAVE_STRLCPY}
|
||||
#define HAVE_STRTONUM ${HAVE_STRTONUM}
|
||||
#define HAVE_TREE_H ${HAVE_TREE_H}
|
||||
#define HAVE_VASPRINTF ${HAVE_VASPRINTF}
|
||||
|
||||
__HEREDOC__
|
||||
|
|
1
gmid.h
1
gmid.h
|
@ -20,7 +20,6 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <sys/tree.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Omar Polo <op@omarpolo.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <sys/tree.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
struct tree {
|
||||
int i;
|
||||
SPLAY_ENTRY(tree) entry;
|
||||
};
|
||||
SPLAY_HEAD(tree_id, tree);
|
||||
|
||||
static int
|
||||
tree_cmp(struct tree *a, struct tree *b)
|
||||
{
|
||||
if (a->i == b->i)
|
||||
return 0;
|
||||
else if (a->i < b->i)
|
||||
return -1;
|
||||
else
|
||||
return +1;
|
||||
}
|
||||
|
||||
SPLAY_PROTOTYPE(tree_id, tree, entry, tree_cmp);
|
||||
SPLAY_GENERATE(tree_id, tree, entry, tree_cmp);
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue