Mercurial > sdl-ios-xcode
comparison src/thread/win32/SDL_syssem.c @ 1336:3692456e7b0f
Use SDL_ prefixed versions of C library functions.
FIXME:
Change #include <stdlib.h> to #include "SDL_stdlib.h"
Change #include <string.h> to #include "SDL_string.h"
Make sure nothing else broke because of this...
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 07 Feb 2006 06:59:48 +0000 |
parents | 450721ad5436 |
children | 604d73db6802 |
comparison
equal
deleted
inserted
replaced
1335:c39265384763 | 1336:3692456e7b0f |
---|---|
46 SDL_sem *SDL_CreateSemaphore(Uint32 initial_value) | 46 SDL_sem *SDL_CreateSemaphore(Uint32 initial_value) |
47 { | 47 { |
48 SDL_sem *sem; | 48 SDL_sem *sem; |
49 | 49 |
50 /* Allocate sem memory */ | 50 /* Allocate sem memory */ |
51 sem = (SDL_sem *)malloc(sizeof(*sem)); | 51 sem = (SDL_sem *)SDL_malloc(sizeof(*sem)); |
52 if ( sem ) { | 52 if ( sem ) { |
53 /* Create the semaphore, with max value 32K */ | 53 /* Create the semaphore, with max value 32K */ |
54 #if defined(_WIN32_WCE) && (_WIN32_WCE < 300) | 54 #if defined(_WIN32_WCE) && (_WIN32_WCE < 300) |
55 sem->id = CreateSemaphoreCE(NULL, initial_value, 32*1024, NULL); | 55 sem->id = CreateSemaphoreCE(NULL, initial_value, 32*1024, NULL); |
56 #else | 56 #else |
57 sem->id = CreateSemaphore(NULL, initial_value, 32*1024, NULL); | 57 sem->id = CreateSemaphore(NULL, initial_value, 32*1024, NULL); |
58 #endif | 58 #endif |
59 sem->count = initial_value; | 59 sem->count = initial_value; |
60 if ( ! sem->id ) { | 60 if ( ! sem->id ) { |
61 SDL_SetError("Couldn't create semaphore"); | 61 SDL_SetError("Couldn't create semaphore"); |
62 free(sem); | 62 SDL_free(sem); |
63 sem = NULL; | 63 sem = NULL; |
64 } | 64 } |
65 } else { | 65 } else { |
66 SDL_OutOfMemory(); | 66 SDL_OutOfMemory(); |
67 } | 67 } |
78 #else | 78 #else |
79 CloseHandle(sem->id); | 79 CloseHandle(sem->id); |
80 #endif | 80 #endif |
81 sem->id = 0; | 81 sem->id = 0; |
82 } | 82 } |
83 free(sem); | 83 SDL_free(sem); |
84 } | 84 } |
85 } | 85 } |
86 | 86 |
87 int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout) | 87 int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout) |
88 { | 88 { |