|
Re: [patch #5704] Data New/Open/Save: msg#00059statistics.pspp.devel
John Darrington <john@xxxxxxxxxxxxxxx> 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 know). > 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 |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: [patch #5704] Data New/Open/Save: 00059, John Darrington |
|---|---|
| Next by Date: | Re: [patch #5704] Data New/Open/Save: 00059, John Darrington |
| Previous by Thread: | Re: [patch #5704] Data New/Open/Savei: 00059, John Darrington |
| Next by Thread: | Re: [patch #5704] Data New/Open/Save: 00059, John Darrington |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |