music_cmd.c
changeset 561 87bdb4c81c0b
parent 518 8bc9b5fd2aae
child 573 23d69b6621d0
equal deleted inserted replaced
560:0fc8dffb86c5 561:87bdb4c81c0b
    46 MusicCMD *MusicCMD_LoadSong(const char *cmd, const char *file)
    46 MusicCMD *MusicCMD_LoadSong(const char *cmd, const char *file)
    47 {
    47 {
    48 	MusicCMD *music;
    48 	MusicCMD *music;
    49 
    49 
    50 	/* Allocate and fill the music structure */
    50 	/* Allocate and fill the music structure */
    51 	music = (MusicCMD *)malloc(sizeof *music);
    51 	music = (MusicCMD *)SDL_malloc(sizeof *music);
    52 	if ( music == NULL ) {
    52 	if ( music == NULL ) {
    53 		Mix_SetError("Out of memory");
    53 		Mix_SetError("Out of memory");
    54 		return(NULL);
    54 		return(NULL);
    55 	}
    55 	}
    56 	strncpy(music->file, file, (sizeof music->file)-1);
    56 	strncpy(music->file, file, (sizeof music->file)-1);
   121 	/* Parse the command line */
   121 	/* Parse the command line */
   122 	argc = ParseCommandLine(command, NULL);
   122 	argc = ParseCommandLine(command, NULL);
   123 	if ( last_arg ) {
   123 	if ( last_arg ) {
   124 		++argc;
   124 		++argc;
   125 	}
   125 	}
   126 	argv = (char **)malloc((argc+1)*(sizeof *argv));
   126 	argv = (char **)SDL_malloc((argc+1)*(sizeof *argv));
   127 	if ( argv == NULL ) {
   127 	if ( argv == NULL ) {
   128 		return(NULL);
   128 		return(NULL);
   129 	}
   129 	}
   130 	argc = ParseCommandLine(command, argv);
   130 	argc = ParseCommandLine(command, argv);
   131 
   131 
   217 }
   217 }
   218 
   218 
   219 /* Close the given music stream */
   219 /* Close the given music stream */
   220 void MusicCMD_FreeSong(MusicCMD *music)
   220 void MusicCMD_FreeSong(MusicCMD *music)
   221 {
   221 {
   222 	free(music);
   222 	SDL_free(music);
   223 }
   223 }
   224 
   224 
   225 /* Return non-zero if a stream is currently playing */
   225 /* Return non-zero if a stream is currently playing */
   226 int MusicCMD_Active(MusicCMD *music)
   226 int MusicCMD_Active(MusicCMD *music)
   227 {
   227 {