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

Re: [libvirt] [PATCH] Introduce virStrncpy.



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


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