[x264-devel] [PATCH] add support for FreeBSD in common/cpu.c

Igor Mozolevsky igor at hybrid-lab.co.uk
Fri Jan 4 04:20:48 CET 2008


On 03/01/2008, Guillaume POIRIER <poirierg at gmail.com> wrote:
> Hello,
>
> On Dec 30, 2007 10:59 PM, Igor Mozolevsky <igor at hybrid-lab.co.uk> wrote:
> > --- common/cpu.c.orig   2007-12-30 21:40:50.000000000 +0000
> > +++ common/cpu.c        2007-12-30 21:44:20.000000000 +0000
> > @@ -28,7 +28,7 @@
> >  #ifdef SYS_BEOS
> >  #include <kernel/OS.h>
> >  #endif
> > -#ifdef SYS_MACOSX
> > +#if defined(SYS_MACOSX) || defined(__FreeBSD__)
>
> __FreeBSD__ is not defined by the configure script, which may harm
> cross-compiling, or using compilers different from GCC.
> The right way to do it, I believe, is to use SYS_FREEBSD instead.
>
> Please try attached patch, which is more correct IMHO.

Fair point, I prefer to fix the real problem and let people in the
know figure the fix into the whole system, otherwise it takes way too
much time.

>
> > -    if( sysctlbyname("hw.ncpu", &numberOfCPUs, &length, NULL, 0) )
> > -    {
> > -        numberOfCPUs = 1;
> > -    }
> > -    return numberOfCPUs;
> > +    return sysctlbyname("hw.ncpu", &numberOfCPUs, &length, NULL, 0)
> > != 0 ? 1 : numberOfCPUs;
>
> I prefer to split functionnal changes in independent patches. I left
> out that "cosmetic" part.

We all have our coding styles :-p


Igor
--
Never ascribe to malice that which is adequately explained by incompetence
   -- Napoleon Bonaparte



More information about the x264-devel mailing list