Changeset 2407cb in git


Ignore:
Timestamp:
May 31, 2013, 6:44:31 PM (11 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
33161fd92744b4c3b711de9f059b40511622d1c9
Parents:
8b368ff67a7ef888aa2e3b02b2f425f07dc87cc1
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2013-05-31 18:44:31+02:00
git-committer:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2014-05-07 04:41:44+02:00
Message:
Fix qsort usage due to MAC OS X

fix: non-standard qsort_r (_GNU_SOURCE) usage
File:
1 edited

Legend:

Unmodified
Added
Removed
  • dyn_modules/syzextra/mod_main.cc

    r8b368ff r2407cb  
    4949#include <stdlib.h>
    5050#include <string.h>
     51
     52
     53#ifdef _GNU_SOURCE
     54#define qsort_my(m, s, ss, r, cmp) qsort_r(m, s, ss, cmp, r)
     55#else
     56#define qsort_my(m, s, ss, r, cmp) qsort_r(m, s, ss, cmp)
     57#endif
     58
    5159
    5260
     
    522530
    523531
     532#ifdef _GNU_SOURCE
    524533static int cmp_c_ds(const void *p1, const void *p2, void *R)
    525534{
     535#else
     536static int cmp_c_ds(const void *p1, const void *p2)
     537{
     538  void *R = currRing;
     539#endif
     540
    526541  const int YES = 1;
    527542  const int NO = -1;
    528543
    529544  const ring r =  (const ring) R; // TODO/NOTE: the structure is known: C, lp!!!
     545
     546  assume( r == currRing );
    530547
    531548  const poly a = *(const poly*)p1;
     
    543560  // TODO: test this!!!!!!!!!!!!!!!!
    544561
    545   //return -( compare (c, ds) )
     562  //return -( compare (c, qsorts) )
    546563
    547564  const int __DEBUG__ = 0;
     
    753770
    754771    if( sizeNew >= 2 )
    755       qsort_r(newid->m, sizeNew, sizeof(poly), cmp_c_ds, r);
     772      qsort_my(newid->m, sizeNew, sizeof(poly), r, cmp_c_ds);
    756773
    757774    if (IDELEMS(newid) == 0 || (IDELEMS(newid) == 1 && newid->m[0] == NULL) )
     
    828845
    829846    if( size >= 2 )
    830       qsort_r(newid->m, size, sizeof(poly), cmp_c_ds, r);
     847      qsort_my(newid->m, size, sizeof(poly), r, cmp_c_ds);
    831848   
    832849//    res->data = newid;
     
    10351052
    10361053    if( sizeNew >= 2 )
    1037       qsort_r(newid->m, sizeNew, sizeof(poly), cmp_c_ds, r);
     1054      qsort_my(newid->m, sizeNew, sizeof(poly), r, cmp_c_ds);
    10381055
    10391056    if (IDELEMS(newid) == 0 || (IDELEMS(newid) == 1 && newid->m[0] == NULL) )
Note: See TracChangeset for help on using the changeset viewer.