Skip to content

Commit

Permalink
modifying the psort __attribute(weak) to have this behavior on APPLE …
Browse files Browse the repository at this point in the history
…only ... no psort on Linux, and CYGWIN crash
  • Loading branch information
laurentnoe committed Mar 6, 2015
1 parent 6668af6 commit d3a0c78
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions reads_data.c
Expand Up @@ -49,23 +49,20 @@ static int sort_reads_fun(const void *a, const void *b) {
return 0;
}


void psort() __attribute__((weak));
#if defined(__APPLE__) && defined (__MACH__)
void psort() __attribute__ ((weak));
#endif

/**
* Sort a read database (alphanumeric order)
*/
int sort_reads_db(ReadsDBType * db) {
#if defined(__APPLE__) && defined (__MACH__)
if (psort)
psort((void *)db->reads/*base*/,
(size_t)db->size /*nel*/,
(size_t)(sizeof(ReadDataType))/*width*/,
sort_reads_fun/*int (*compar)(const void *, const void *)*/);
psort((void *) db->reads, (size_t) db->size, (size_t) sizeof(ReadDataType), sort_reads_fun);
else
qsort((void *)db->reads/*base*/,
(size_t)db->size /*nel*/,
(size_t)(sizeof(ReadDataType))/*width*/,
sort_reads_fun/*int (*compar)(const void *, const void *)*/);
#endif
qsort((void *) db->reads, (size_t) db->size, (size_t) sizeof(ReadDataType), sort_reads_fun);
return 0;
}

Expand Down

0 comments on commit d3a0c78

Please sign in to comment.