diff src/cdrom/aix/SDL_syscdrom.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/cdrom/aix/SDL_syscdrom.c	Mon Feb 06 17:28:04 2006 +0000
+++ b/src/cdrom/aix/SDL_syscdrom.c	Tue Feb 07 06:59:48 2006 +0000
@@ -128,12 +128,12 @@
 
 		/* Add this drive to our list */
 		i = SDL_numcds;
-		SDL_cdlist[i] = (char *)malloc(strlen(drive)+1);
+		SDL_cdlist[i] = (char *)SDL_malloc(SDL_strlen(drive)+1);
 		if ( SDL_cdlist[i] == NULL ) {
 			SDL_OutOfMemory();
 			return;
 		}
-		strcpy(SDL_cdlist[i], drive);
+		SDL_strcpy(SDL_cdlist[i], drive);
 		SDL_cdmode[i] = stbuf->st_rdev;
 		++SDL_numcds;
 #ifdef DEBUG_CDROM
@@ -149,7 +149,7 @@
     struct vmount* ptr;
     int            ret;
 
-    buffer = (char*)malloc(10);
+    buffer = (char*)SDL_malloc(10);
     bufsz  = 10;
     if ( buffer==NULL )
     {
@@ -167,8 +167,8 @@
             bufsz = *(int*)buffer; /* Required size is in first word.   */
 				   /* (whatever a word is in AIX 4.3.3) */
 				   /* int seems to be OK in 32bit mode. */
-            free(buffer);
-            buffer = (char*)malloc(bufsz);
+            SDL_free(buffer);
+            buffer = (char*)SDL_malloc(bufsz);
             if ( buffer==NULL )
             {
                 fprintf(stderr,
@@ -237,9 +237,9 @@
     {
         ret = getfsent_r ( &entry, &fsFile, &passNo );
         if ( ret == 0 ) {
-            char* l = strrchr(entry.fs_spec,'/');
+            char* l = SDL_strrchr(entry.fs_spec,'/');
             if ( l != NULL ) {
-                if ( !strncmp("cd",++l,2) ) {
+                if ( !SDL_strncmp("cd",++l,2) ) {
 #ifdef DEBUG_CDROM
                     fprintf(stderr,
 			    "Found unmounted CD ROM drive with device name %s\n",
@@ -266,9 +266,9 @@
     {
         entry = getfsent();
         if ( entry != NULL ) {
-            char* l = strrchr(entry->fs_spec,'/');
+            char* l = SDL_strrchr(entry->fs_spec,'/');
             if ( l != NULL ) {
-                if ( !strncmp("cd",++l,2) ) {
+                if ( !SDL_strncmp("cd",++l,2) ) {
 #ifdef DEBUG_CDROM
                     fprintf(stderr,"Found unmounted CD ROM drive with device name %s", entry->fs_spec);
 #endif
@@ -303,15 +303,15 @@
 	SDL_CDcaps.Close = SDL_SYS_CDClose;
 
 	/* Look in the environment for our CD-ROM drive list */
-	SDLcdrom = getenv("SDL_CDROM");	/* ':' separated list of devices */
+	SDLcdrom = SDL_getenv("SDL_CDROM");	/* ':' separated list of devices */
 	if ( SDLcdrom != NULL ) {
 		char *cdpath, *delim;
-		cdpath = malloc(strlen(SDLcdrom)+1);
+		cdpath = SDL_malloc(SDL_strlen(SDLcdrom)+1);
 		if ( cdpath != NULL ) {
-			strcpy(cdpath, SDLcdrom);
+			SDL_strcpy(cdpath, SDLcdrom);
 			SDLcdrom = cdpath;
 			do {
-				delim = strchr(SDLcdrom, ':');
+				delim = SDL_strchr(SDLcdrom, ':');
 				if ( delim ) {
 					*delim++ = '\0';
 				}
@@ -327,7 +327,7 @@
 					SDLcdrom = NULL;
 				}
 			} while ( SDLcdrom );
-			free(cdpath);
+			SDL_free(cdpath);
 		}
 
 		/* If we found our drives, there's nothing left to do */
@@ -369,13 +369,13 @@
      * We found /dev/cd? drives and that is in our list. But we can
      * open only the /dev/rcd? versions of those devices for Audio CD.
      */
-    cdromname = (char*)malloc( strlen(SDL_cdlist[drive]+2) );
-    strcpy(cdromname,SDL_cdlist[drive]);
-    lastsl = strrchr(cdromname,'/');
+    cdromname = (char*)SDL_malloc( SDL_strlen(SDL_cdlist[drive]+2) );
+    SDL_strcpy(cdromname,SDL_cdlist[drive]);
+    lastsl = SDL_strrchr(cdromname,'/');
     if (lastsl) {
 	*lastsl = 0;
 	strcat(cdromname,"/r");
-	lastsl = strrchr(SDL_cdlist[drive],'/');
+	lastsl = SDL_strrchr(SDL_cdlist[drive],'/');
 	if (lastsl) {
 	    lastsl++;
 	    strcat(cdromname,lastsl);
@@ -459,7 +459,7 @@
 #endif
 	}
     }
-    free(cdromname);
+    SDL_free(cdromname);
     return fd;
 }
 
@@ -650,7 +650,7 @@
 
 	if ( SDL_numcds > 0 ) {
 		for ( i=0; i<SDL_numcds; ++i ) {
-			free(SDL_cdlist[i]);
+			SDL_free(SDL_cdlist[i]);
 		}
 		SDL_numcds = 0;
 	}