[Top][All Lists]

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

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

From: Ben Pfaff
Subject: Re: [patch #5704] Data New/Open/Save
Date: Tue, 23 Jan 2007 15:07:50 -0800
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

John Darrington <address@hidden> writes:

> On Tue, Jan 23, 2007 at 05:16:44PM +0000, Ben Pfaff wrote:
>      I'd suggest adding a function, analogous to the "quote" function in 
> gnulib,
>      that returns its argument as a quoted string in syntax format.  It could
>      return it in single quotes if it doesn't contain a single quote, in 
> double
>      quotes if it doesn't contain a double quote, or in single quotes with 
> doubled
>      single quotes otherwise.  If we don't do something like this, then we 
> end up
>      with little ticking time bombs of code like this:
>      +      sss = create_syntax_string_source ("EXPORT OUTFILE='%s'.",
>      +                                        de->file_name);
> Such a function however is not entirely trivial.  There's two problems
> that I can see:
> 1. How to make it robust and tolerant of multi-byte encodings.

Seems like only a minor problem in the face of the larger problems
with multi-byte encoding that we have yet to tackle (as far as I

> 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.)
"The road to hell is paved with convenient shortcuts."
--Peter da Silva

reply via email to

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