Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libossaudio avoid using cpp variadic macros and explain ...



details:   https://anonhg.NetBSD.org/src/rev/7b3cba8b104e
branches:  trunk
changeset: 779122:7b3cba8b104e
user:      christos <christos%NetBSD.org@localhost>
date:      Sat May 05 15:04:57 2012 +0000

description:
avoid using cpp variadic macros and explain why.

diffstat:

 lib/libossaudio/soundcard.h |  20 +++++++-------------
 1 files changed, 7 insertions(+), 13 deletions(-)

diffs (40 lines):

diff -r afc7c2442f8a -r 7b3cba8b104e lib/libossaudio/soundcard.h
--- a/lib/libossaudio/soundcard.h       Sat May 05 13:47:07 2012 +0000
+++ b/lib/libossaudio/soundcard.h       Sat May 05 15:04:57 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: soundcard.h,v 1.20 2012/05/04 11:48:12 christos Exp $  */
+/*     $NetBSD: soundcard.h,v 1.21 2012/05/05 15:04:57 christos Exp $  */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -291,24 +291,18 @@
        int size;
 } buffmem_desc;
 
-#if 0
-/* This is what we'd like to have, but it causes prototype conflicts. */
 #define ioctl _oss_ioctl
-#else
 /*
- * XXX force inclusion of <sys/ioctl.h> before we redefine
- * ioctl() to avoid a prototype conflict.
- * Its multiple inclusion protection will keep this from
- * happening if it is pulled in later.
+ * If we already included <sys/ioctl.h>, then we define our own prototype,
+ * else we depend on <sys/ioctl.h> to do it for us. We do it this way, so
+ * that we don't define the prototype twice.
  */
+#ifndef _SYS_IOCTL_H
 #include <sys/ioctl.h>
-#define ioctl(x, y, ...) _oss_ioctl(x, y, __VA_ARGS__)
-#endif
-
-#include <sys/cdefs.h>
-
+#else
 __BEGIN_DECLS
 int _oss_ioctl(int, unsigned long, ...);
 __END_DECLS
+#endif
 
 #endif /* !_SOUNDCARD_H_ */



Home | Main Index | Thread Index | Old Index