You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by rb...@apache.org on 2001/07/08 00:48:09 UTC
cvs commit: apr/include/arch/unix networkio.h
rbb 01/07/07 15:48:09
Modified: network_io/unix sockopt.c
include/arch/unix networkio.h
Log:
We are setting a simple bitmask. Calling a function to do that is far
too expensive. It is much easier to just turn these into macros that do
the exact same thing.
Submitted by: Dean Gaudet
Revision Changes Path
1.46 +0 -13 apr/network_io/unix/sockopt.c
Index: sockopt.c
===================================================================
RCS file: /home/cvs/apr/network_io/unix/sockopt.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -b -w -u -r1.45 -r1.46
--- sockopt.c 2001/04/05 18:56:08 1.45
+++ sockopt.c 2001/07/07 22:48:08 1.46
@@ -55,19 +55,6 @@
#include "networkio.h"
#include "apr_strings.h"
-int apr_is_option_set(apr_int32_t mask, apr_int32_t option)
-{
- return (mask & option) == option;
-}
-
-void apr_set_option(apr_int32_t *mask, apr_int32_t option, int on)
-{
- if (on)
- *mask |= option;
- else
- *mask &= ~option;
-}
-
static apr_status_t soblock(int sd)
{
/* BeOS uses setsockopt at present for non blocking... */
1.45 +10 -2 apr/include/arch/unix/networkio.h
Index: networkio.h
===================================================================
RCS file: /home/cvs/apr/include/arch/unix/networkio.h,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -b -w -u -r1.44 -r1.45
--- networkio.h 2001/06/07 10:31:20 1.44
+++ networkio.h 2001/07/07 22:48:09 1.45
@@ -159,8 +159,16 @@
const char *apr_inet_ntop(int af, const void *src, char *dst, apr_size_t size);
int apr_inet_pton(int af, const char *src, void *dst);
-int apr_is_option_set(apr_int32_t, apr_int32_t);
-void apr_set_option(apr_int32_t *, apr_int32_t, int);
+
+#define apr_is_option_set(mask, option) ((mask & option) ==option)
+
+#define apr_set_option(mask, option, on) \
+ do { \
+ if (on) \
+ *mask |= option; \
+ else \
+ *mask &= ~option; \
+ } while (0)
#endif /* ! NETWORK_IO_H */