src/stdlib/SDL_getenv.c
changeset 1336 3692456e7b0f
parent 1331 1cbaeee565b1
child 1341 d02b552e5304
     1.1 --- a/src/stdlib/SDL_getenv.c	Mon Feb 06 17:28:04 2006 +0000
     1.2 +++ b/src/stdlib/SDL_getenv.c	Tue Feb 07 06:59:48 2006 +0000
     1.3 @@ -42,20 +42,20 @@
     1.4  	char *value;
     1.5  	const char *sep;
     1.6  
     1.7 -	sep = strchr(variable, '=');
     1.8 +	sep = SDL_strchr(variable, '=');
     1.9  	if ( sep == NULL ) {
    1.10  		return -1;
    1.11  	}
    1.12 -	bufferlen = strlen(variable)+1;
    1.13 +	bufferlen = SDL_strlen(variable)+1;
    1.14  	if ( bufferlen > SDL_envmemlen ) {
    1.15 -		char *newmem = (char *)realloc(SDL_envmem, bufferlen);
    1.16 +		char *newmem = (char *)SDL_realloc(SDL_envmem, bufferlen);
    1.17  		if ( newmem == NULL ) {
    1.18  			return -1;
    1.19  		}
    1.20  		SDL_envmem = newmem;
    1.21  		SDL_envmemlen = bufferlen;
    1.22  	}
    1.23 -	strcpy(SDL_envmem, variable);
    1.24 +	SDL_strcpy(SDL_envmem, variable);
    1.25  	value = SDL_envmem + (sep - variable);
    1.26  	*value++ = '\0';
    1.27  	if ( !SetEnvironmentVariable(SDL_envmem, *value ? value : NULL) ) {
    1.28 @@ -74,7 +74,7 @@
    1.29  		return NULL;
    1.30  	}
    1.31  	if ( bufferlen > SDL_envmemlen ) {
    1.32 -		char *newmem = (char *)realloc(SDL_envmem, bufferlen);
    1.33 +		char *newmem = (char *)SDL_realloc(SDL_envmem, bufferlen);
    1.34  		if ( newmem == NULL ) {
    1.35  			return NULL;
    1.36  		}
    1.37 @@ -140,7 +140,7 @@
    1.38  
    1.39  	/* Didn't find it in the environment, expand and add */
    1.40  	if ( ! added ) {
    1.41 -		new_env = realloc(SDL_env, (i+2)*sizeof(char *));
    1.42 +		new_env = SDL_realloc(SDL_env, (i+2)*sizeof(char *));
    1.43  		if ( new_env ) {
    1.44  			SDL_env = new_env;
    1.45  			SDL_env[i++] = new_variable;