File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -750,6 +750,8 @@ static char *(features[]) =
750750
751751static int included_patches [] =
752752{ /* Add new patch number below this line */
753+ /**/
754+ 1973 ,
753755/**/
754756 1972 ,
755757/**/
@@ -4725,11 +4727,21 @@ highest_patch(void)
47254727 int
47264728has_patch (int n )
47274729{
4728- int i ;
4730+ int h , m , l ;
47294731
4730- for (i = 0 ; included_patches [i ] != 0 ; ++ i )
4731- if (included_patches [i ] == n )
4732+ // Perform a binary search.
4733+ l = 0 ;
4734+ h = (int )(sizeof (included_patches ) / sizeof (included_patches [0 ])) - 1 ;
4735+ while (l < h )
4736+ {
4737+ m = (l + h ) / 2 ;
4738+ if (included_patches [m ] == n )
47324739 return TRUE;
4740+ if (included_patches [m ] < n )
4741+ h = m ;
4742+ else
4743+ l = m + 1 ;
4744+ }
47334745 return FALSE;
47344746}
47354747#endif
@@ -4941,9 +4953,7 @@ list_version(void)
49414953 {
49424954 msg_puts (_ ("\nIncluded patches: " ));
49434955 first = -1 ;
4944- // find last one
4945- for (i = 0 ; included_patches [i ] != 0 ; ++ i )
4946- ;
4956+ i = (int )(sizeof (included_patches ) / sizeof (included_patches [0 ])) - 1 ;
49474957 while (-- i >= 0 )
49484958 {
49494959 if (first < 0 )
You can’t perform that action at this time.
0 commit comments