1010 * may not be compiled always. -- marko
1111 */
1212
13- #include <postgres.h>
13+ #include "postgres.h"
14+
1415#include "px-crypt.h"
1516
1617#include <errno.h>
1718#ifndef __set_errno
18- #define __set_errno (val ) errno = (val)
19- #endif
20-
21- #undef __CONST
22- #ifdef __GNUC__
23- #define __CONST __const
24- #else
25- #define __CONST
19+ #define __set_errno (val ) (errno = (val))
2620#endif
2721
2822typedef unsigned int BF_word ;
@@ -31,7 +25,7 @@ unsigned char _crypt_itoa64[64 + 1] =
3125 "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" ;
3226
3327char * _crypt_gensalt_traditional_rn (unsigned long count ,
34- __CONST char * input , int size , char * output , int output_size )
28+ const char * input , int size , char * output , int output_size )
3529{
3630 if (size < 2 || output_size < 2 + 1 || (count && count != 25 )) {
3731 if (output_size > 0 ) output [0 ] = '\0' ;
@@ -47,7 +41,7 @@ char *_crypt_gensalt_traditional_rn(unsigned long count,
4741}
4842
4943char * _crypt_gensalt_extended_rn (unsigned long count ,
50- __CONST char * input , int size , char * output , int output_size )
44+ const char * input , int size , char * output , int output_size )
5145{
5246 unsigned long value ;
5347
@@ -80,7 +74,7 @@ char *_crypt_gensalt_extended_rn(unsigned long count,
8074}
8175
8276char * _crypt_gensalt_md5_rn (unsigned long count ,
83- __CONST char * input , int size , char * output , int output_size )
77+ const char * input , int size , char * output , int output_size )
8478{
8579 unsigned long value ;
8680
@@ -121,7 +115,7 @@ char *_crypt_gensalt_md5_rn(unsigned long count,
121115static unsigned char BF_itoa64 [64 + 1 ] =
122116 "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" ;
123117
124- static void BF_encode (char * dst , __CONST BF_word * src , int size )
118+ static void BF_encode (char * dst , const BF_word * src , int size )
125119{
126120 unsigned char * sptr = (unsigned char * )src ;
127121 unsigned char * end = sptr + size ;
@@ -154,7 +148,7 @@ static void BF_encode(char *dst, __CONST BF_word *src, int size)
154148}
155149
156150char * _crypt_gensalt_blowfish_rn (unsigned long count ,
157- __CONST char * input , int size , char * output , int output_size )
151+ const char * input , int size , char * output , int output_size )
158152{
159153 if (size < 16 || output_size < 7 + 22 + 1 ||
160154 (count && (count < 4 || count > 31 ))) {
0 commit comments