Re: [libvirt] [PATCH] Introduce virStrncpy.

2009-09-22 Thread Chris Lalancette
Paolo Bonzini wrote: >> Unfortunately that's not possible in the case of virStrcpyStatic(). Because >> virStrcpyStatic() does a sizeof(dest), you have to have the original char >> foo[123], not a char *, to get something meaningful. That means that it has >> to >> either be a macro or not exist

Re: [libvirt] [PATCH] Introduce virStrncpy.

2009-09-22 Thread Paolo Bonzini
Unfortunately that's not possible in the case of virStrcpyStatic(). Because virStrcpyStatic() does a sizeof(dest), you have to have the original char foo[123], not a char *, to get something meaningful. That means that it has to either be a macro or not exist at all. (I could be convinced of th

Re: [libvirt] [PATCH] Introduce virStrncpy.

2009-09-22 Thread Daniel Veillard
On Tue, Sep 22, 2009 at 04:16:51PM +0200, Chris Lalancette wrote: > Daniel Veillard wrote: > > On Tue, Sep 22, 2009 at 02:23:26PM +0200, Chris Lalancette wrote: > >> Add the virStrncpy function, which takes a dst string, source string, > >> the number of bytes to copy and the number of bytes availa

Re: [libvirt] [PATCH] Introduce virStrncpy.

2009-09-22 Thread Chris Lalancette
Daniel Veillard wrote: > On Tue, Sep 22, 2009 at 02:23:26PM +0200, Chris Lalancette wrote: >> Add the virStrncpy function, which takes a dst string, source string, >> the number of bytes to copy and the number of bytes available in the >> dest string. If the source string is too large to fit into

Re: [libvirt] [PATCH] Introduce virStrncpy.

2009-09-22 Thread Daniel Veillard
On Tue, Sep 22, 2009 at 02:23:26PM +0200, Chris Lalancette wrote: > Add the virStrncpy function, which takes a dst string, source string, > the number of bytes to copy and the number of bytes available in the > dest string. If the source string is too large to fit into the > destination string, in

[libvirt] [PATCH] Introduce virStrncpy.

2009-09-22 Thread Chris Lalancette
Add the virStrncpy function, which takes a dst string, source string, the number of bytes to copy and the number of bytes available in the dest string. If the source string is too large to fit into the destination string, including the \0 byte, then no data is copied and the function returns NULL.

Re: [libvirt] [PATCH] Introduce virStrncpy.

2009-08-31 Thread Chris Lalancette
Matthias Bolte wrote: >> diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c >> index 0225e9a..24c4422 100644 >> --- a/src/esx/esx_driver.c >> +++ b/src/esx/esx_driver.c >> @@ -694,9 +694,12 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr >> nodeinfo) >> ++ptr; >>

Re: [libvirt] [PATCH] Introduce virStrncpy.

2009-08-29 Thread Matthias Bolte
2009/8/28 Chris Lalancette : > Add the virStrncpy function, which takes a dst string, source string, > the number of bytes to copy and the number of bytes available in the > dest string.  If the source string is too large to fit into the > destination string, including the \0 byte, then no data is

Re: [libvirt] [PATCH] Introduce virStrncpy.

2009-08-28 Thread Paolo Bonzini
+ - virStrcpy(char *dest, const char *src, size_t destbytes) + Use this variant if you know you want to copy the entire src string + into dest. This is equivalent to + virStrncpy(dest, src, strlen(src), destbytes) + + - virStrcpyStatic(char *dest, const char *src) + Use this

[libvirt] [PATCH] Introduce virStrncpy.

2009-08-28 Thread Chris Lalancette
Add the virStrncpy function, which takes a dst string, source string, the number of bytes to copy and the number of bytes available in the dest string. If the source string is too large to fit into the destination string, including the \0 byte, then no data is copied and the function returns NULL.