diff src/thread/linux/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 c9b51268668f
children 604d73db6802
line wrap: on
line diff
--- a/src/thread/linux/SDL_syssem.c	Mon Feb 06 17:28:04 2006 +0000
+++ b/src/thread/linux/SDL_syssem.c	Tue Feb 07 06:59:48 2006 +0000
@@ -68,7 +68,7 @@
 /* Create a semaphore, initialized with value */
 SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
 {
-	SDL_sem *sem = (SDL_sem *) malloc(sizeof(SDL_sem));
+	SDL_sem *sem = (SDL_sem *) SDL_malloc(sizeof(SDL_sem));
 	if ( sem ) {
 #ifdef USE_NAMED_SEMAPHORES
 		static int semnum = 0;
@@ -78,7 +78,7 @@
 		sem->sem = sem_open(name, O_CREAT, 0600, initial_value);
 		if ( sem->sem == (sem_t *)SEM_FAILED ) {
 			SDL_SetError("sem_open(%s) failed", name);
-			free(sem);
+			SDL_free(sem);
 			sem = NULL;
 		} else {
 			sem_unlink(name);
@@ -86,7 +86,7 @@
 #else
 		if ( sem_init(&sem->sem_data, 0, initial_value) < 0 ) {
 			SDL_SetError("sem_init() failed");
-			free(sem);
+			SDL_free(sem);
 			sem = NULL;
 		} else {
 			sem->sem = &sem->sem_data;
@@ -106,7 +106,7 @@
 #else
 		sem_destroy(sem->sem);
 #endif
-		free(sem);
+		SDL_free(sem);
 	}
 }
 
@@ -245,7 +245,7 @@
 	union semun init;
 	key_t key;
 
-	sem = (SDL_sem *)malloc(sizeof(*sem));
+	sem = (SDL_sem *)SDL_malloc(sizeof(*sem));
 	if ( sem == NULL ) {
 		SDL_OutOfMemory();
 		return(NULL);
@@ -269,7 +269,7 @@
 	/* Report the error if we eventually failed */
 	if ( sem->id < 0 ) {
 		SDL_SetError("Couldn't create semaphore");
-		free(sem);
+		SDL_free(sem);
 		return(NULL);
 	}
 	init.val = initial_value;	/* Initialize semaphore */
@@ -287,7 +287,7 @@
 		dummy.val = 0;
 		semctl(sem->id, 0, IPC_RMID, dummy);
 #endif
-		free(sem);
+		SDL_free(sem);
 	}
 }