* 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.
This commit is contained in:
David Shaw 2003-05-24 16:40:46 +00:00
parent e1517d95e4
commit 702dfdff27
8 changed files with 139 additions and 137 deletions

View File

@ -1,3 +1,10 @@
2003-05-24 David Shaw <dshaw@jabberwocky.com>
* 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 <dshaw@jabberwocky.com> 2003-05-14 David Shaw <dshaw@jabberwocky.com>
* types.h: Add initializer macros for 64-bit unsigned type. * types.h: Add initializer macros for 64-bit unsigned type.

View File

@ -105,11 +105,11 @@ struct gcry_md_context {
typedef struct gcry_md_context *MD_HANDLE; typedef struct gcry_md_context *MD_HANDLE;
#ifndef EXTERN_UNLESS_MAIN_MODULE #ifndef EXTERN_UNLESS_MAIN_MODULE
#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE) #if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
#define EXTERN_UNLESS_MAIN_MODULE extern #define EXTERN_UNLESS_MAIN_MODULE extern
#else #else
#define EXTERN_UNLESS_MAIN_MODULE #define EXTERN_UNLESS_MAIN_MODULE
#endif #endif
#endif #endif
EXTERN_UNLESS_MAIN_MODULE int g10c_debug_mode; EXTERN_UNLESS_MAIN_MODULE int g10c_debug_mode;
EXTERN_UNLESS_MAIN_MODULE int g10_opt_verbose; EXTERN_UNLESS_MAIN_MODULE int g10_opt_verbose;

View File

@ -22,32 +22,32 @@
#define G10_I18N_H #define G10_I18N_H
#ifdef USE_SIMPLE_GETTEXT #ifdef USE_SIMPLE_GETTEXT
int set_gettext_file( const char *filename ); int set_gettext_file( const char *filename );
const char *gettext( const char *msgid ); const char *gettext( const char *msgid );
#define _(a) gettext (a) #define _(a) gettext (a)
#define N_(a) (a) #define N_(a) (a)
#else #else
#ifdef HAVE_LOCALE_H #ifdef HAVE_LOCALE_H
#include <locale.h> /* suggested by Ernst Molitor */ #include <locale.h> /* suggested by Ernst Molitor */
#endif #endif
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
#ifndef __riscos__ #ifndef __riscos__
#include <libintl.h> #include <libintl.h>
#else #else
#include "libgettext.h" #include "libgettext.h"
#endif /* __riscos__ */ #endif /* __riscos__ */
#define _(a) gettext (a) #define _(a) gettext (a)
#ifdef gettext_noop #ifdef gettext_noop
#define N_(a) gettext_noop (a) #define N_(a) gettext_noop (a)
#else
#define N_(a) (a)
#endif
#else #else
#define _(a) (a) #define N_(a) (a)
#define N_(a) (a) #endif
#else
#define _(a) (a)
#define N_(a) (a)
#endif #endif
#endif /* !USE_SIMPLE_GETTEXT */ #endif /* !USE_SIMPLE_GETTEXT */

View File

@ -72,11 +72,11 @@ struct iobuf_struct {
}; };
#ifndef EXTERN_UNLESS_MAIN_MODULE #ifndef EXTERN_UNLESS_MAIN_MODULE
#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE) #if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
#define EXTERN_UNLESS_MAIN_MODULE extern #define EXTERN_UNLESS_MAIN_MODULE extern
#else #else
#define EXTERN_UNLESS_MAIN_MODULE #define EXTERN_UNLESS_MAIN_MODULE
#endif #endif
#endif #endif
EXTERN_UNLESS_MAIN_MODULE int iobuf_debug_mode; EXTERN_UNLESS_MAIN_MODULE int iobuf_debug_mode;

View File

