Discussion:
[libdvdcss-devel] ioctl: cosmetics: Coalesce some macro and declaration blocks
Diego Biurrun
2014-10-31 15:12:24 UTC
Permalink
libdvdcss | branch: master | Diego Biurrun <***@biurrun.de> | Fri Oct 24 13:06:01 2014 +0200| [2de79ff6caa5045aae19d23169d7f6c8b4b8baed] | committer: Diego Biurrun

ioctl: cosmetics: Coalesce some macro and declaration blocks
http://git.videolan.org/gitweb.cgi/libdvdcss.git/?a=commit;h=2de79ff6caa5045aae19d23169d7f6c8b4b8baed
---

src/ioctl.c | 30 +++++-------------------------
src/ioctl.h | 37 ++++++-------------------------------
2 files changed, 11 insertions(+), 56 deletions(-)

diff --git a/src/ioctl.c b/src/ioctl.c
index c28472a..d52b32f 100644
--- a/src/ioctl.c
+++ b/src/ioctl.c
@@ -88,38 +88,18 @@
#include "ioctl.h"

/*****************************************************************************
- * Local prototypes, BeOS specific
+ * Local prototypes, OS-specific
*****************************************************************************/
#if defined( __HAIKU__ )
static void BeInitRDC ( raw_device_command *, int );
-#endif
-
-/*****************************************************************************
- * Local prototypes, Solaris specific
- *****************************************************************************/
-#if defined( SOLARIS_USCSI )
+#elif defined( SOLARIS_USCSI )
static void SolarisInitUSCSI( struct uscsi_cmd *p_sc, int i_type );
static int SolarisSendUSCSI( int fd, struct uscsi_cmd *p_sc );
-#endif
-
-/*****************************************************************************
- * Local prototypes, Win32 specific
- *****************************************************************************/
-#if defined( WIN32 )
+#elif defined( WIN32 )
static void WinInitSPTD ( SCSI_PASS_THROUGH_DIRECT *, int );
-#endif
-
-/*****************************************************************************
- * Local prototypes, QNX specific
- *****************************************************************************/
-#if defined( __QNXNTO__ )
+#elif defined( __QNXNTO__ )
static void QNXInitCPT ( CAM_PASS_THRU *, int );
-#endif
-
-/*****************************************************************************
- * Local prototypes, OS2 specific
- *****************************************************************************/
-#if defined( __OS2__ )
+#elif defined( __OS2__ )
static void OS2InitSDC( struct OS2_ExecSCSICmd *, int );
#endif

diff --git a/src/ioctl.h b/src/ioctl.h
index f75bad2..44b3f2e 100644
--- a/src/ioctl.h
+++ b/src/ioctl.h
@@ -42,7 +42,7 @@ int ioctl_ReportRPC ( int, int *, int *, int * );
#define DVD_DISCKEY_SIZE 2048

/*****************************************************************************
- * Common macro, BeOS specific
+ * Common macros, OS-specific
*****************************************************************************/
#if defined( __HAIKU__ )
#define INIT_RDC( TYPE, SIZE ) \
@@ -51,12 +51,7 @@ int ioctl_ReportRPC ( int, int *, int *, int * );
rdc.data = (char *)p_buffer; \
rdc.data_length = (SIZE); \
BeInitRDC( &rdc, (TYPE) );
-#endif
-
-/*****************************************************************************
- * Common macro, Solaris specific
- *****************************************************************************/
-#if defined( SOLARIS_USCSI )
+#elif defined( SOLARIS_USCSI )
#define INIT_USCSI( TYPE, SIZE ) \
struct uscsi_cmd sc = { 0 }; \
union scsi_cdb rs_cdb; \
@@ -65,24 +60,14 @@ int ioctl_ReportRPC ( int, int *, int *, int * );
sc.uscsi_bufaddr = (caddr_t)p_buffer; \
sc.uscsi_buflen = (SIZE); \
SolarisInitUSCSI( &sc, (TYPE) );
-#endif
-
-/*****************************************************************************
- * Common macro, Darwin specific
- *****************************************************************************/
-#if defined( DARWIN_DVD_IOCTL )
+#elif defined( DARWIN_DVD_IOCTL )
#define INIT_DVDIOCTL( DKDVD_TYPE, BUFFER_TYPE, FORMAT ) \
DKDVD_TYPE dvd = { 0 }; \
BUFFER_TYPE dvdbs = { 0 }; \
dvd.format = FORMAT; \
dvd.buffer = &dvdbs; \
dvd.bufferLength = sizeof(dvdbs);
-#endif
-
-/*****************************************************************************
- * Common macro, win32 specific
- *****************************************************************************/
-#if defined( WIN32 )
+#elif defined( WIN32 )
#define INIT_SPTD( TYPE, SIZE ) \
DWORD tmp; \
SCSI_PASS_THROUGH_DIRECT sptd = { 0 }; \
@@ -96,12 +81,7 @@ int ioctl_ReportRPC ( int, int *, int *, int * );
(SPTD), sizeof( SCSI_PASS_THROUGH_DIRECT ), \
(SPTD), sizeof( SCSI_PASS_THROUGH_DIRECT ), \
(TMP), NULL ) ? 0 : -1)
-#endif
-
-/*****************************************************************************
- * Common macro, QNX specific
- *****************************************************************************/
-#if defined( __QNXNTO__ )
+#elif defined( __QNXNTO__ )
#define INIT_CPT( TYPE, SIZE ) \
CAM_PASS_THRU * p_cpt = { 0 }; \
uint8_t * p_buffer; \
@@ -111,12 +91,7 @@ int ioctl_ReportRPC ( int, int *, int *, int * );
p_cpt->cam_data_ptr = sizeof( CAM_PASS_THRU ); \
p_cpt->cam_dxfer_len = (SIZE); \
QNXInitCPT( p_cpt, (TYPE) );
-#endif
-
-/*****************************************************************************
- * Common macro, OS2 specific
- *****************************************************************************/
-#if defined( __OS2__ )
+#elif defined( __OS2__ )
#define INIT_SSC( TYPE, SIZE ) \
struct OS2_ExecSCSICmd sdc = { 0 }; \
uint8_t p_buffer[ (SIZE) + 1 ] = { 0 }; \

Loading...