Yes.  The purpose of this call was for scm so that the returned string wouldn't 
be leaked.  If swig could wrap a call and free the result, that would be an 
even better solution.

API have caller supply the data?  If swig could generate a wrapper that would 
do that, great.

1000 limit?  Seemed to be enough at the time.

Phil




________________________________
From: Derek Atkins <[email protected]>
To: [email protected]
Sent: Tuesday, September 8, 2009 10:03:44 AM
Subject: Re: r18295 - gnucash/trunk/src - Fix more valgrind problems

Phil,

Phil Longstaff <[email protected]> writes:

[snip]

> +/**
> + * Returns the account full name.  Unlike xaccAccountGetFullName(), the
> + * string returned must *NOT* be freed.
> + *
> + * @param account Account
> + * @return Account full name
> + */

Moreover this function is no longer thread-safe at all, as it uses
static data.  So you must be sure to copy out the results before anyone
else calls it.

Any reason not to change the API to have the caller supply the data?
Why the arbitrary 1000 char limit?

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
      [email protected]                        PGP key available
_______________________________________________
gnucash-devel mailing list
[email protected]
https://lists.gnucash.org/mailman/listinfo/gnucash-devel
_______________________________________________
gnucash-devel mailing list
[email protected]
https://lists.gnucash.org/mailman/listinfo/gnucash-devel

Reply via email to