@@ -249,26 +249,13 @@ bool launch_agent(void)
249
249
return true;
250
250
}
251
251
252
- #define COMPATIBILITY_VAL (macro ) #macro, macro
253
- #define COMPATIBILITY_STR (macro ) # macro
254
- #define COMPATIBILITY_VAL_STR (macro ) #macro, COMPATIBILITY_STR (macro)
252
+ #define COMPATIBILITY_VAL_STR (macro ) #macro, macro
253
+ #define COMPATIBILITY_VAL_INT_HELPER (macro , helper_buf , buf_size ) (snprintf(helper_buf, buf_size, "%d", macro), helper_buf)
254
+ #define COMPATIBILITY_VAL_INT (macro , helper_buf , buf_size ) #macro, COMPATIBILITY_VAL_INT_HELPER (macro, helper_buf, buf_size )
255
255
256
256
#define COMPATIBILITY_VAL_SEPARATOR "="
257
257
#define COMPATIBILITY_LINE_SEPARATOR "\n"
258
258
259
- static char * compatibility_params [] = {
260
- COMPATIBILITY_VAL (PG_MAJORVERSION ),
261
- //TODO remove?
262
- //TODO doesn't work macro name check for ints!!!!
263
- COMPATIBILITY_VAL_STR (SIZEOF_VOID_P ),
264
- //TODO REVIEW XXX can use edition.h/extract_pgpro_edition()
265
- #ifdef PGPRO_EDN
266
- //TODO add vanilla
267
- //TODO make "1c" -> "vanilla"
268
- COMPATIBILITY_VAL (PGPRO_EDN ),
269
- #endif
270
- };
271
-
272
259
/*
273
260
* Compose compatibility string to be sent by pg_probackup agent
274
261
* through ssh and to be verified by pg_probackup peer.
@@ -277,6 +264,18 @@ static char* compatibility_params[] = {
277
264
*/
278
265
size_t prepare_compatibility_str (char * compatibility_buf , size_t compatibility_buf_size )
279
266
{
267
+ char compatibility_val_int_macro_helper_buf [32 ];
268
+ char * compatibility_params [] = {
269
+ COMPATIBILITY_VAL_STR (PG_MAJORVERSION ),
270
+ #ifdef PGPRO_EDN
271
+ //TODO REVIEW can use edition.h/extract_pgpro_edition()
272
+ COMPATIBILITY_VAL_STR (PGPRO_EDN ),
273
+ #endif
274
+ //TODO REVIEW remove? no difference between 32/64 in global/pg_control.
275
+ COMPATIBILITY_VAL_INT (SIZEOF_VOID_P ,
276
+ compatibility_val_int_macro_helper_buf , sizeof compatibility_val_int_macro_helper_buf ),
277
+ };
278
+
280
279
size_t result_size = 0 ;
281
280
size_t compatibility_params_array_size = sizeof compatibility_params / sizeof compatibility_params [0 ];;
282
281
0 commit comments