@ -23,12 +23,12 @@
#ifdef M_DEBUG #ifdef M_DEBUG
#ifndef STR #ifndef STR
#define STR(v) #v #define STR(v) #v
#endif #endif
#ifndef __riscos__ #ifndef __riscos__
#define M_DBGINFO(a) __FUNCTION__ "["__FILE__ ":" STR(a) "]" #define M_DBGINFO(a) __FUNCTION__ "["__FILE__ ":" STR(a) "]"
#else /* __riscos__ */ #else /* __riscos__ */
#define M_DBGINFO(a) "["__FILE__ ":" STR(a) "]" #define M_DBGINFO(a) "["__FILE__ ":" STR(a) "]"
#endif /* __riscos__ */ #endif /* __riscos__ */
#define m_alloc(n) m_debug_alloc((n), M_DBGINFO( __LINE__ ) ) #define m_alloc(n) m_debug_alloc((n), M_DBGINFO( __LINE__ ) )
#define m_alloc_clear(n) m_debug_alloc_clear((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); unsigned secmem_get_flags(void);
#define DBG_MEMORY memory_debug_mode #define DBG_MEMORY memory_debug_mode
#define DBG_MEMSTAT memory_stat_debug_mode #define DBG_MEMSTAT memory_stat_debug_mode
#ifndef EXTERN_UNLESS_MAIN_MODULE #ifndef EXTERN_UNLESS_MAIN_MODULE
#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE) #if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
#define EXTERN_UNLESS_MAIN_MODULE extern #define EXTERN_UNLESS_MAIN_MODULE extern
#else #else
#define EXTERN_UNLESS_MAIN_MODULE #define EXTERN_UNLESS_MAIN_MODULE
#endif #endif
#endif #endif
EXTERN_UNLESS_MAIN_MODULE int memory_debug_mode; EXTERN_UNLESS_MAIN_MODULE int memory_debug_mode;
EXTERN_UNLESS_MAIN_MODULE int memory_stat_debug_mode; EXTERN_UNLESS_MAIN_MODULE int memory_stat_debug_mode;
#endif /*G10_MEMORY_H*/ #endif /*G10_MEMORY_H*/

View File

@ -49,16 +49,16 @@
typedef unsigned short int mpi_limb_t; typedef unsigned short int mpi_limb_t;
typedef signed short int mpi_limb_signed_t; typedef signed short int mpi_limb_signed_t;
#else #else
#error BYTES_PER_MPI_LIMB does not match any C type #error BYTES_PER_MPI_LIMB does not match any C type
#endif #endif
#define BITS_PER_MPI_LIMB (8*BYTES_PER_MPI_LIMB) #define BITS_PER_MPI_LIMB (8*BYTES_PER_MPI_LIMB)
#ifndef EXTERN_UNLESS_MAIN_MODULE #ifndef EXTERN_UNLESS_MAIN_MODULE
#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE) #if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
#define EXTERN_UNLESS_MAIN_MODULE extern #define EXTERN_UNLESS_MAIN_MODULE extern
#else #else
#define EXTERN_UNLESS_MAIN_MODULE #define EXTERN_UNLESS_MAIN_MODULE
#endif #endif
#endif #endif
#define DBG_MPI mpi_debug_mode #define DBG_MPI mpi_debug_mode
@ -86,25 +86,25 @@ typedef struct gcry_mpi *MPI;
/*-- mpiutil.c --*/ /*-- mpiutil.c --*/
#ifdef M_DEBUG #ifdef M_DEBUG
#define mpi_alloc(n) mpi_debug_alloc((n), M_DBGINFO( __LINE__ ) ) #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_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_alloc_like(n) mpi_debug_alloc_like((n), M_DBGINFO( __LINE__ ) )
#define mpi_free(a) mpi_debug_free((a), 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_resize(a,b) mpi_debug_resize((a),(b), M_DBGINFO(__LINE__) )
#define mpi_copy(a) mpi_debug_copy((a), 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( unsigned nlimbs, const char *info );
MPI mpi_debug_alloc_secure( 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 ); MPI mpi_debug_alloc_like( MPI a, const char *info );
void mpi_debug_free( 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 ); void mpi_debug_resize( MPI a, unsigned nlimbs, const char *info );
MPI mpi_debug_copy( MPI a, const char *info ); MPI mpi_debug_copy( MPI a, const char *info );
#else #else
MPI mpi_alloc( unsigned nlimbs ); MPI mpi_alloc( unsigned nlimbs );
MPI mpi_alloc_secure( unsigned nlimbs ); MPI mpi_alloc_secure( unsigned nlimbs );
MPI mpi_alloc_like( MPI a ); MPI mpi_alloc_like( MPI a );
void mpi_free( MPI a ); void mpi_free( MPI a );
void mpi_resize( MPI a, unsigned nlimbs ); void mpi_resize( MPI a, unsigned nlimbs );
MPI mpi_copy( MPI a ); MPI mpi_copy( MPI a );
#endif #endif
#define mpi_is_opaque(a) ((a) && ((a)->flags&4)) #define mpi_is_opaque(a) ((a) && ((a)->flags&4))
MPI mpi_set_opaque( MPI a, void *p, int len ); MPI mpi_set_opaque( MPI a, void *p, int len );
@ -121,10 +121,10 @@ void mpi_swap( MPI a, MPI b);
/*-- mpicoder.c --*/ /*-- mpicoder.c --*/
int mpi_write( IOBUF out, MPI a ); int mpi_write( IOBUF out, MPI a );
#ifdef M_DEBUG #ifdef M_DEBUG
#define mpi_read(a,b,c) mpi_debug_read((a),(b),(c), M_DBGINFO( __LINE__ ) ) #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); MPI mpi_debug_read(IOBUF inp, unsigned *nread, int secure, const char *info);
#else #else
MPI mpi_read(IOBUF inp, unsigned *nread, int secure); MPI mpi_read(IOBUF inp, unsigned *nread, int secure);
#endif #endif
MPI mpi_read_from_buffer(byte *buffer, unsigned *ret_nread, int secure); MPI mpi_read_from_buffer(byte *buffer, unsigned *ret_nread, int secure);
int mpi_fromstr(MPI val, const char *str); int mpi_fromstr(MPI val, const char *str);
@ -193,5 +193,4 @@ void mpi_rshift( MPI x, MPI a, unsigned n );
/*-- mpi-inv.c --*/ /*-- mpi-inv.c --*/
void mpi_invm( MPI x, MPI u, MPI v ); void mpi_invm( MPI x, MPI u, MPI v );
#endif /*G10_MPI_H*/ #endif /*G10_MPI_H*/

