src/thread/SDL_thread.c
changeset 1336 3692456e7b0f
parent 1330 450721ad5436
child 1338 604d73db6802
     1.1 --- a/src/thread/SDL_thread.c	Mon Feb 06 17:28:04 2006 +0000
     1.2 +++ b/src/thread/SDL_thread.c	Tue Feb 07 06:59:48 2006 +0000
     1.3 @@ -99,16 +99,16 @@
     1.4  			SDL_numthreads, SDL_maxthreads);
     1.5  #endif
     1.6  	if ( SDL_numthreads == SDL_maxthreads ) {
     1.7 -		threads=(SDL_Thread **)malloc((SDL_maxthreads+ARRAY_CHUNKSIZE)*
     1.8 +		threads=(SDL_Thread **)SDL_malloc((SDL_maxthreads+ARRAY_CHUNKSIZE)*
     1.9  		                              (sizeof *threads));
    1.10  		if ( threads == NULL ) {
    1.11  			SDL_OutOfMemory();
    1.12  			goto done;
    1.13  		}
    1.14 -		memcpy(threads, SDL_Threads, SDL_numthreads*(sizeof *threads));
    1.15 +		SDL_memcpy(threads, SDL_Threads, SDL_numthreads*(sizeof *threads));
    1.16  		SDL_maxthreads += ARRAY_CHUNKSIZE;
    1.17  		if ( SDL_Threads ) {
    1.18 -			free(SDL_Threads);
    1.19 +			SDL_free(SDL_Threads);
    1.20  		}
    1.21  		SDL_Threads = threads;
    1.22  	}
    1.23 @@ -136,7 +136,7 @@
    1.24  				}
    1.25  			} else {
    1.26  				SDL_maxthreads = 0;
    1.27 -				free(SDL_Threads);
    1.28 +				SDL_free(SDL_Threads);
    1.29  				SDL_Threads = NULL;
    1.30  			}
    1.31  #ifdef DEBUG_THREADS
    1.32 @@ -223,19 +223,19 @@
    1.33  	int ret;
    1.34  
    1.35  	/* Allocate memory for the thread info structure */
    1.36 -	thread = (SDL_Thread *)malloc(sizeof(*thread));
    1.37 +	thread = (SDL_Thread *)SDL_malloc(sizeof(*thread));
    1.38  	if ( thread == NULL ) {
    1.39  		SDL_OutOfMemory();
    1.40  		return(NULL);
    1.41  	}
    1.42 -	memset(thread, 0, (sizeof *thread));
    1.43 +	SDL_memset(thread, 0, (sizeof *thread));
    1.44  	thread->status = -1;
    1.45  
    1.46  	/* Set up the arguments for the thread */
    1.47 -	args = (thread_args *)malloc(sizeof(*args));
    1.48 +	args = (thread_args *)SDL_malloc(sizeof(*args));
    1.49  	if ( args == NULL ) {
    1.50  		SDL_OutOfMemory();
    1.51 -		free(thread);
    1.52 +		SDL_free(thread);
    1.53  		return(NULL);
    1.54  	}
    1.55  	args->func = fn;
    1.56 @@ -243,8 +243,8 @@
    1.57  	args->info = thread;
    1.58  	args->wait = SDL_CreateSemaphore(0);
    1.59  	if ( args->wait == NULL ) {
    1.60 -		free(thread);
    1.61 -		free(args);
    1.62 +		SDL_free(thread);
    1.63 +		SDL_free(args);
    1.64  		return(NULL);
    1.65  	}
    1.66  
    1.67 @@ -263,11 +263,11 @@
    1.68  	} else {
    1.69  		/* Oops, failed.  Gotta free everything */
    1.70  		SDL_DelThread(thread);
    1.71 -		free(thread);
    1.72 +		SDL_free(thread);
    1.73  		thread = NULL;
    1.74  	}
    1.75  	SDL_DestroySemaphore(args->wait);
    1.76 -	free(args);
    1.77 +	SDL_free(args);
    1.78  
    1.79  	/* Everything is running now */
    1.80  	return(thread);
    1.81 @@ -281,7 +281,7 @@
    1.82  			*status = thread->status;
    1.83  		}
    1.84  		SDL_DelThread(thread);
    1.85 -		free(thread);
    1.86 +		SDL_free(thread);
    1.87  	}
    1.88  }
    1.89