@@ -295,6 +295,9 @@ static char* extract_pg_edition_str()
295
295
#define COMPATIBILITY_VAL_STR (macro ) { #macro, macro, 0 }
296
296
#define COMPATIBILITY_VAL_INT (macro ) { #macro, NULL, macro }
297
297
298
+ #define COMPATIBILITY_VAL_SEPARATOR "="
299
+ #define COMPATIBILITY_LINE_SEPARATOR "\n"
300
+
298
301
/*
299
302
* Compose compatibility string to be sent by pg_probackup agent
300
303
* through ssh and to be verified by pg_probackup peer.
@@ -303,7 +306,13 @@ static char* extract_pg_edition_str()
303
306
*/
304
307
size_t prepare_compatibility_str (char * compatibility_buf , size_t compatibility_buf_size )
305
308
{
306
- struct { const char * name ; const char * strval ; int intval ; } compatibility_params [] = {
309
+ typedef struct compatibility_param_tag {
310
+ const char * name ;
311
+ const char * strval ;
312
+ int intval ;
313
+ } compatibility_param ;
314
+
315
+ compatibility_param compatibility_params [] = {
307
316
COMPATIBILITY_VAL_STR (PG_MAJORVERSION ),
308
317
{ "edition" , extract_pg_edition_str (), 0 },
309
318
COMPATIBILITY_VAL_INT (SIZEOF_VOID_P ),
@@ -312,16 +321,16 @@ size_t prepare_compatibility_str(char* compatibility_buf, size_t compatibility_b
312
321
size_t result_size = 0 ;
313
322
* compatibility_buf = '\0' ;
314
323
315
- for (int i = 0 ; i < sizeof compatibility_params ; i += 2 )
324
+ for (int i = 0 ; i < ( sizeof compatibility_params / sizeof ( compatibility_param )) ; i ++ )
316
325
{
317
326
if (compatibility_params [i ].strval != NULL )
318
327
result_size += snprintf (compatibility_buf + result_size , compatibility_buf_size - result_size ,
319
- "%s=%s/n" ,
328
+ "%s" COMPATIBILITY_VAL_SEPARATOR "%s" COMPATIBILITY_LINE_SEPARATOR ,
320
329
compatibility_params [i ].name ,
321
330
compatibility_params [i ].strval );
322
331
else
323
332
result_size += snprintf (compatibility_buf + result_size , compatibility_buf_size - result_size ,
324
- "%s=%d/n" ,
333
+ "%s" COMPATIBILITY_VAL_SEPARATOR "%d" COMPATIBILITY_LINE_SEPARATOR ,
325
334
compatibility_params [i ].name ,
326
335
compatibility_params [i ].intval );
327
336
Assert (result_size < compatibility_buf_size );
0 commit comments