[GRASS-dev] r.univar -e

Brad Douglas rez at touchofmadness.com
Wed Sep 6 02:59:05 EDT 2006


On Wed, 2006-09-06 at 17:08 +1200, Hamish wrote:
> Martin Landa wrote:
> > Hi all,
> > 
> > I have added '-e' flag to r.univar according to r.univar.sh. See the
> > attached patch. Please look at the code, any comments welcomed...
> > (before committing to CVS - if desired...).
> 
> Nice work!
> 
> I have merged your patch locally with a few minor changes:
>   http://bambi.otago.ac.nz/hamish/grass/r.univar_ext.c
>     or if you prefer,
>   http://bambi.otago.ac.nz/hamish/grass/r.univar_ext.diff

Great work guys!

> A few comments/questions before putting it in CVS:
> 
> * qsort() comparison functions are declared as static int. 
> a) shouldn't they just be int?

static is the best declaration.  Declaring the function static means it
is "bound" to that file.  As long as qsort() is called [only] from that
file, it will work as designed.

> b) could/should these fns be inlined for speed?

Not 100% sure.  I would assume that it is legal, but ignored.

> * GRASS 5's s.cellstats uses something called qisort() instead of
> qsort(), which claims to be faster. Comments from the crowd?
>  http://freegis.org/cgi-bin/viewcvs.cgi/grass/src/sites/s.cellstats/qisort.c?rev=HEAD&content-type=text/vnd.viewcvs-markup

It seems that there exists a number of replacements for specific
applications (the glibc qsort() is a one-stop-shop and not always
"efficient").

Here is another similar example:
http://www.corpit.ru/mjt/qsort.html

I'll defer to Glynn...


-- 
Brad Douglas <rez touchofmadness com>                      KB8UYR
Address: 37.493,-121.924 / WGS84    National Map Corps #TNMC-3785




More information about the grass-dev mailing list