I'm content to be voted down on this, but a performance argument is a stretch: how can one possibly fit enough legend text on a graph to cause a CPU any stress at all? The first real use I made of PLplot was to plot 500,000 sample time series; copying a few hundred bytes (max) of text will not make a bit of difference by comparison.
From: David MacMahon [davidm@...]
Sent: Wednesday, October 06, 2010 12:59 AM
To: Alan W. Irwin
Cc: Schwab,Wilhelm K; Plplot-devel@...
Subject: Re: [Plplot-devel] Legends
On Oct 5, 2010, at 21:42 , Alan W. Irwin wrote:
> On 2010-10-05 22:19-0400 Schwab,Wilhelm K wrote:
>> I was interested in building it (5.9.7) to try the legend code.
>> Is there a reason for the double pointer? It seems that
>> this part\0that part\0...\0and the last part\0\0
>> would do the job just as easily??
> I am willing to keep an open mind about changing the
> present approach if we run into trouble interfacing const char **
> text to
> other languages.
FWIW, I vote for keeping it as char**. For the smallish amounts of
legend text it probably doesn't matter that much either way, but with
more and/or larger strings that might come from different locations,
the cost of copying into one buffer can become significant. Creating
an array of char* and populating with pointers into a long buffer
containing back-to-back strings is not nearly so onerous (presuming
you know how many strings you have to begin with so you can allocate
a big enough char* array).
Does the library strdup the passed in strings, render them before
returning, or just copy the pointers for later rendering?
Dave (who has obviously not examined the legend implementation!)