View File

@ -29,16 +29,16 @@
/* The AC_CHECK_SIZEOF() in configure fails for some machines. /* The AC_CHECK_SIZEOF() in configure fails for some machines.
* we provide some fallback values here */ * we provide some fallback values here */
#if !SIZEOF_UNSIGNED_SHORT #if !SIZEOF_UNSIGNED_SHORT
#undef SIZEOF_UNSIGNED_SHORT #undef SIZEOF_UNSIGNED_SHORT
#define SIZEOF_UNSIGNED_SHORT 2 #define SIZEOF_UNSIGNED_SHORT 2
#endif #endif
#if !SIZEOF_UNSIGNED_INT #if !SIZEOF_UNSIGNED_INT
#undef SIZEOF_UNSIGNED_INT #undef SIZEOF_UNSIGNED_INT
#define SIZEOF_UNSIGNED_INT 4 #define SIZEOF_UNSIGNED_INT 4
#endif #endif
#if !SIZEOF_UNSIGNED_LONG #if !SIZEOF_UNSIGNED_LONG
#undef SIZEOF_UNSIGNED_LONG #undef SIZEOF_UNSIGNED_LONG
#define SIZEOF_UNSIGNED_LONG 4 #define SIZEOF_UNSIGNED_LONG 4
#endif #endif
@ -46,52 +46,52 @@
#ifndef HAVE_BYTE_TYPEDEF #ifndef HAVE_BYTE_TYPEDEF
#undef byte /* maybe there is a macro with this name */ #undef byte /* maybe there is a macro with this name */
#ifndef __riscos__ #ifndef __riscos__
typedef unsigned char byte; typedef unsigned char byte;
#else #else
/* Norcroft treats char = unsigned char as legal assignment /* Norcroft treats char = unsigned char as legal assignment
but char* = unsigned char* as illegal assignment but char* = unsigned char* as illegal assignment
and the same applies to the signed variants as well */ and the same applies to the signed variants as well */
typedef char byte; typedef char byte;
#endif #endif
#define HAVE_BYTE_TYPEDEF #define HAVE_BYTE_TYPEDEF
#endif #endif
#ifndef HAVE_USHORT_TYPEDEF #ifndef HAVE_USHORT_TYPEDEF
#undef ushort /* maybe there is a macro with this name */ #undef ushort /* maybe there is a macro with this name */
typedef unsigned short ushort; typedef unsigned short ushort;
#define HAVE_USHORT_TYPEDEF #define HAVE_USHORT_TYPEDEF
#endif #endif
#ifndef HAVE_ULONG_TYPEDEF #ifndef HAVE_ULONG_TYPEDEF
#undef ulong /* maybe there is a macro with this name */ #undef ulong /* maybe there is a macro with this name */
typedef unsigned long ulong; typedef unsigned long ulong;
#define HAVE_ULONG_TYPEDEF #define HAVE_ULONG_TYPEDEF
#endif #endif
#ifndef HAVE_U16_TYPEDEF #ifndef HAVE_U16_TYPEDEF
#undef u16 /* maybe there is a macro with this name */ #undef u16 /* maybe there is a macro with this name */
#if SIZEOF_UNSIGNED_INT == 2 #if SIZEOF_UNSIGNED_INT == 2
typedef unsigned int u16; typedef unsigned int u16;
#elif SIZEOF_UNSIGNED_SHORT == 2 #elif SIZEOF_UNSIGNED_SHORT == 2
typedef unsigned short u16; typedef unsigned short u16;
#else #else
#error no typedef for u16 #error no typedef for u16
#endif #endif
#define HAVE_U16_TYPEDEF #define HAVE_U16_TYPEDEF
#endif #endif
#ifndef HAVE_U32_TYPEDEF #ifndef HAVE_U32_TYPEDEF
#undef u32 /* maybe there is a macro with this name */ #undef u32 /* maybe there is a macro with this name */
#if SIZEOF_UNSIGNED_INT == 4 #if SIZEOF_UNSIGNED_INT == 4
typedef unsigned int u32; typedef unsigned int u32;
#elif SIZEOF_UNSIGNED_LONG == 4 #elif SIZEOF_UNSIGNED_LONG == 4
typedef unsigned long u32; typedef unsigned long u32;
#else #else
#error no typedef for u32 #error no typedef for u32
#endif #endif
#define HAVE_U32_TYPEDEF #define HAVE_U32_TYPEDEF
#endif #endif
/**************** /****************
@ -100,24 +100,24 @@
* Solaris and IRIX. * Solaris and IRIX.
*/ */
#ifndef HAVE_U64_TYPEDEF #ifndef HAVE_U64_TYPEDEF
#undef u64 /* maybe there is a macro with this name */ #undef u64 /* maybe there is a macro with this name */
#if SIZEOF_UNSIGNED_INT == 8 #if SIZEOF_UNSIGNED_INT == 8
typedef unsigned int u64; typedef unsigned int u64;
#define U64_C(c) (c ## U) #define U64_C(c) (c ## U)
#define HAVE_U64_TYPEDEF #define HAVE_U64_TYPEDEF
#elif SIZEOF_UNSIGNED_LONG == 8 #elif SIZEOF_UNSIGNED_LONG == 8
typedef unsigned long u64; typedef unsigned long u64;
#define U64_C(c) (c ## UL) #define U64_C(c) (c ## UL)
#define HAVE_U64_TYPEDEF #define HAVE_U64_TYPEDEF
#elif SIZEOF_UNSIGNED_LONG_LONG == 8 #elif SIZEOF_UNSIGNED_LONG_LONG == 8
typedef unsigned long long u64; typedef unsigned long long u64;
#define U64_C(c) (c ## ULL) #define U64_C(c) (c ## ULL)
#define HAVE_U64_TYPEDEF #define HAVE_U64_TYPEDEF
#elif SIZEOF_UINT64_T == 8 #elif SIZEOF_UINT64_T == 8
typedef uint64_t u64; typedef uint64_t u64;
#define U64_C(c) (UINT64_C(c)) #define U64_C(c) (UINT64_C(c))
#define HAVE_U64_TYPEDEF #define HAVE_U64_TYPEDEF
#endif #endif
#endif #endif
typedef union { typedef union {
@ -125,9 +125,9 @@ typedef union {
short b; short b;
char c[1]; char c[1];
long d; long d;
#ifdef HAVE_U64_TYPEDEF #ifdef HAVE_U64_TYPEDEF
u64 e; u64 e;
#endif #endif
float f; float f;
double g; double g;
} PROPERLY_ALIGNED_TYPE; } PROPERLY_ALIGNED_TYPE;
@ -138,5 +138,4 @@ typedef struct string_list {
char d[1]; char d[1];
} *STRLIST; } *STRLIST;
#endif /*G10_TYPES_H*/ #endif /*G10_TYPES_H*/

