src/cdrom/osf/SDL_syscdrom.c
changeset 1379 c0a74f199ecf
parent 1361 19418e4422cb
child 1402 d910939febfa
     1.1 --- a/src/cdrom/osf/SDL_syscdrom.c	Sun Feb 19 23:38:57 2006 +0000
     1.2 +++ b/src/cdrom/osf/SDL_syscdrom.c	Sun Feb 19 23:46:34 2006 +0000
     1.3 @@ -119,13 +119,11 @@
     1.4  
     1.5  	/* Add this drive to our list */
     1.6  	i = SDL_numcds;
     1.7 -	SDL_cdlist[i] = (char *)SDL_malloc(SDL_strlen(drive)+1);
     1.8 +	SDL_cdlist[i] = SDL_strdup(drive);
     1.9  	if ( SDL_cdlist[i] == NULL ) {
    1.10  	    SDL_OutOfMemory();
    1.11  	    return;
    1.12  	}
    1.13 -
    1.14 -	SDL_strcpy(SDL_cdlist[i], drive);
    1.15  	SDL_cdmode[i] = stbuf->st_rdev;
    1.16  	++SDL_numcds;
    1.17  #ifdef DEBUG_CDROM
    1.18 @@ -174,9 +172,10 @@
    1.19      SDLcdrom = SDL_getenv("SDL_CDROM");	/* ':' separated list of devices */
    1.20      if ( SDLcdrom != NULL ) {
    1.21  	char *cdpath, *delim;
    1.22 -	cdpath = SDL_malloc(SDL_strlen(SDLcdrom)+1);
    1.23 +	size_t len = SDL_strlen(SDLcdrom)+1;
    1.24 +	cdpath = SDL_stack_alloc(len);
    1.25  	if ( cdpath != NULL ) {
    1.26 -	    SDL_strcpy(cdpath, SDLcdrom);
    1.27 +	    SDL_strlcpy(cdpath, SDLcdrom, len);
    1.28  	    SDLcdrom = cdpath;
    1.29  	    do {
    1.30  		delim = SDL_strchr(SDLcdrom, ':');
    1.31 @@ -192,7 +191,7 @@
    1.32  		    SDLcdrom = NULL;
    1.33  		}
    1.34  	    } while ( SDLcdrom );
    1.35 -	    SDL_free(cdpath);
    1.36 +	    SDL_stack_free(cdpath);
    1.37  	}
    1.38  
    1.39  	/* If we found our drives, there's nothing left to do */
    1.40 @@ -226,15 +225,6 @@
    1.41  #endif
    1.42  	}
    1.43      }
    1.44 -
    1.45 -/*
    1.46 -    SDLcdrom=SDL_malloc(sizeof(char) * 32);
    1.47 -    SDL_strcpy(SDLcdrom,"/dev/rdisk/cdrom0c");
    1.48 -    SDL_cdlist[0] = SDLcdrom;
    1.49 -    stat(SDLcdrom, &stbuf);
    1.50 -    SDL_cdmode[0] = stbuf.st_rdev;
    1.51 -    SDL_numcds = 1;
    1.52 - */
    1.53      return (0);
    1.54  }
    1.55