This task is a follow-on to http://www.google-melange.com/gci/task/view/google/gci2013/5876128501727232
We call qsort() in about 40 places throughout BRL-CAD. You can run this to find most of them:
grep -r 'qsort(' src/* | grep -v other | grep -v svn
We have a new function in our LIBBU portable utility library, bu_sort(), that provides functionality nearly identical to qsort_s() on Windows or qsort_r() on Linux. The difference between sort() and those functions is that you have to put data into global variables with sort() but you pass data as an argument with the others.
This task involves updating five or more instances of qsort (you must at least update all occurrences in a given file) to bu_sort.
Basically, you'll take any parameter that was being accessed as a global and pass it as an argument. If the variable can be moved from global into a local scope during the transition, even better, but the important step is to update the callback function to take an additional parameter and to access data through that parameter, not via the global. If multiple globals are accessed, you'll need to create a struct that combines them together.
Submit your work as a patch file.
There are multiple tasks like this one in order to see all occurrences get fixed. If you run into any qsort() call that takes more than an hour to convert, for whatever reason, let us know.
File name/URL | File size | Date submitted | |
---|---|---|---|
bu_sort-no8.patch | 3.6 KB | December 21 2013 02:16 UTC |
I would like to work on this task.
This task has been assigned to agkphysics. You have 72 hours to complete this task, good luck!
The work on this task is ready to be reviewed.
One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.
Clicked the wrong button, please resubmit Aaron. This looked good to me.
The work on this task is ready to be reviewed.
Congratulations, this task has been completed successfully.
Be carefull, when committing this patch, because, as far as I saw on a quick glance, most of this work has already been done (and comitted) here: http://www.google-melange.com/gci/task/view/google/gci2013/5138768247914496 , so you maybe have to split up the patch.