Re: [Libvir] [PATCH] Enhance virBuffer code

2007-12-17 Thread Richard W.M. Jones
Daniel P. Berrange wrote: On Thu, Dec 13, 2007 at 06:27:18PM +, Richard W.M. Jones wrote: Richard W.M. Jones wrote: (eg. virBufferEscapeString [...] Erm, that should be 'cf' not 'eg'. The remote driver in CVS doesn't work with this patch applied - it just refuses the connection everytime

Re: [Libvir] [PATCH] Enhance virBuffer code

2007-12-17 Thread Daniel P. Berrange
On Mon, Dec 17, 2007 at 05:06:19PM +, Daniel P. Berrange wrote: > On Thu, Dec 13, 2007 at 06:27:18PM +, Richard W.M. Jones wrote: > > Richard W.M. Jones wrote: > > >(eg. virBufferEscapeString [...] > > > > Erm, that should be 'cf' not 'eg'. > > The remote driver in CVS doesn't work with t

Re: [Libvir] [PATCH] Enhance virBuffer code

2007-12-17 Thread Daniel P. Berrange
On Thu, Dec 13, 2007 at 06:27:18PM +, Richard W.M. Jones wrote: > Richard W.M. Jones wrote: > >(eg. virBufferEscapeString [...] > > Erm, that should be 'cf' not 'eg'. The remote driver in CVS doesn't work with this patch applied - it just refuses the connection everytime. It looks like a cond

Re: [Libvir] [PATCH] Enhance virBuffer code

2007-12-15 Thread Daniel Veillard
On Fri, Dec 14, 2007 at 11:53:35PM +0100, Jim Meyering wrote: > "Daniel P. Berrange" <[EMAIL PROTECTED]> wrote: > Personally, I don't care at all, but I suspect that people using z/OS > and OS/390 care, among others. Some might even be Red Hat customers. > What's wrong with making the code portabl

Re: [Libvir] [PATCH] Enhance virBuffer code

2007-12-14 Thread Daniel P. Berrange
On Fri, Dec 14, 2007 at 11:53:35PM +0100, Jim Meyering wrote: > "Daniel P. Berrange" <[EMAIL PROTECTED]> wrote: > > On Fri, Dec 14, 2007 at 08:34:13AM +0100, Jim Meyering wrote: > >> Daniel Veillard <[EMAIL PROTECTED]> wrote: > >> > On Thu, Dec 13, 2007 at 11:21:31PM +0100, Jim Meyering wrote: > >>

Re: [Libvir] [PATCH] Enhance virBuffer code

2007-12-14 Thread Jim Meyering
"Daniel P. Berrange" <[EMAIL PROTECTED]> wrote: > On Fri, Dec 14, 2007 at 08:34:13AM +0100, Jim Meyering wrote: >> Daniel Veillard <[EMAIL PROTECTED]> wrote: >> > On Thu, Dec 13, 2007 at 11:21:31PM +0100, Jim Meyering wrote: >> >> "Richard W.M. Jones" <[EMAIL PROTECTED]> wrote: >> >> ... >> >> > +

Re: [Libvir] [PATCH] Enhance virBuffer code

2007-12-14 Thread Daniel P. Berrange
On Fri, Dec 14, 2007 at 08:34:13AM +0100, Jim Meyering wrote: > Daniel Veillard <[EMAIL PROTECTED]> wrote: > > > On Thu, Dec 13, 2007 at 11:21:31PM +0100, Jim Meyering wrote: > >> "Richard W.M. Jones" <[EMAIL PROTECTED]> wrote: > >> ... > >> > + * virBufferURIEncodeString: > >> > + * @buf: the bu

Re: [Libvir] [PATCH] Enhance virBuffer code

2007-12-14 Thread Daniel Veillard
On Fri, Dec 14, 2007 at 08:22:24AM -0500, Daniel Veillard wrote: > On Fri, Dec 14, 2007 at 11:06:36AM +, Richard W.M. Jones wrote: > > OK, how about this? > > > > Rich. > > > > +for (p = str; *p; ++p) { > > +/* Want to escape only A-Z and 0-9. This may not work on > > EBCDIC. */

Re: [Libvir] [PATCH] Enhance virBuffer code

2007-12-14 Thread Richard Jones
Jim Meyering wrote: $ LC_ALL=vi_VN.tcvn ./k 1: 2: 4: 5: 6: 17: 18: 19: 20: 21: 22: 23: Surprise, surprise... So in this locale, using "isascii (*p) && isalnum (*p)" would *under*quote. I didn't expect to find such a convincing argument. I stand by my suggestion to use

Re: [Libvir] [PATCH] Enhance virBuffer code

2007-12-14 Thread Daniel Veillard
On Fri, Dec 14, 2007 at 02:17:31PM +0100, Jim Meyering wrote: > I stand by my suggestion to use the switch statement. I stand by the satus quo, with an EBCDIC comment if you really care Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualizat

Re: [Libvir] [PATCH] Enhance virBuffer code

2007-12-14 Thread Daniel Veillard
On Fri, Dec 14, 2007 at 11:06:36AM +, Richard W.M. Jones wrote: > OK, how about this? > > Rich. > > +for (p = str; *p; ++p) { > +/* Want to escape only A-Z and 0-9. This may not work on > EBCDIC. */ > +if (isascii (*p) && isalnum (*p)) > +grow_size++; > +

Re: [Libvir] [PATCH] Enhance virBuffer code

2007-12-14 Thread Jim Meyering
"Richard W.M. Jones" <[EMAIL PROTECTED]> wrote: > Jim Meyering wrote: >> "Richard W.M. Jones" <[EMAIL PROTECTED]> wrote: >> >>> Jim Meyering wrote: "Richard W.M. Jones" <[EMAIL PROTECTED]> wrote: > Jim Meyering wrote: >> What do you think of using this? >> >> isascii (*p) &&

Re: [Libvir] [PATCH] Enhance virBuffer code

2007-12-14 Thread Richard W.M. Jones
Jim Meyering wrote: "Richard W.M. Jones" <[EMAIL PROTECTED]> wrote: Jim Meyering wrote: "Richard W.M. Jones" <[EMAIL PROTECTED]> wrote: Jim Meyering wrote: What do you think of using this? isascii (*p) && isalnum (*p) I'm not sure I'm qualified to say what this does on EBCDIC, but quite

Re: [Libvir] [PATCH] Enhance virBuffer code

2007-12-14 Thread Jim Meyering
"Richard W.M. Jones" <[EMAIL PROTECTED]> wrote: > Jim Meyering wrote: >> "Richard W.M. Jones" <[EMAIL PROTECTED]> wrote: >>> Jim Meyering wrote: What do you think of using this? isascii (*p) && isalnum (*p) >>> I'm not sure I'm qualified to say what this does on EBCDIC, but quite

Re: [Libvir] [PATCH] Enhance virBuffer code

2007-12-14 Thread Richard W.M. Jones
Jim Meyering wrote: "Richard W.M. Jones" <[EMAIL PROTECTED]> wrote: Jim Meyering wrote: What do you think of using this? isascii (*p) && isalnum (*p) I'm not sure I'm qualified to say what this does on EBCDIC, but quite likely lots of other code breaks there too anyway. This is nicely self

Re: [Libvir] [PATCH] Enhance virBuffer code

2007-12-14 Thread Jim Meyering
"Richard W.M. Jones" <[EMAIL PROTECTED]> wrote: > Jim Meyering wrote: >> What do you think of using this? >> >> isascii (*p) && isalnum (*p) > > I'm not sure I'm qualified to say what this does on EBCDIC, but quite > likely lots of other code breaks there too anyway. This is nicely > self-docume

Re: [Libvir] [PATCH] Enhance virBuffer code

2007-12-14 Thread Daniel Veillard
On Fri, Dec 14, 2007 at 08:34:13AM +0100, Jim Meyering wrote: > You're right that we shouldn't use isalnum here. > However, we shouldn't use inequality comparisons, either. > While 0 <= c <= 9 is guaranteed to be ok for the digits, the > a..z and A..Z ranges need not be contiguous, i.e., with EBCDI

Re: [Libvir] [PATCH] Enhance virBuffer code

2007-12-14 Thread Richard W.M. Jones
Jim Meyering wrote: What do you think of using this? isascii (*p) && isalnum (*p) I'm not sure I'm qualified to say what this does on EBCDIC, but quite likely lots of other code breaks there too anyway. This is nicely self-documenting anyway. Rich. -- Emerging Technologies, Red Hat - h

Re: [Libvir] [PATCH] Enhance virBuffer code

2007-12-13 Thread Jim Meyering
Daniel Veillard <[EMAIL PROTECTED]> wrote: > On Thu, Dec 13, 2007 at 11:21:31PM +0100, Jim Meyering wrote: >> "Richard W.M. Jones" <[EMAIL PROTECTED]> wrote: >> ... >> > + * virBufferURIEncodeString: >> > + * @buf: the buffer to append to >> > + * @str: the string argument which will be URI-enco

Re: [Libvir] [PATCH] Enhance virBuffer code

2007-12-13 Thread Daniel Veillard
On Thu, Dec 13, 2007 at 11:21:31PM +0100, Jim Meyering wrote: > "Richard W.M. Jones" <[EMAIL PROTECTED]> wrote: > ... > > + * virBufferURIEncodeString: > > + * @buf: the buffer to append to > > + * @str: the string argument which will be URI-encoded > > + * > > + * Append the string to the buffer

Re: [Libvir] [PATCH] Enhance virBuffer code

2007-12-13 Thread Jim Meyering
"Richard W.M. Jones" <[EMAIL PROTECTED]> wrote: ... > + * virBufferURIEncodeString: > + * @buf: the buffer to append to > + * @str: the string argument which will be URI-encoded > + * > + * Append the string to the buffer. The string will be URI-encoded > + * during the append (ie any non alpha-

Re: [Libvir] [PATCH] Enhance virBuffer code

2007-12-13 Thread Richard W.M. Jones
Richard W.M. Jones wrote: (eg. virBufferEscapeString [...] Erm, that should be 'cf' not 'eg'. Rich. -- Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Regis

[Libvir] [PATCH] Enhance virBuffer code

2007-12-13 Thread Richard W.M. Jones
Apart from a couple of minor fixes, this adds the following useful functions to the virBuffer implementation: virBufferAddChar: Append a single character to the buffer. virBufferURIEncodeString: Append a %-encoded string to the buffer (eg. virBufferEscapeString and the similar function in libx