[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [patch #5704] Data New/Open/Save

From: John Darrington
Subject: Re: [patch #5704] Data New/Open/Save
Date: Wed, 24 Jan 2007 08:24:44 +0900
User-agent: Mutt/1.5.9i

On Tue, Jan 23, 2007 at 03:07:50PM -0800, Ben Pfaff wrote:
     >      +      sss = create_syntax_string_source ("EXPORT OUTFILE='%s'.",
     >      +                                        de->file_name);
     > 2. Either it must allocate heap space for its return value, in which
     >    case the caller must free it, or it can use a static buffer, which
     >    causes other problems.
     This is why I was suggesting to use the approach of the gnulib
     "quote" function (which see), which seems to be fairly
     successful.  Otherwise, yes, it's not a great situation.  (Pools
     might help, but they won't entirely erase the pain.)

I had a brief look at the gnulib function.  Essentially, it seems to
address this problem merely by allowing the caller to nominate a
particular static buffer to use, which (like you say) affords some
flexibility, but doesn't really solve the problem.

I was thinking that an alternative approach would be to implement a
special conversion specification within the
create_syntax_string_source function.  Then we could simply write
something like:

 create_syntax_string_source ("EXPORT OUTFILE=%q.", de->file_name);

This way, there's no need for the caller to worry about buffers or
dealloction at all.

I remember coming across a sprintf like function  which allows you to
specify custom conversions, but I can't remember where I found it.


PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See or any PGP keyserver for public key.

Attachment: signature.asc
Description: Digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]