diff options
author | unknown <serg@serg.mylan> | 2004-04-07 22:16:16 +0200 |
---|---|---|
committer | unknown <serg@serg.mylan> | 2004-04-07 22:16:16 +0200 |
commit | 94002eb59512e78df76922ae5c2204359fc306e4 (patch) | |
tree | 396f0d6b77f33508416195ab2a51a4ef1ee00edc /include/my_global.h | |
parent | 2d57a4074c6af4c1f0f0b6f10ac70f9ce84918b0 (diff) | |
download | mariadb-git-94002eb59512e78df76922ae5c2204359fc306e4.tar.gz |
escaping all molty-statement macro
Diffstat (limited to 'include/my_global.h')
-rw-r--r-- | include/my_global.h | 157 |
1 files changed, 79 insertions, 78 deletions
diff --git a/include/my_global.h b/include/my_global.h index e114aefecca..6a5b7663c66 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -934,19 +934,19 @@ typedef char bool; /* Ordinary boolean values 0 1 */ (((uint32) ((uchar) (A)[1])) << 8) +\ (((uint32) ((uchar) (A)[2])) << 16) +\ (((uint32) ((uchar) (A)[3])) << 24)) +\ - (((ulonglong) ((uchar) (A)[4])) << 32)) + (((ulonglong) ((uchar) (A)[4])) << 32)) #define uint8korr(A) (*((ulonglong *) (A))) #define sint8korr(A) (*((longlong *) (A))) #define int2store(T,A) *((uint16*) (T))= (uint16) (A) -#define int3store(T,A) { *(T)= (uchar) ((A));\ - *(T+1)=(uchar) (((uint) (A) >> 8));\ - *(T+2)=(uchar) (((A) >> 16)); } +#define int3store(T,A) do { *(T)= (uchar) ((A));\ + *(T+1)=(uchar) (((uint) (A) >> 8));\ + *(T+2)=(uchar) (((A) >> 16)); } while (0) #define int4store(T,A) *((long *) (T))= (long) (A) -#define int5store(T,A) { *(T)= (uchar)((A));\ - *((T)+1)=(uchar) (((A) >> 8));\ - *((T)+2)=(uchar) (((A) >> 16));\ - *((T)+3)=(uchar) (((A) >> 24)); \ - *((T)+4)=(uchar) (((A) >> 32)); } +#define int5store(T,A) do { *(T)= (uchar)((A));\ + *((T)+1)=(uchar) (((A) >> 8));\ + *((T)+2)=(uchar) (((A) >> 16));\ + *((T)+3)=(uchar) (((A) >> 24)); \ + *((T)+4)=(uchar) (((A) >> 32)); } while(0) #define int8store(T,A) *((ulonglong *) (T))= (ulonglong) (A) typedef union { @@ -954,13 +954,14 @@ typedef union { long m[2]; } doubleget_union; #define doubleget(V,M) \ -{ doubleget_union _tmp; \ - _tmp.m[0] = *((long*)(M)); \ - _tmp.m[1] = *(((long*) (M))+1); \ - (V) = _tmp.v; } -#define doublestore(T,V) { *((long *) T) = ((doubleget_union *)&V)->m[0]; \ - *(((long *) T)+1) = ((doubleget_union *)&V)->m[1]; } -#define float4get(V,M) { *((long *) &(V)) = *((long*) (M)); } +do { doubleget_union _tmp; \ + _tmp.m[0] = *((long*)(M)); \ + _tmp.m[1] = *(((long*) (M))+1); \ + (V) = _tmp.v; } while(0) +#define doublestore(T,V) do { *((long *) T) = ((doubleget_union *)&V)->m[0]; \ + *(((long *) T)+1) = ((doubleget_union *)&V)->m[1]; \ + } while (0) +#define float4get(V,M) do { *((long *) &(V)) = *((long*) (M)); } while(0) #define float8get(V,M) doubleget((V),(M)) #define float4store(V,M) memcpy((byte*) V,(byte*) (&M),sizeof(float)) #define float8store(V,M) doublestore((V),(M)) @@ -995,7 +996,7 @@ typedef union { (((uint32) ((uchar) (A)[1])) << 8) +\ (((uint32) ((uchar) (A)[2])) << 16) +\ (((uint32) ((uchar) (A)[3])) << 24)) +\ - (((ulonglong) ((uchar) (A)[4])) << 32)) + (((ulonglong) ((uchar) (A)[4])) << 32)) #define uint8korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\ (((uint32) ((uchar) (A)[1])) << 8) +\ (((uint32) ((uchar) (A)[2])) << 16) +\ @@ -1004,50 +1005,50 @@ typedef union { (((uint32) ((uchar) (A)[5])) << 8) +\ (((uint32) ((uchar) (A)[6])) << 16) +\ (((uint32) ((uchar) (A)[7])) << 24))) <<\ - 32)) -#define int2store(T,A) { uint def_temp= (uint) (A) ;\ - *((uchar*) (T))= (uchar)(def_temp); \ - *((uchar*) (T+1))=(uchar)((def_temp >> 8)); } -#define int3store(T,A) { /*lint -save -e734 */\ - *((uchar*)(T))=(uchar) ((A));\ - *((uchar*) (T)+1)=(uchar) (((A) >> 8));\ - *((uchar*)(T)+2)=(uchar) (((A) >> 16)); \ - /*lint -restore */} -#define int4store(T,A) { *(T)=(char) ((A));\ - *((T)+1)=(char) (((A) >> 8));\ - *((T)+2)=(char) (((A) >> 16));\ - *((T)+3)=(char) (((A) >> 24)); } -#define int5store(T,A) { *(T)=((A));\ - *((T)+1)=(((A) >> 8));\ - *((T)+2)=(((A) >> 16));\ - *((T)+3)=(((A) >> 24)); \ - *((T)+4)=(((A) >> 32)); } -#define int8store(T,A) { uint def_temp= (uint) (A), def_temp2= (uint) ((A) >> 32); \ - int4store((T),def_temp); \ - int4store((T+4),def_temp2); \ - } + 32)) +#define int2store(T,A) do { uint def_temp= (uint) (A) ;\ + *((uchar*) (T))= (uchar)(def_temp); \ + *((uchar*) (T+1))=(uchar)((def_temp >> 8)); \ + } while(0) +#define int3store(T,A) do { /*lint -save -e734 */\ + *((uchar*)(T))=(uchar) ((A));\ + *((uchar*) (T)+1)=(uchar) (((A) >> 8));\ + *((uchar*)(T)+2)=(uchar) (((A) >> 16)); \ + /*lint -restore */} while(0) +#define int4store(T,A) do { *(T)=(char) ((A));\ + *((T)+1)=(char) (((A) >> 8));\ + *((T)+2)=(char) (((A) >> 16));\ + *((T)+3)=(char) (((A) >> 24)); } while(0) +#define int5store(T,A) do { *(T)=((A));\ + *((T)+1)=(((A) >> 8));\ + *((T)+2)=(((A) >> 16));\ + *((T)+3)=(((A) >> 24)); \ + *((T)+4)=(((A) >> 32)); } while(0) +#define int8store(T,A) do { uint def_temp= (uint) (A), def_temp2= (uint) ((A) >> 32); \ + int4store((T),def_temp); \ + int4store((T+4),def_temp2); } while(0) #ifdef WORDS_BIGENDIAN -#define float4store(T,A) { *(T)= ((byte *) &A)[3];\ +#define float4store(T,A) do { *(T)= ((byte *) &A)[3];\ *((T)+1)=(char) ((byte *) &A)[2];\ *((T)+2)=(char) ((byte *) &A)[1];\ - *((T)+3)=(char) ((byte *) &A)[0]; } + *((T)+3)=(char) ((byte *) &A)[0]; } while(0) -#define float4get(V,M) { float def_temp;\ +#define float4get(V,M) do { float def_temp;\ ((byte*) &def_temp)[0]=(M)[3];\ ((byte*) &def_temp)[1]=(M)[2];\ ((byte*) &def_temp)[2]=(M)[1];\ ((byte*) &def_temp)[3]=(M)[0];\ - (V)=def_temp; } -#define float8store(T,V) { *(T)= ((byte *) &V)[7];\ + (V)=def_temp; } while(0) +#define float8store(T,V) do { *(T)= ((byte *) &V)[7];\ *((T)+1)=(char) ((byte *) &V)[6];\ *((T)+2)=(char) ((byte *) &V)[5];\ *((T)+3)=(char) ((byte *) &V)[4];\ *((T)+4)=(char) ((byte *) &V)[3];\ *((T)+5)=(char) ((byte *) &V)[2];\ *((T)+6)=(char) ((byte *) &V)[1];\ - *((T)+7)=(char) ((byte *) &V)[0]; } + *((T)+7)=(char) ((byte *) &V)[0]; } while(0) -#define float8get(V,M) { double def_temp;\ +#define float8get(V,M) do { double def_temp;\ ((byte*) &def_temp)[0]=(M)[7];\ ((byte*) &def_temp)[1]=(M)[6];\ ((byte*) &def_temp)[2]=(M)[5];\ @@ -1056,21 +1057,21 @@ typedef union { ((byte*) &def_temp)[5]=(M)[2];\ ((byte*) &def_temp)[6]=(M)[1];\ ((byte*) &def_temp)[7]=(M)[0];\ - (V) = def_temp; } + (V) = def_temp; } while(0) #else #define float4get(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(float)) #define float4store(V,M) memcpy_fixed((byte*) V,(byte*) (&M),sizeof(float)) #if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN) -#define doublestore(T,V) { *(T)= ((byte *) &V)[4];\ +#define doublestore(T,V) do { *(T)= ((byte *) &V)[4];\ *((T)+1)=(char) ((byte *) &V)[5];\ *((T)+2)=(char) ((byte *) &V)[6];\ *((T)+3)=(char) ((byte *) &V)[7];\ *((T)+4)=(char) ((byte *) &V)[0];\ *((T)+5)=(char) ((byte *) &V)[1];\ *((T)+6)=(char) ((byte *) &V)[2];\ - *((T)+7)=(char) ((byte *) &V)[3]; } -#define doubleget(V,M) { double def_temp;\ + *((T)+7)=(char) ((byte *) &V)[3]; } while(0) +#define doubleget(V,M) do { double def_temp;\ ((byte*) &def_temp)[0]=(M)[4];\ ((byte*) &def_temp)[1]=(M)[5];\ ((byte*) &def_temp)[2]=(M)[6];\ @@ -1079,7 +1080,7 @@ typedef union { ((byte*) &def_temp)[5]=(M)[1];\ ((byte*) &def_temp)[6]=(M)[2];\ ((byte*) &def_temp)[7]=(M)[3];\ - (V) = def_temp; } + (V) = def_temp; } while(0) #endif /* __FLOAT_WORD_ORDER */ #define float8get(V,M) doubleget((V),(M)) @@ -1096,29 +1097,29 @@ typedef union { #ifdef WORDS_BIGENDIAN -#define ushortget(V,M) { V = (uint16) (((uint16) ((uchar) (M)[1]))+\ - ((uint16) ((uint16) (M)[0]) << 8)); } -#define shortget(V,M) { V = (short) (((short) ((uchar) (M)[1]))+\ - ((short) ((short) (M)[0]) << 8)); } -#define longget(V,M) { int32 def_temp;\ - ((byte*) &def_temp)[0]=(M)[0];\ - ((byte*) &def_temp)[1]=(M)[1];\ - ((byte*) &def_temp)[2]=(M)[2];\ - ((byte*) &def_temp)[3]=(M)[3];\ - (V)=def_temp; } -#define ulongget(V,M) { uint32 def_temp;\ - ((byte*) &def_temp)[0]=(M)[0];\ - ((byte*) &def_temp)[1]=(M)[1];\ - ((byte*) &def_temp)[2]=(M)[2];\ - ((byte*) &def_temp)[3]=(M)[3];\ - (V)=def_temp; } -#define shortstore(T,A) { uint def_temp=(uint) (A) ;\ - *(T+1)=(char)(def_temp); \ - *(T+0)=(char)(def_temp >> 8); } -#define longstore(T,A) { *((T)+3)=((A));\ - *((T)+2)=(((A) >> 8));\ - *((T)+1)=(((A) >> 16));\ - *((T)+0)=(((A) >> 24)); } +#define ushortget(V,M) do { V = (uint16) (((uint16) ((uchar) (M)[1]))+\ + ((uint16) ((uint16) (M)[0]) << 8)); } while(0) +#define shortget(V,M) do { V = (short) (((short) ((uchar) (M)[1]))+\ + ((short) ((short) (M)[0]) << 8)); } while(0) +#define longget(V,M) do { int32 def_temp;\ + ((byte*) &def_temp)[0]=(M)[0];\ + ((byte*) &def_temp)[1]=(M)[1];\ + ((byte*) &def_temp)[2]=(M)[2];\ + ((byte*) &def_temp)[3]=(M)[3];\ + (V)=def_temp; } while(0) +#define ulongget(V,M) do { uint32 def_temp;\ + ((byte*) &def_temp)[0]=(M)[0];\ + ((byte*) &def_temp)[1]=(M)[1];\ + ((byte*) &def_temp)[2]=(M)[2];\ + ((byte*) &def_temp)[3]=(M)[3];\ + (V)=def_temp; } while(0) +#define shortstore(T,A) do { uint def_temp=(uint) (A) ;\ + *(T+1)=(char)(def_temp); \ + *(T+0)=(char)(def_temp >> 8); } while(0) +#define longstore(T,A) do { *((T)+3)=((A));\ + *((T)+2)=(((A) >> 8));\ + *((T)+1)=(((A) >> 16));\ + *((T)+0)=(((A) >> 24)); } while(0) #define doubleget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(double)) #define doublestore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(double)) @@ -1127,10 +1128,10 @@ typedef union { #else -#define ushortget(V,M) { V = uint2korr(M); } -#define shortget(V,M) { V = sint2korr(M); } -#define longget(V,M) { V = sint4korr(M); } -#define ulongget(V,M) { V = uint4korr(M); } +#define ushortget(V,M) do { V = uint2korr(M); } while(0) +#define shortget(V,M) do { V = sint2korr(M); } while(0) +#define longget(V,M) do { V = sint4korr(M); } while(0) +#define ulongget(V,M) do { V = uint4korr(M); } while(0) #define shortstore(T,V) int2store(T,V) #define longstore(T,V) int4store(T,V) #ifndef doubleget |