mirror of
https://github.com/tpoechtrager/osxcross.git
synced 2024-09-11 08:45:25 +03:00
use two space indents
This commit is contained in:
parent
84377413a5
commit
c0b2cf103d
@ -1,39 +1,43 @@
|
||||
/*
|
||||
* Copyright (C) 2012 by Thomas Poechtrager
|
||||
* t.poechtrager@gmail.com
|
||||
*
|
||||
* OSXCross is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* OSXCross is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/***********************************************************************
|
||||
* OSXCross *
|
||||
* Copyright (C) 2013, 2014 by Thomas Poechtrager *
|
||||
* t.poechtrager@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License *
|
||||
* as published by the Free Software Foundation; either version 2 *
|
||||
* of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., *
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||
***********************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#define WIN32
|
||||
#endif //__CYGWIN__
|
||||
#endif /* __CYGWIN__ */
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#endif //WIN32
|
||||
#endif /* WIN32 */
|
||||
|
||||
#ifdef __linux__
|
||||
#define __USE_GNU
|
||||
#include <sched.h>
|
||||
#undef __USE_GNU
|
||||
#endif //__linux__
|
||||
#endif /* __linux__ */
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || \
|
||||
defined(__OpenBSD__) || defined(__APPLE__)
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
@ -41,11 +45,10 @@
|
||||
|
||||
#ifndef HW_AVAILCPU
|
||||
#define HW_AVAILCPU 25
|
||||
#endif //HW_AVAILCPU
|
||||
#endif //BSD
|
||||
#endif /* HW_AVAILCPU */
|
||||
#endif /* BSD */
|
||||
|
||||
int getcpucount()
|
||||
{
|
||||
int getcpucount() {
|
||||
#ifdef WIN32
|
||||
SYSTEM_INFO sysinfo;
|
||||
GetSystemInfo(&sysinfo);
|
||||
@ -59,15 +62,15 @@ int getcpucount()
|
||||
CPU_ZERO(&cs);
|
||||
sched_getaffinity(0, sizeof(cs), &cs);
|
||||
|
||||
for(i = 0; i < 128; i++)
|
||||
{
|
||||
for (i = 0; i < 128; i++) {
|
||||
if (CPU_ISSET(i, &cs))
|
||||
cpucount++;
|
||||
}
|
||||
|
||||
return cpucount ? cpucount : 1;
|
||||
#else
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || \
|
||||
defined(__OpenBSD__) || defined(__APPLE__)
|
||||
int cpucount = 0;
|
||||
int mib[4];
|
||||
size_t len = sizeof(cpucount);
|
||||
@ -77,8 +80,7 @@ int getcpucount()
|
||||
|
||||
sysctl(mib, 2, &cpucount, &len, NULL, 0);
|
||||
|
||||
if(cpucount < 1)
|
||||
{
|
||||
if (cpucount < 1) {
|
||||
mib[1] = HW_NCPU;
|
||||
sysctl(mib, 2, &cpucount, &len, NULL, 0);
|
||||
}
|
||||
@ -87,13 +89,12 @@ int getcpucount()
|
||||
#else
|
||||
#warning unknown platform
|
||||
return 1;
|
||||
#endif //BSD
|
||||
#endif //__linux__
|
||||
#endif //WIN32
|
||||
#endif /* BSD */
|
||||
#endif /* __linux__ */
|
||||
#endif /* WIN32 */
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int main(void) {
|
||||
printf("%d\n", getcpucount());
|
||||
return 0;
|
||||
}
|
||||
|
2
tools/gen_sdk_package.sh
Normal file → Executable file
2
tools/gen_sdk_package.sh
Normal file → Executable file
@ -4,7 +4,7 @@
|
||||
# This script must be run on OS X
|
||||
#
|
||||
|
||||
if [ `uname -s` != "Darwin" ]; then
|
||||
if [ $(uname -s) != "Darwin" ]; then
|
||||
echo "This script must be run on OS X"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -27,4 +27,3 @@ function _exit()
|
||||
}
|
||||
|
||||
trap _exit EXIT
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user