From: guenther Date: Sat, 17 Oct 2015 21:48:42 +0000 (+0000) Subject: Move the last of the __DBINTERFACE_PRIVATE bits from to libc's wrapper X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d994eebbf70ed6a7ab469ce6d8c349905c0a2fe3;p=openbsd Move the last of the __DBINTERFACE_PRIVATE bits from to libc's wrapper and eliminate the now superfluous -D option ok kettenis@ millert@ --- diff --git a/distrib/special/libstubs/Makefile b/distrib/special/libstubs/Makefile index d51c0651945..8853173e095 100644 --- a/distrib/special/libstubs/Makefile +++ b/distrib/special/libstubs/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.16 2015/09/11 06:13:36 guenther Exp $ +# $OpenBSD: Makefile,v 1.17 2015/10/17 21:48:42 guenther Exp $ .include LIB= stubs @@ -29,7 +29,7 @@ SRCS+= asr.c \ NOPIC= Yes NOPROFILE=Yes -CFLAGS+=-D__DBINTERFACE_PRIVATE -DSHA2_SMALL -UYP -DNO_LOG_BAD_DNS_RESPONSES \ +CFLAGS+=-DSHA2_SMALL -UYP -DNO_LOG_BAD_DNS_RESPONSES \ -DFLOATING_POINT -DASRNODEBUG \ -I${LIBCSRCDIR}/include -I${LIBCSRCDIR}/hidden \ -I${LIBCSRCDIR}/asr -I${LIBCSRCDIR}/locale -I${LIBCSRCDIR}/gdtoa \ diff --git a/include/db.h b/include/db.h index 90fe790aa71..4381efebeab 100644 --- a/include/db.h +++ b/include/db.h @@ -1,4 +1,4 @@ -/* $OpenBSD: db.h,v 1.11 2015/09/05 11:28:35 guenther Exp $ */ +/* $OpenBSD: db.h,v 1.12 2015/10/17 21:48:42 guenther Exp $ */ /* $NetBSD: db.h,v 1.13 1994/10/26 00:55:48 cgd Exp $ */ /*- @@ -155,56 +155,6 @@ typedef struct { char *bfname; /* btree file name */ } RECNOINFO; -#ifdef __DBINTERFACE_PRIVATE -/* - * Little endian <==> big endian 32-bit swap macros. - * M_32_SWAP swap a memory location - * P_32_SWAP swap a referenced memory location - * P_32_COPY swap from one location to another - */ -#define M_32_SWAP(a) { \ - u_int32_t _tmp = a; \ - ((char *)&a)[0] = ((char *)&_tmp)[3]; \ - ((char *)&a)[1] = ((char *)&_tmp)[2]; \ - ((char *)&a)[2] = ((char *)&_tmp)[1]; \ - ((char *)&a)[3] = ((char *)&_tmp)[0]; \ -} -#define P_32_SWAP(a) { \ - u_int32_t _tmp = *(u_int32_t *)a; \ - ((char *)a)[0] = ((char *)&_tmp)[3]; \ - ((char *)a)[1] = ((char *)&_tmp)[2]; \ - ((char *)a)[2] = ((char *)&_tmp)[1]; \ - ((char *)a)[3] = ((char *)&_tmp)[0]; \ -} -#define P_32_COPY(a, b) { \ - ((char *)&(b))[0] = ((char *)&(a))[3]; \ - ((char *)&(b))[1] = ((char *)&(a))[2]; \ - ((char *)&(b))[2] = ((char *)&(a))[1]; \ - ((char *)&(b))[3] = ((char *)&(a))[0]; \ -} - -/* - * Little endian <==> big endian 16-bit swap macros. - * M_16_SWAP swap a memory location - * P_16_SWAP swap a referenced memory location - * P_16_COPY swap from one location to another - */ -#define M_16_SWAP(a) { \ - u_int16_t _tmp = a; \ - ((char *)&a)[0] = ((char *)&_tmp)[1]; \ - ((char *)&a)[1] = ((char *)&_tmp)[0]; \ -} -#define P_16_SWAP(a) { \ - u_int16_t _tmp = *(u_int16_t *)a; \ - ((char *)a)[0] = ((char *)&_tmp)[1]; \ - ((char *)a)[1] = ((char *)&_tmp)[0]; \ -} -#define P_16_COPY(a, b) { \ - ((char *)&(b))[0] = ((char *)&(a))[1]; \ - ((char *)&(b))[1] = ((char *)&(a))[0]; \ -} -#endif - __BEGIN_DECLS DB *dbopen(const char *, int, int, DBTYPE, const void *); __END_DECLS diff --git a/lib/libc/db/Makefile.inc b/lib/libc/db/Makefile.inc index 069435a842d..a58c43db1de 100644 --- a/lib/libc/db/Makefile.inc +++ b/lib/libc/db/Makefile.inc @@ -1,7 +1,5 @@ -# $OpenBSD: Makefile.inc,v 1.5 2015/09/09 16:40:15 guenther Exp $ +# $OpenBSD: Makefile.inc,v 1.6 2015/10/17 21:48:42 guenther Exp $ # -CFLAGS+=-D__DBINTERFACE_PRIVATE - .PATH: ${LIBCSRCDIR}/db/btree SRCS+= bt_close.c bt_conv.c bt_debug.c bt_delete.c bt_get.c bt_open.c \ diff --git a/lib/libc/hidden/db.h b/lib/libc/hidden/db.h index a8bc9ca9469..57eb5558010 100644 --- a/lib/libc/hidden/db.h +++ b/lib/libc/hidden/db.h @@ -1,4 +1,4 @@ -/* $OpenBSD: db.h,v 1.2 2015/09/10 18:13:46 guenther Exp $ */ +/* $OpenBSD: db.h,v 1.3 2015/10/17 21:48:42 guenther Exp $ */ /* * Copyright (c) 2015 Philip Guenther * @@ -20,6 +20,54 @@ #include_next +/* + * Little endian <==> big endian 32-bit swap macros. + * M_32_SWAP swap a memory location + * P_32_SWAP swap a referenced memory location + * P_32_COPY swap from one location to another + */ +#define M_32_SWAP(a) { \ + u_int32_t _tmp = a; \ + ((char *)&a)[0] = ((char *)&_tmp)[3]; \ + ((char *)&a)[1] = ((char *)&_tmp)[2]; \ + ((char *)&a)[2] = ((char *)&_tmp)[1]; \ + ((char *)&a)[3] = ((char *)&_tmp)[0]; \ +} +#define P_32_SWAP(a) { \ + u_int32_t _tmp = *(u_int32_t *)a; \ + ((char *)a)[0] = ((char *)&_tmp)[3]; \ + ((char *)a)[1] = ((char *)&_tmp)[2]; \ + ((char *)a)[2] = ((char *)&_tmp)[1]; \ + ((char *)a)[3] = ((char *)&_tmp)[0]; \ +} +#define P_32_COPY(a, b) { \ + ((char *)&(b))[0] = ((char *)&(a))[3]; \ + ((char *)&(b))[1] = ((char *)&(a))[2]; \ + ((char *)&(b))[2] = ((char *)&(a))[1]; \ + ((char *)&(b))[3] = ((char *)&(a))[0]; \ +} + +/* + * Little endian <==> big endian 16-bit swap macros. + * M_16_SWAP swap a memory location + * P_16_SWAP swap a referenced memory location + * P_16_COPY swap from one location to another + */ +#define M_16_SWAP(a) { \ + u_int16_t _tmp = a; \ + ((char *)&a)[0] = ((char *)&_tmp)[1]; \ + ((char *)&a)[1] = ((char *)&_tmp)[0]; \ +} +#define P_16_SWAP(a) { \ + u_int16_t _tmp = *(u_int16_t *)a; \ + ((char *)a)[0] = ((char *)&_tmp)[1]; \ + ((char *)a)[1] = ((char *)&_tmp)[0]; \ +} +#define P_16_COPY(a, b) { \ + ((char *)&(b))[0] = ((char *)&(a))[1]; \ + ((char *)&(b))[1] = ((char *)&(a))[0]; \ +} + __BEGIN_HIDDEN_DECLS DB *__bt_open(const char *, int, int, const BTREEINFO *, int); DB *__hash_open(const char *, int, int, const HASHINFO *, int);