[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 09:43:54 +0900 |
User-agent: |
Mutt/1.5.9i |
On Tue, Jan 23, 2007 at 04:22:14PM -0800, Ben Pfaff wrote:
> 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.
Yes, that's a good idea.
However, I'd propose a slightly different syntax:
create_syntax_string_source ("EXPORT OUTFILE=%sq.",
de->file_name);
If you make the full specification %sq, then you can still get
GCC to check that a "char *" argument is present by telling it
that it's a printf-like function. There'd need to be a suffix
character for unquoted strings too, e.g. %su, but all in all the
slight inconvenience of using 2-character conversions is vastly
outweighed (in my opinion) by having compile-time checking.
> I remember coming across a sprintf like function which allows you to
> specify custom conversions, but I can't remember where I found it.
There's a variety of them, and glibc even includes one of its
own, but they're not hard to write yourself, especially if you
don't need the full generality of printf (and I doubt we do).
OK. So there's a number of issues to think about.
If you're agreeable, I'll commit this patch as is, and file a bug
about the quoting, so we can deal with it as a seperate issue.
J'
--
PGP Public key ID: 1024D/2DE827B3
fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3
See http://pgp.mit.edu or any PGP keyserver for public key.
signature.asc
Description: Digital signature
[patch #5704] Data New/Open/Save, John Darrington, 2007/01/24