On 2009-09-05 16:39-0700 Alan W. Irwin wrote:

> The recommended method of saving and restoring locale is the following (see
> http://developers.sun.com/dev/gadc/educationtutorial/creference/locale/locale.html):

> [...]If I use the above idea in a simple test programme it works.  However,
> valgrind reports invalid read errors for that final setlocale command so the
> Linux implementation is problematic and at minimum will add a lot of
> unacceptable noise to every single one of our valgrind reports.

Finally figured this out this morning.  The suggestion in the above URL was
oversimplified since subsequent setlocale commands were messing with the
string pointed to by setlocale(LC_NUMERIC, NULL).  If you immediately copy
that string instead, and use the copied string to restore locale later on,
the result on Linux always works (no garbarge in string) and is valgrind
clean both for my test programme and a similar test in my local version of
cmap0_palette_read.  So finally, I think I am on the right track for the
correct way to save and restore locale.  There are some more implementation
details to do, but it should not be too long after the release today before
I can commit this, and get it tested on all our platforms.

> Maurice (or somebody else here who understands the plLibOpen logic): could
> you review the plLibOpen logic and confirm it is correct to close a file
> opened that way with fclose?  The plLibOpen logic has been sitting around
> as part of PLplot for ages, but it appears cmap0_palette_read and
> plspal1 are our first attempts to ever use that logic which is why it
> needs review by an expert (ideally before the release on Sunday).

The result is now valgrind clean (no errors, no leaks possible) and seems to
work so I think using fclose to close the file opened by plLibOpen is
probably OK.  Neverthess, a code review would be worthwhile just to make
sure all is well since this is the first time (for a long while at least)
that plLibOpen has actually been used from within PLplot.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to