comparison src/video/x11/SDL_x11image.c @ 1402:d910939febfa

Use consistent identifiers for the various platforms we support. Make sure every source file includes SDL_config.h, so the proper system headers are chosen.
author Sam Lantinga <slouken@libsdl.org>
date Tue, 21 Feb 2006 08:46:50 +0000
parents 19418e4422cb
children 3ba88cb7eb1b
comparison
equal deleted inserted replaced
1401:1819fd069e89 1402:d910939febfa
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 18
19 Sam Lantinga 19 Sam Lantinga
20 slouken@libsdl.org 20 slouken@libsdl.org
21 */ 21 */
22 #include "SDL_config.h"
22 23
23 #include <stdio.h> 24 #include <stdio.h>
24 #include <unistd.h> 25 #include <unistd.h>
25 26
26 #include "SDL_endian.h" 27 #include "SDL_endian.h"
146 static int num_CPU(void) 147 static int num_CPU(void)
147 { 148 {
148 static int num_cpus = 0; 149 static int num_cpus = 0;
149 150
150 if(!num_cpus) { 151 if(!num_cpus) {
151 #if defined(__linux) 152 #if defined(__LINUX__)
152 char line[BUFSIZ]; 153 char line[BUFSIZ];
153 FILE *pstat = fopen("/proc/stat", "r"); 154 FILE *pstat = fopen("/proc/stat", "r");
154 if ( pstat ) { 155 if ( pstat ) {
155 while ( fgets(line, sizeof(line), pstat) ) { 156 while ( fgets(line, sizeof(line), pstat) ) {
156 if (SDL_memcmp(line, "cpu", 3) == 0 && line[3] != ' ') { 157 if (SDL_memcmp(line, "cpu", 3) == 0 && line[3] != ' ') {
157 ++num_cpus; 158 ++num_cpus;
158 } 159 }
159 } 160 }
160 fclose(pstat); 161 fclose(pstat);
161 } 162 }
162 #elif defined(__sgi) 163 #elif defined(__IRIX__)
163 num_cpus = sysconf(_SC_NPROC_ONLN); 164 num_cpus = sysconf(_SC_NPROC_ONLN);
164 #elif defined(_SC_NPROCESSORS_ONLN) 165 #elif defined(_SC_NPROCESSORS_ONLN)
165 /* number of processors online (SVR4.0MP compliant machines) */ 166 /* number of processors online (SVR4.0MP compliant machines) */
166 num_cpus = sysconf(_SC_NPROCESSORS_ONLN); 167 num_cpus = sysconf(_SC_NPROCESSORS_ONLN);
167 #elif defined(_SC_NPROCESSORS_CONF) 168 #elif defined(_SC_NPROCESSORS_CONF)