100-fdisk_use_qsort.patch 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. --- a/libfdisk/src/sun.c
  2. +++ b/libfdisk/src/sun.c
  3. @@ -361,10 +361,10 @@ static void fetch_sun(struct fdisk_conte
  4. }
  5. }
  6. -static int verify_sun_cmp(int *a, int *b, void *data)
  7. -{
  8. - unsigned int *verify_sun_starts = (unsigned int *) data;
  9. +static unsigned int *verify_sun_starts;
  10. +static int verify_sun_cmp(int *a, int *b)
  11. +{
  12. if (*a == -1)
  13. return 1;
  14. if (*b == -1)
  15. @@ -379,7 +379,6 @@ static int sun_verify_disklabel(struct f
  16. uint32_t starts[SUN_MAXPARTITIONS], lens[SUN_MAXPARTITIONS], start, stop;
  17. uint32_t i,j,k,starto,endo;
  18. int array[SUN_MAXPARTITIONS];
  19. - unsigned int *verify_sun_starts;
  20. assert(cxt);
  21. assert(cxt->label);
  22. @@ -427,9 +426,8 @@ static int sun_verify_disklabel(struct f
  23. else
  24. array[i] = -1;
  25. }
  26. - qsort_r(array,ARRAY_SIZE(array),sizeof(array[0]),
  27. - (int (*)(const void *,const void *,void *)) verify_sun_cmp,
  28. - verify_sun_starts);
  29. + qsort(array,ARRAY_SIZE(array),sizeof(array[0]),
  30. + (int (*)(const void *,const void *)) verify_sun_cmp);
  31. if (array[0] == -1) {
  32. fdisk_info(cxt, _("No partitions defined."));