gptsync/gptsync.c
static VOID sort_mbr(PARTITION_INFO *parts) {
   PARTITION_INFO one_part;
   int c, d;

   if (parts == NULL)
      return;

   for (c = 0 ; c < 3; c++) {
      for (d = 1 ; d < 3 - c; d++) {
         if ((parts[d].start_lba > parts[d + 1].start_lba) && (parts[d].start_lba > 0) && (parts[d + 1].start_lba > 0)) {
            one_part           = parts[d];
            parts[d]           = parts[d + 1];
            parts[d + 1]       = one_part;
            parts[d].index     = d;
            parts[d + 1].index = d + 1;
         } // if
      } // for
   } // for
}
// A simple bubble sort for the MBR partitions.
A simple bubble sort for the MBR partitions.
A simple bubble sort for the MBR partitions .
static VOID sort_mbr(PARTITION_INFO *parts) {
   PARTITION_INFO one_part;
   int c, d;
   if (parts == NULL)
      return;
   for (c = 0 ; c < 3; c++) {
      for (d = 1 ; d < 3 - c; d++) {
         if ((parts[d].start_lba > parts[d + 1].start_lba) && (parts[d].start_lba > 0) && (parts[d + 1].start_lba > 0)) {
            one_part           = parts[d];
            parts[d]           = parts[d + 1];
            parts[d + 1]       = one_part;
            parts[d].index     = d;
            parts[d + 1].index = d + 1;
         } 
      } 
   } 
}
static VOID sort_mbr ( PARTITION_INFO * parts ) { PARTITION_INFO one_part ; int c , d ; if ( parts == NULL ) return ; for ( c = 0 ; c < 3 ; c ++ ) { for ( d = 1 ; d < 3 - c ; d ++ ) { if ( ( parts [ d ] . start_lba > parts [ d + 1 ] . start_lba ) && ( parts [ d ] . start_lba > 0 ) && ( parts [ d + 1 ] . start_lba > 0 ) ) { one_part = parts [ d ] ; parts [ d ] = parts [ d + 1 ] ; parts [ d + 1 ] = one_part ; parts [ d ] . index = d ; parts [ d + 1 ] . index = d + 1 ; } } } }
A simple bubble sort for the MBR partitions.
A simple bubble sort for the MBR partitions .
// if // for // for