Re: [libvirt] [PATCH] Introduce virStrncpy.

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

 



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 the latter, but
I found it convenient when converting a number of these locations)

I could make virStrcpy a small function, though.

Yes, that would be quite nice. It would remove the multiple-evaluation problem from virStrcpyStatic too.

In the followup I'd also like to have macro arguments parenthesized:

#define virStrcpyStatic(dest, src) \
  virStrcpy((dest), (src), sizeof(dest))

I don't remember off the top of my head the case in which that would be a problem (since these are just function arguments), but I'm sure Jim Meyering could enlighten us. ;-)

Paolo

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]