From 702dfdff274c480de13fcd857fd11c2e848f41d2 Mon Sep 17 00:00:00 2001 From: David Shaw Date: Sat, 24 May 2003 16:40:46 +0000 Subject: [PATCH] * cipher.h, i18n.h, iobuf.h, memory.h, mpi.h, types.h, util.h: Edit all preprocessor instructions to remove whitespace before the '#'. This is not required by C89, but there are some compilers out there that don't like it. --- include/ChangeLog | 7 +++ include/cipher.h | 10 ++-- include/i18n.h | 30 ++++++------ include/iobuf.h | 10 ++-- include/memory.h | 18 +++---- include/mpi.h | 55 +++++++++++---------- include/types.h | 121 +++++++++++++++++++++++----------------------- include/util.h | 25 +++++----- 8 files changed, 139 insertions(+), 137 deletions(-) diff --git a/include/ChangeLog b/include/ChangeLog index 47f1b4661..3df94bb43 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,10 @@ +2003-05-24 David Shaw + + * cipher.h, i18n.h, iobuf.h, memory.h, mpi.h, types.h, util.h: + Edit all preprocessor instructions to remove whitespace before the + '#'. This is not required by C89, but there are some compilers + out there that don't like it. + 2003-05-14 David Shaw * types.h: Add initializer macros for 64-bit unsigned type. diff --git a/include/cipher.h b/include/cipher.h index e7b0c2dc1..23a5aeb0d 100644 --- a/include/cipher.h +++ b/include/cipher.h @@ -105,11 +105,11 @@ struct gcry_md_context { typedef struct gcry_md_context *MD_HANDLE; #ifndef EXTERN_UNLESS_MAIN_MODULE - #if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE) - #define EXTERN_UNLESS_MAIN_MODULE extern - #else - #define EXTERN_UNLESS_MAIN_MODULE - #endif +#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE) +#define EXTERN_UNLESS_MAIN_MODULE extern +#else +#define EXTERN_UNLESS_MAIN_MODULE +#endif #endif EXTERN_UNLESS_MAIN_MODULE int g10c_debug_mode; EXTERN_UNLESS_MAIN_MODULE int g10_opt_verbose; diff --git a/include/i18n.h b/include/i18n.h index 0b270687a..20c2570ab 100644 --- a/include/i18n.h +++ b/include/i18n.h @@ -22,32 +22,32 @@ #define G10_I18N_H #ifdef USE_SIMPLE_GETTEXT - int set_gettext_file( const char *filename ); - const char *gettext( const char *msgid ); +int set_gettext_file( const char *filename ); +const char *gettext( const char *msgid ); - #define _(a) gettext (a) - #define N_(a) (a) +#define _(a) gettext (a) +#define N_(a) (a) #else #ifdef HAVE_LOCALE_H - #include /* suggested by Ernst Molitor */ +#include /* suggested by Ernst Molitor */ #endif #ifdef ENABLE_NLS #ifndef __riscos__ - #include +#include #else - #include "libgettext.h" +#include "libgettext.h" #endif /* __riscos__ */ - #define _(a) gettext (a) - #ifdef gettext_noop - #define N_(a) gettext_noop (a) - #else - #define N_(a) (a) - #endif +#define _(a) gettext (a) +#ifdef gettext_noop +#define N_(a) gettext_noop (a) #else - #define _(a) (a) - #define N_(a) (a) +#define N_(a) (a) +#endif +#else +#define _(a) (a) +#define N_(a) (a) #endif #endif /* !USE_SIMPLE_GETTEXT */ diff --git a/include/iobuf.h b/include/iobuf.h index f94cf4d28..9ae774207 100644 --- a/include/iobuf.h +++ b/include/iobuf.h @@ -72,11 +72,11 @@ struct iobuf_struct { }; #ifndef EXTERN_UNLESS_MAIN_MODULE - #if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE) - #define EXTERN_UNLESS_MAIN_MODULE extern - #else - #define EXTERN_UNLESS_MAIN_MODULE - #endif +#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE) +#define EXTERN_UNLESS_MAIN_MODULE extern +#else +#define EXTERN_UNLESS_MAIN_MODULE +#endif #endif EXTERN_UNLESS_MAIN_MODULE int iobuf_debug_mode; diff --git a/include/memory.h b/include/memory.h index 6a364795b..959f2999e 100644 --- a/include/memory.h +++ b/include/memory.h @@ -23,12 +23,12 @@ #ifdef M_DEBUG #ifndef STR - #define STR(v) #v +#define STR(v) #v #endif #ifndef __riscos__ - #define M_DBGINFO(a) __FUNCTION__ "["__FILE__ ":" STR(a) "]" +#define M_DBGINFO(a) __FUNCTION__ "["__FILE__ ":" STR(a) "]" #else /* __riscos__ */ - #define M_DBGINFO(a) "["__FILE__ ":" STR(a) "]" +#define M_DBGINFO(a) "["__FILE__ ":" STR(a) "]" #endif /* __riscos__ */ #define m_alloc(n) m_debug_alloc((n), M_DBGINFO( __LINE__ ) ) #define m_alloc_clear(n) m_debug_alloc_clear((n), M_DBGINFO(__LINE__) ) @@ -77,19 +77,17 @@ void secmem_set_flags( unsigned flags ); unsigned secmem_get_flags(void); - #define DBG_MEMORY memory_debug_mode #define DBG_MEMSTAT memory_stat_debug_mode #ifndef EXTERN_UNLESS_MAIN_MODULE - #if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE) - #define EXTERN_UNLESS_MAIN_MODULE extern - #else - #define EXTERN_UNLESS_MAIN_MODULE - #endif +#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE) +#define EXTERN_UNLESS_MAIN_MODULE extern +#else +#define EXTERN_UNLESS_MAIN_MODULE +#endif #endif EXTERN_UNLESS_MAIN_MODULE int memory_debug_mode; EXTERN_UNLESS_MAIN_MODULE int memory_stat_debug_mode; - #endif /*G10_MEMORY_H*/ diff --git a/include/mpi.h b/include/mpi.h index 7bb8271dc..3198584a2 100644 --- a/include/mpi.h +++ b/include/mpi.h @@ -49,16 +49,16 @@ typedef unsigned short int mpi_limb_t; typedef signed short int mpi_limb_signed_t; #else - #error BYTES_PER_MPI_LIMB does not match any C type +#error BYTES_PER_MPI_LIMB does not match any C type #endif #define BITS_PER_MPI_LIMB (8*BYTES_PER_MPI_LIMB) #ifndef EXTERN_UNLESS_MAIN_MODULE - #if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE) - #define EXTERN_UNLESS_MAIN_MODULE extern - #else - #define EXTERN_UNLESS_MAIN_MODULE - #endif +#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE) +#define EXTERN_UNLESS_MAIN_MODULE extern +#else +#define EXTERN_UNLESS_MAIN_MODULE +#endif #endif #define DBG_MPI mpi_debug_mode @@ -86,25 +86,25 @@ typedef struct gcry_mpi *MPI; /*-- mpiutil.c --*/ #ifdef M_DEBUG - #define mpi_alloc(n) mpi_debug_alloc((n), M_DBGINFO( __LINE__ ) ) - #define mpi_alloc_secure(n) mpi_debug_alloc_secure((n), M_DBGINFO( __LINE__ ) ) - #define mpi_alloc_like(n) mpi_debug_alloc_like((n), M_DBGINFO( __LINE__ ) ) - #define mpi_free(a) mpi_debug_free((a), M_DBGINFO(__LINE__) ) - #define mpi_resize(a,b) mpi_debug_resize((a),(b), M_DBGINFO(__LINE__) ) - #define mpi_copy(a) mpi_debug_copy((a), M_DBGINFO(__LINE__) ) - MPI mpi_debug_alloc( unsigned nlimbs, const char *info ); - MPI mpi_debug_alloc_secure( unsigned nlimbs, const char *info ); - MPI mpi_debug_alloc_like( MPI a, const char *info ); - void mpi_debug_free( MPI a, const char *info ); - void mpi_debug_resize( MPI a, unsigned nlimbs, const char *info ); - MPI mpi_debug_copy( MPI a, const char *info ); +#define mpi_alloc(n) mpi_debug_alloc((n), M_DBGINFO( __LINE__ ) ) +#define mpi_alloc_secure(n) mpi_debug_alloc_secure((n), M_DBGINFO( __LINE__ ) ) +#define mpi_alloc_like(n) mpi_debug_alloc_like((n), M_DBGINFO( __LINE__ ) ) +#define mpi_free(a) mpi_debug_free((a), M_DBGINFO(__LINE__) ) +#define mpi_resize(a,b) mpi_debug_resize((a),(b), M_DBGINFO(__LINE__) ) +#define mpi_copy(a) mpi_debug_copy((a), M_DBGINFO(__LINE__) ) +MPI mpi_debug_alloc( unsigned nlimbs, const char *info ); +MPI mpi_debug_alloc_secure( unsigned nlimbs, const char *info ); +MPI mpi_debug_alloc_like( MPI a, const char *info ); +void mpi_debug_free( MPI a, const char *info ); +void mpi_debug_resize( MPI a, unsigned nlimbs, const char *info ); +MPI mpi_debug_copy( MPI a, const char *info ); #else - MPI mpi_alloc( unsigned nlimbs ); - MPI mpi_alloc_secure( unsigned nlimbs ); - MPI mpi_alloc_like( MPI a ); - void mpi_free( MPI a ); - void mpi_resize( MPI a, unsigned nlimbs ); - MPI mpi_copy( MPI a ); +MPI mpi_alloc( unsigned nlimbs ); +MPI mpi_alloc_secure( unsigned nlimbs ); +MPI mpi_alloc_like( MPI a ); +void mpi_free( MPI a ); +void mpi_resize( MPI a, unsigned nlimbs ); +MPI mpi_copy( MPI a ); #endif #define mpi_is_opaque(a) ((a) && ((a)->flags&4)) MPI mpi_set_opaque( MPI a, void *p, int len ); @@ -121,10 +121,10 @@ void mpi_swap( MPI a, MPI b); /*-- mpicoder.c --*/ int mpi_write( IOBUF out, MPI a ); #ifdef M_DEBUG - #define mpi_read(a,b,c) mpi_debug_read((a),(b),(c), M_DBGINFO( __LINE__ ) ) - MPI mpi_debug_read(IOBUF inp, unsigned *nread, int secure, const char *info); +#define mpi_read(a,b,c) mpi_debug_read((a),(b),(c), M_DBGINFO( __LINE__ ) ) +MPI mpi_debug_read(IOBUF inp, unsigned *nread, int secure, const char *info); #else - MPI mpi_read(IOBUF inp, unsigned *nread, int secure); +MPI mpi_read(IOBUF inp, unsigned *nread, int secure); #endif MPI mpi_read_from_buffer(byte *buffer, unsigned *ret_nread, int secure); int mpi_fromstr(MPI val, const char *str); @@ -193,5 +193,4 @@ void mpi_rshift( MPI x, MPI a, unsigned n ); /*-- mpi-inv.c --*/ void mpi_invm( MPI x, MPI u, MPI v ); - #endif /*G10_MPI_H*/ diff --git a/include/types.h b/include/types.h index 83c0977da..fc5381965 100644 --- a/include/types.h +++ b/include/types.h @@ -29,16 +29,16 @@ /* The AC_CHECK_SIZEOF() in configure fails for some machines. * we provide some fallback values here */ #if !SIZEOF_UNSIGNED_SHORT - #undef SIZEOF_UNSIGNED_SHORT - #define SIZEOF_UNSIGNED_SHORT 2 +#undef SIZEOF_UNSIGNED_SHORT +#define SIZEOF_UNSIGNED_SHORT 2 #endif #if !SIZEOF_UNSIGNED_INT - #undef SIZEOF_UNSIGNED_INT - #define SIZEOF_UNSIGNED_INT 4 +#undef SIZEOF_UNSIGNED_INT +#define SIZEOF_UNSIGNED_INT 4 #endif #if !SIZEOF_UNSIGNED_LONG - #undef SIZEOF_UNSIGNED_LONG - #define SIZEOF_UNSIGNED_LONG 4 +#undef SIZEOF_UNSIGNED_LONG +#define SIZEOF_UNSIGNED_LONG 4 #endif @@ -46,52 +46,52 @@ #ifndef HAVE_BYTE_TYPEDEF - #undef byte /* maybe there is a macro with this name */ - #ifndef __riscos__ - typedef unsigned char byte; - #else - /* Norcroft treats char = unsigned char as legal assignment - but char* = unsigned char* as illegal assignment - and the same applies to the signed variants as well */ - typedef char byte; - #endif - #define HAVE_BYTE_TYPEDEF +#undef byte /* maybe there is a macro with this name */ +#ifndef __riscos__ +typedef unsigned char byte; +#else +/* Norcroft treats char = unsigned char as legal assignment + but char* = unsigned char* as illegal assignment + and the same applies to the signed variants as well */ +typedef char byte; +#endif +#define HAVE_BYTE_TYPEDEF #endif #ifndef HAVE_USHORT_TYPEDEF - #undef ushort /* maybe there is a macro with this name */ - typedef unsigned short ushort; - #define HAVE_USHORT_TYPEDEF +#undef ushort /* maybe there is a macro with this name */ +typedef unsigned short ushort; +#define HAVE_USHORT_TYPEDEF #endif #ifndef HAVE_ULONG_TYPEDEF - #undef ulong /* maybe there is a macro with this name */ - typedef unsigned long ulong; - #define HAVE_ULONG_TYPEDEF +#undef ulong /* maybe there is a macro with this name */ +typedef unsigned long ulong; +#define HAVE_ULONG_TYPEDEF #endif #ifndef HAVE_U16_TYPEDEF - #undef u16 /* maybe there is a macro with this name */ - #if SIZEOF_UNSIGNED_INT == 2 - typedef unsigned int u16; - #elif SIZEOF_UNSIGNED_SHORT == 2 - typedef unsigned short u16; - #else - #error no typedef for u16 - #endif - #define HAVE_U16_TYPEDEF +#undef u16 /* maybe there is a macro with this name */ +#if SIZEOF_UNSIGNED_INT == 2 +typedef unsigned int u16; +#elif SIZEOF_UNSIGNED_SHORT == 2 +typedef unsigned short u16; +#else +#error no typedef for u16 +#endif +#define HAVE_U16_TYPEDEF #endif #ifndef HAVE_U32_TYPEDEF - #undef u32 /* maybe there is a macro with this name */ - #if SIZEOF_UNSIGNED_INT == 4 - typedef unsigned int u32; - #elif SIZEOF_UNSIGNED_LONG == 4 - typedef unsigned long u32; - #else - #error no typedef for u32 - #endif - #define HAVE_U32_TYPEDEF +#undef u32 /* maybe there is a macro with this name */ +#if SIZEOF_UNSIGNED_INT == 4 +typedef unsigned int u32; +#elif SIZEOF_UNSIGNED_LONG == 4 +typedef unsigned long u32; +#else +#error no typedef for u32 +#endif +#define HAVE_U32_TYPEDEF #endif /**************** @@ -100,24 +100,24 @@ * Solaris and IRIX. */ #ifndef HAVE_U64_TYPEDEF - #undef u64 /* maybe there is a macro with this name */ - #if SIZEOF_UNSIGNED_INT == 8 - typedef unsigned int u64; - #define U64_C(c) (c ## U) - #define HAVE_U64_TYPEDEF - #elif SIZEOF_UNSIGNED_LONG == 8 - typedef unsigned long u64; - #define U64_C(c) (c ## UL) - #define HAVE_U64_TYPEDEF - #elif SIZEOF_UNSIGNED_LONG_LONG == 8 - typedef unsigned long long u64; - #define U64_C(c) (c ## ULL) - #define HAVE_U64_TYPEDEF - #elif SIZEOF_UINT64_T == 8 - typedef uint64_t u64; - #define U64_C(c) (UINT64_C(c)) - #define HAVE_U64_TYPEDEF - #endif +#undef u64 /* maybe there is a macro with this name */ +#if SIZEOF_UNSIGNED_INT == 8 +typedef unsigned int u64; +#define U64_C(c) (c ## U) +#define HAVE_U64_TYPEDEF +#elif SIZEOF_UNSIGNED_LONG == 8 +typedef unsigned long u64; +#define U64_C(c) (c ## UL) +#define HAVE_U64_TYPEDEF +#elif SIZEOF_UNSIGNED_LONG_LONG == 8 +typedef unsigned long long u64; +#define U64_C(c) (c ## ULL) +#define HAVE_U64_TYPEDEF +#elif SIZEOF_UINT64_T == 8 +typedef uint64_t u64; +#define U64_C(c) (UINT64_C(c)) +#define HAVE_U64_TYPEDEF +#endif #endif typedef union { @@ -125,9 +125,9 @@ typedef union { short b; char c[1]; long d; - #ifdef HAVE_U64_TYPEDEF +#ifdef HAVE_U64_TYPEDEF u64 e; - #endif +#endif float f; double g; } PROPERLY_ALIGNED_TYPE; @@ -138,5 +138,4 @@ typedef struct string_list { char d[1]; } *STRLIST; - #endif /*G10_TYPES_H*/ diff --git a/include/util.h b/include/util.h index 3b58bbe31..c3d0189c6 100644 --- a/include/util.h +++ b/include/util.h @@ -21,7 +21,7 @@ #define G10_UTIL_H #if defined (__MINGW32__) || defined (__CYGWIN32__) -# include +#include #endif #include "types.h" @@ -93,9 +93,9 @@ void g10_log_hexdump( const char *text, const char *buf, size_t len ); void g10_log_debug_f( const char *fname, const char *fmt, ... ) __attribute__ ((format (printf,2,3))); #ifndef __riscos__ - #define BUG() g10_log_bug0( __FILE__ , __LINE__, __FUNCTION__ ) +#define BUG() g10_log_bug0( __FILE__ , __LINE__, __FUNCTION__ ) #else - #define BUG() g10_log_bug0( __FILE__ , __LINE__, __func__ ) +#define BUG() g10_log_bug0( __FILE__ , __LINE__, __func__ ) #endif #else void g10_log_bug( const char *fmt, ... ); @@ -109,7 +109,7 @@ void g10_log_hexdump( const char *text, const char *buf, size_t len ); void g10_log_error_f( const char *fname, const char *fmt, ... ); void g10_log_info_f( const char *fname, const char *fmt, ... ); void g10_log_debug_f( const char *fname, const char *fmt, ... ); - #define BUG() g10_log_bug0( __FILE__ , __LINE__ ) +#define BUG() g10_log_bug0( __FILE__ , __LINE__ ) #endif #define log_hexdump g10_log_hexdump @@ -227,10 +227,10 @@ int strcasecmp( const char *, const char *b); int strncasecmp (const char *, const char *b, size_t n); #endif #ifndef HAVE_STRTOUL - #define strtoul(a,b,c) ((unsigned long)strtol((a),(b),(c))) +#define strtoul(a,b,c) ((unsigned long)strtol((a),(b),(c))) #endif #ifndef HAVE_MEMMOVE - #define memmove(d, s, n) bcopy((s), (d), (n)) +#define memmove(d, s, n) bcopy((s), (d), (n)) #endif #if defined (__MINGW32__) @@ -246,16 +246,16 @@ int vasprintf ( char **result, const char *format, va_list args); /**** other missing stuff ****/ #ifndef HAVE_ATEXIT /* For SunOS */ - #define atexit(a) (on_exit((a),0)) +#define atexit(a) (on_exit((a),0)) #endif #ifndef HAVE_RAISE - #define raise(a) kill(getpid(), (a)) +#define raise(a) kill(getpid(), (a)) #endif /******** some macros ************/ #ifndef STR - #define STR(v) #v +#define STR(v) #v #endif #define STR2(v) STR(v) #define DIM(v) (sizeof(v)/sizeof((v)[0])) @@ -295,11 +295,10 @@ void riscos_dump_fdlist(void); void riscos_list_openfiles(void); #endif #ifndef __RISCOS__C__ - #define getpid riscos_getpid - #define kill(a,b) riscos_kill((a),(b)) - #define access(a,b) riscos_access((a),(b)) +#define getpid riscos_getpid +#define kill(a,b) riscos_kill((a),(b)) +#define access(a,b) riscos_access((a),(b)) #endif /* !__RISCOS__C__ */ #endif /* __riscos__ */ #endif /*G10_UTIL_H*/ -