[libvirt] [PATCH] Renamed internal __mon_yday into __vir_mon_yday to avoid conflicts

2014-09-18 Thread Cédric Bosdonnat
libc has another constant with the same name, which leads to
redefinition error when building against static libvirt
---
 src/util/virtime.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/virtime.c b/src/util/virtime.c
index acbec41..7b3ec44 100644
--- a/src/util/virtime.c
+++ b/src/util/virtime.c
@@ -105,7 +105,7 @@ int virTimeFieldsNowRaw(struct tm *fields)
 #define DIV(a, b) ((a) / (b) - ((a) % (b) < 0))
 #define LEAPS_THRU_END_OF(y) (DIV (y, 4) - DIV (y, 100) + DIV (y, 400))
 
-const unsigned short int __mon_yday[2][13] = {
+const unsigned short int __vir_mon_yday[2][13] = {
 /* Normal years.  */
 { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
 /* Leap years.  */
@@ -160,7 +160,7 @@ void virTimeFieldsThen(unsigned long long when, struct tm 
*fields)
 fields->tm_year = y - 1900;
 
 fields->tm_yday = days;
-ip = __mon_yday[is_leap_year(y)];
+ip = __vir_mon_yday[is_leap_year(y)];
 for (y = 11; days < (long int) ip[y]; --y)
 continue;
 days -= ip[y];
-- 
1.8.4.5

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


Re: [libvirt] [PATCH] Renamed internal __mon_yday into __vir_mon_yday to avoid conflicts

2014-09-18 Thread Eric Blake
On 09/18/2014 03:24 PM, Cédric Bosdonnat wrote:
> libc has another constant with the same name, which leads to
> redefinition error when building against static libvirt
> ---
>  src/util/virtime.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/util/virtime.c b/src/util/virtime.c
> index acbec41..7b3ec44 100644
> --- a/src/util/virtime.c
> +++ b/src/util/virtime.c
> @@ -105,7 +105,7 @@ int virTimeFieldsNowRaw(struct tm *fields)
>  #define DIV(a, b) ((a) / (b) - ((a) % (b) < 0))
>  #define LEAPS_THRU_END_OF(y) (DIV (y, 4) - DIV (y, 100) + DIV (y, 400))
>  
> -const unsigned short int __mon_yday[2][13] = {
> +const unsigned short int __vir_mon_yday[2][13] = {

We really should stay out of the __ namespace.  Can you use a more
typical name like 'mon_yday'?  Also, can you mark it as static? Glibc
has it exported for sharing between multiple files, but we aren't doing
that.

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] Renamed internal __mon_yday into __vir_mon_yday to avoid conflicts

2014-10-28 Thread Cedric Bosdonnat
On Thu, 2014-09-18 at 16:38 -0600, Eric Blake wrote:
> On 09/18/2014 03:24 PM, Cédric Bosdonnat wrote:
> > libc has another constant with the same name, which leads to
> > redefinition error when building against static libvirt
> > ---
> >  src/util/virtime.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/src/util/virtime.c b/src/util/virtime.c
> > index acbec41..7b3ec44 100644
> > --- a/src/util/virtime.c
> > +++ b/src/util/virtime.c
> > @@ -105,7 +105,7 @@ int virTimeFieldsNowRaw(struct tm *fields)
> >  #define DIV(a, b) ((a) / (b) - ((a) % (b) < 0))
> >  #define LEAPS_THRU_END_OF(y) (DIV (y, 4) - DIV (y, 100) + DIV (y, 400))
> >  
> > -const unsigned short int __mon_yday[2][13] = {
> > +const unsigned short int __vir_mon_yday[2][13] = {
> 
> We really should stay out of the __ namespace.  Can you use a more
> typical name like 'mon_yday'?  Also, can you mark it as static? Glibc
> has it exported for sharing between multiple files, but we aren't doing
> that.

Pushed with the changes you mentioned... forgot it locally.

--
Cedric

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