@@ -84,7 +84,7 @@ struct MasterInfoFile: InfoFile
8484 optional.emplace (value);
8585 return *this ;
8686 }
87- bool is_default () override { return optional.has_value (); }
87+ bool is_default () override { return ! optional.has_value (); }
8888 bool set_default () override
8989 {
9090 optional.reset ();
@@ -214,25 +214,21 @@ struct MasterInfoFile: InfoFile
214214 // / +1 for the terminating delimiter
215215 char buf[IntIOCache::BUF_SIZE<uint32_t > + 1 ];
216216 for (i=0 ; i < sizeof (buf); ++i)
217- switch (int c= my_b_get (file)) {
218- case my_b_EOF:
217+ {
218+ int c= my_b_get (file);
219+ if (c == my_b_EOF)
219220 return true ;
220- case ' ' : // End of Field
221- case ' \n ' : // End of Line
222- goto break_for1;
223- default :
224- buf[i]= c;
225- }
226- break_for1:
221+ buf[i]= c;
222+ if (c == /* End of Line */ ' \n ' || c == /* End of Count */ ' ' )
223+ break ;
224+ }
227225 /*
228226 * std::from_chars() fails if `count` will overflow in any way.
229227 * exclusive end index of the string = size
230228 */
231229 std::from_chars_result result= std::from_chars (buf, &buf[i], count);
232- if (result.ec != IntIOCache::ERRC_OK)
233- return true ;
234230 // Reserve enough elements ahead of time.
235- if (allocate_dynamic (&array, count))
231+ if (result. ec != IntIOCache::ERRC_OK || allocate_dynamic (&array, count))
236232 return true ;
237233 while (count--)
238234 {
@@ -244,20 +240,18 @@ struct MasterInfoFile: InfoFile
244240 if (*(result.ptr ) != ' ' )
245241 return true ;
246242 for (i=0 ; i < sizeof (buf); ++i)
243+ {
247244 /*
248245 Bottlenecks from repeated IO does not affect the
249246 performance of reading char by char thanks to the cache.
250247 */
251- switch ( int c= my_b_get (file)) {
252- case my_b_EOF:
248+ int c= my_b_get (file);
249+ if (c == my_b_EOF)
253250 return true ;
254- case ' ' : // End of Field
255- case ' \n ' : // End of Line
256- goto break_for2;
257- default :
258- buf[i]= c;
259- }
260- break_for2:
251+ buf[i]= c;
252+ if (c == /* End of Count */ ' ' || c == /* End of Line */ ' \n ' )
253+ break ;
254+ }
261255 result= std::from_chars (buf, &buf[i], value);
262256 if (result.ec != IntIOCache::ERRC_OK)
263257 return true ;
@@ -359,7 +353,7 @@ struct MasterInfoFile: InfoFile
359353 return *this ;
360354 }
361355 bool is_default () override
362- { return mode < = enum_master_use_gtid::DEFAULT; }
356+ { return mode > = enum_master_use_gtid::DEFAULT; }
363357 bool set_default () override
364358 {
365359 mode= enum_master_use_gtid::DEFAULT;
@@ -446,7 +440,7 @@ struct MasterInfoFile: InfoFile
446440 {
447441 my_b_write (file, (const uchar *)buf, size - 3 );
448442 my_b_write_byte (file, ' .' );
449- my_b_write (file, & (const uchar &) result.ptr [-3 ], 3 );
443+ my_b_write (file, (const uchar *)(& result.ptr [-3 ]) , 3 );
450444 }
451445 else
452446 {
@@ -480,7 +474,7 @@ struct MasterInfoFile: InfoFile
480474 &MasterInfoFile::master_ssl_key,
481475 &MasterInfoFile::master_ssl_verify_server_cert,
482476 &MasterInfoFile::master_heartbeat_period,
483- // &MasterInfoFile::master_bind, // MDEV-19248
477+ nullptr , // &MasterInfoFile::master_bind, // MDEV-19248
484478 &MasterInfoFile::ignore_server_ids,
485479 nullptr , // MySQL field `master_uuid`, which MariaDB ignores.
486480 &MasterInfoFile::master_retry_count,
0 commit comments