View File

@ -21,7 +21,7 @@
#define G10_UTIL_H #define G10_UTIL_H
#if defined (__MINGW32__) || defined (__CYGWIN32__) #if defined (__MINGW32__) || defined (__CYGWIN32__)
# include <stdarg.h> #include <stdarg.h>
#endif #endif
#include "types.h" #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, ... ) void g10_log_debug_f( const char *fname, const char *fmt, ... )
__attribute__ ((format (printf,2,3))); __attribute__ ((format (printf,2,3)));
#ifndef __riscos__ #ifndef __riscos__
#define BUG() g10_log_bug0( __FILE__ , __LINE__, __FUNCTION__ ) #define BUG() g10_log_bug0( __FILE__ , __LINE__, __FUNCTION__ )
#else #else
#define BUG() g10_log_bug0( __FILE__ , __LINE__, __func__ ) #define BUG() g10_log_bug0( __FILE__ , __LINE__, __func__ )
#endif #endif
#else #else
void g10_log_bug( const char *fmt, ... ); 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_error_f( const char *fname, const char *fmt, ... );
void g10_log_info_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, ... ); 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 #endif
#define log_hexdump g10_log_hexdump #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); int strncasecmp (const char *, const char *b, size_t n);
#endif #endif
#ifndef HAVE_STRTOUL #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 #endif
#ifndef HAVE_MEMMOVE #ifndef HAVE_MEMMOVE
#define memmove(d, s, n) bcopy((s), (d), (n)) #define memmove(d, s, n) bcopy((s), (d), (n))
#endif #endif
#if defined (__MINGW32__) #if defined (__MINGW32__)
@ -246,16 +246,16 @@ int vasprintf ( char **result, const char *format, va_list args);
/**** other missing stuff ****/ /**** other missing stuff ****/
#ifndef HAVE_ATEXIT /* For SunOS */ #ifndef HAVE_ATEXIT /* For SunOS */
#define atexit(a) (on_exit((a),0)) #define atexit(a) (on_exit((a),0))
#endif #endif
#ifndef HAVE_RAISE #ifndef HAVE_RAISE
#define raise(a) kill(getpid(), (a)) #define raise(a) kill(getpid(), (a))
#endif #endif
/******** some macros ************/ /******** some macros ************/
#ifndef STR #ifndef STR
#define STR(v) #v #define STR(v) #v
#endif #endif
#define STR2(v) STR(v) #define STR2(v) STR(v)
#define DIM(v) (sizeof(v)/sizeof((v)[0])) #define DIM(v) (sizeof(v)/sizeof((v)[0]))
@ -295,11 +295,10 @@ void riscos_dump_fdlist(void);
void riscos_list_openfiles(void); void riscos_list_openfiles(void);
#endif #endif
#ifndef __RISCOS__C__ #ifndef __RISCOS__C__
#define getpid riscos_getpid #define getpid riscos_getpid
#define kill(a,b) riscos_kill((a),(b)) #define kill(a,b) riscos_kill((a),(b))
#define access(a,b) riscos_access((a),(b)) #define access(a,b) riscos_access((a),(b))
#endif /* !__RISCOS__C__ */ #endif /* !__RISCOS__C__ */
#endif /* __riscos__ */ #endif /* __riscos__ */
#endif /*G10_UTIL_H*/ #endif /*G10_UTIL_H*/