comparison src/video/fbcon/SDL_fbvideo.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
comparison
equal deleted inserted replaced
1335:c39265384763 1336:3692456e7b0f
153 static int FB_Available(void) 153 static int FB_Available(void)
154 { 154 {
155 int console; 155 int console;
156 const char *SDL_fbdev; 156 const char *SDL_fbdev;
157 157
158 SDL_fbdev = getenv("SDL_FBDEV"); 158 SDL_fbdev = SDL_getenv("SDL_FBDEV");
159 if ( SDL_fbdev == NULL ) { 159 if ( SDL_fbdev == NULL ) {
160 SDL_fbdev = "/dev/fb0"; 160 SDL_fbdev = "/dev/fb0";
161 } 161 }
162 console = open(SDL_fbdev, O_RDWR, 0); 162 console = open(SDL_fbdev, O_RDWR, 0);
163 if ( console >= 0 ) { 163 if ( console >= 0 ) {
166 return(console >= 0); 166 return(console >= 0);
167 } 167 }
168 168
169 static void FB_DeleteDevice(SDL_VideoDevice *device) 169 static void FB_DeleteDevice(SDL_VideoDevice *device)
170 { 170 {
171 free(device->hidden); 171 SDL_free(device->hidden);
172 free(device); 172 SDL_free(device);
173 } 173 }
174 174
175 static SDL_VideoDevice *FB_CreateDevice(int devindex) 175 static SDL_VideoDevice *FB_CreateDevice(int devindex)
176 { 176 {
177 SDL_VideoDevice *this; 177 SDL_VideoDevice *this;
178 178
179 /* Initialize all variables that we clean on shutdown */ 179 /* Initialize all variables that we clean on shutdown */
180 this = (SDL_VideoDevice *)malloc(sizeof(SDL_VideoDevice)); 180 this = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice));
181 if ( this ) { 181 if ( this ) {
182 memset(this, 0, (sizeof *this)); 182 SDL_memset(this, 0, (sizeof *this));
183 this->hidden = (struct SDL_PrivateVideoData *) 183 this->hidden = (struct SDL_PrivateVideoData *)
184 malloc((sizeof *this->hidden)); 184 SDL_malloc((sizeof *this->hidden));
185 } 185 }
186 if ( (this == NULL) || (this->hidden == NULL) ) { 186 if ( (this == NULL) || (this->hidden == NULL) ) {
187 SDL_OutOfMemory(); 187 SDL_OutOfMemory();
188 if ( this ) { 188 if ( this ) {
189 free(this); 189 SDL_free(this);
190 } 190 }
191 return(0); 191 return(0);
192 } 192 }
193 memset(this->hidden, 0, (sizeof *this->hidden)); 193 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
194 wait_vbl = FB_WaitVBL; 194 wait_vbl = FB_WaitVBL;
195 wait_idle = FB_WaitIdle; 195 wait_idle = FB_WaitIdle;
196 mouse_fd = -1; 196 mouse_fd = -1;
197 keyboard_fd = -1; 197 keyboard_fd = -1;
198 198
272 272
273 /* Find a "geometry" */ 273 /* Find a "geometry" */
274 do { 274 do {
275 if (read_fbmodes_line(f, line, sizeof(line))==0) 275 if (read_fbmodes_line(f, line, sizeof(line))==0)
276 return 0; 276 return 0;
277 if (strncmp(line,"geometry",8)==0) 277 if (SDL_strncmp(line,"geometry",8)==0)
278 break; 278 break;
279 } 279 }
280 while(1); 280 while(1);
281 281
282 sscanf(line, "geometry %d %d %d %d %d", &vinfo->xres, &vinfo->yres, 282 SDL_sscanf(line, "geometry %d %d %d %d %d", &vinfo->xres, &vinfo->yres,
283 &vinfo->xres_virtual, &vinfo->yres_virtual, &vinfo->bits_per_pixel); 283 &vinfo->xres_virtual, &vinfo->yres_virtual, &vinfo->bits_per_pixel);
284 if (read_fbmodes_line(f, line, sizeof(line))==0) 284 if (read_fbmodes_line(f, line, sizeof(line))==0)
285 return 0; 285 return 0;
286 286
287 sscanf(line, "timings %d %d %d %d %d %d %d", &vinfo->pixclock, 287 SDL_sscanf(line, "timings %d %d %d %d %d %d %d", &vinfo->pixclock,
288 &vinfo->left_margin, &vinfo->right_margin, &vinfo->upper_margin, 288 &vinfo->left_margin, &vinfo->right_margin, &vinfo->upper_margin,
289 &vinfo->lower_margin, &vinfo->hsync_len, &vinfo->vsync_len); 289 &vinfo->lower_margin, &vinfo->hsync_len, &vinfo->vsync_len);
290 290
291 vinfo->sync=0; 291 vinfo->sync=0;
292 vinfo->vmode=FB_VMODE_NONINTERLACED; 292 vinfo->vmode=FB_VMODE_NONINTERLACED;
294 /* Parse misc options */ 294 /* Parse misc options */
295 do { 295 do {
296 if (read_fbmodes_line(f, line, sizeof(line))==0) 296 if (read_fbmodes_line(f, line, sizeof(line))==0)
297 return 0; 297 return 0;
298 298
299 if (strncmp(line,"hsync",5)==0) { 299 if (SDL_strncmp(line,"hsync",5)==0) {
300 sscanf(line,"hsync %s",option); 300 SDL_sscanf(line,"hsync %s",option);
301 if (strncmp(option,"high",4)==0) 301 if (SDL_strncmp(option,"high",4)==0)
302 vinfo->sync |= FB_SYNC_HOR_HIGH_ACT; 302 vinfo->sync |= FB_SYNC_HOR_HIGH_ACT;
303 } 303 }
304 else if (strncmp(line,"vsync",5)==0) { 304 else if (SDL_strncmp(line,"vsync",5)==0) {
305 sscanf(line,"vsync %s",option); 305 SDL_sscanf(line,"vsync %s",option);
306 if (strncmp(option,"high",4)==0) 306 if (SDL_strncmp(option,"high",4)==0)
307 vinfo->sync |= FB_SYNC_VERT_HIGH_ACT; 307 vinfo->sync |= FB_SYNC_VERT_HIGH_ACT;
308 } 308 }
309 else if (strncmp(line,"csync",5)==0) { 309 else if (SDL_strncmp(line,"csync",5)==0) {
310 sscanf(line,"csync %s",option); 310 SDL_sscanf(line,"csync %s",option);
311 if (strncmp(option,"high",4)==0) 311 if (SDL_strncmp(option,"high",4)==0)
312 vinfo->sync |= FB_SYNC_COMP_HIGH_ACT; 312 vinfo->sync |= FB_SYNC_COMP_HIGH_ACT;
313 } 313 }
314 else if (strncmp(line,"extsync",5)==0) { 314 else if (SDL_strncmp(line,"extsync",5)==0) {
315 sscanf(line,"extsync %s",option); 315 SDL_sscanf(line,"extsync %s",option);
316 if (strncmp(option,"true",4)==0) 316 if (SDL_strncmp(option,"true",4)==0)
317 vinfo->sync |= FB_SYNC_EXT; 317 vinfo->sync |= FB_SYNC_EXT;
318 } 318 }
319 else if (strncmp(line,"laced",5)==0) { 319 else if (SDL_strncmp(line,"laced",5)==0) {
320 sscanf(line,"laced %s",option); 320 SDL_sscanf(line,"laced %s",option);
321 if (strncmp(option,"true",4)==0) 321 if (SDL_strncmp(option,"true",4)==0)
322 vinfo->vmode |= FB_VMODE_INTERLACED; 322 vinfo->vmode |= FB_VMODE_INTERLACED;
323 } 323 }
324 else if (strncmp(line,"double",6)==0) { 324 else if (SDL_strncmp(line,"double",6)==0) {
325 sscanf(line,"double %s",option); 325 SDL_sscanf(line,"double %s",option);
326 if (strncmp(option,"true",4)==0) 326 if (SDL_strncmp(option,"true",4)==0)
327 vinfo->vmode |= FB_VMODE_DOUBLE; 327 vinfo->vmode |= FB_VMODE_DOUBLE;
328 } 328 }
329 } 329 }
330 while(strncmp(line,"endmode",7)!=0); 330 while(SDL_strncmp(line,"endmode",7)!=0);
331 331
332 return 1; 332 return 1;
333 } 333 }
334 334
335 static int FB_CheckMode(_THIS, struct fb_var_screeninfo *vinfo, 335 static int FB_CheckMode(_THIS, struct fb_var_screeninfo *vinfo,
391 return(0); 391 return(0);
392 } 392 }
393 } 393 }
394 394
395 /* Set up the new video mode rectangle */ 395 /* Set up the new video mode rectangle */
396 mode = (SDL_Rect *)malloc(sizeof *mode); 396 mode = (SDL_Rect *)SDL_malloc(sizeof *mode);
397 if ( mode == NULL ) { 397 if ( mode == NULL ) {
398 SDL_OutOfMemory(); 398 SDL_OutOfMemory();
399 return(-1); 399 return(-1);
400 } 400 }
401 mode->x = 0; 401 mode->x = 0;
407 #endif 407 #endif
408 408
409 /* Allocate the new list of modes, and fill in the new mode */ 409 /* Allocate the new list of modes, and fill in the new mode */
410 next_mode = SDL_nummodes[index]; 410 next_mode = SDL_nummodes[index];
411 SDL_modelist[index] = (SDL_Rect **) 411 SDL_modelist[index] = (SDL_Rect **)
412 realloc(SDL_modelist[index], (1+next_mode+1)*sizeof(SDL_Rect *)); 412 SDL_realloc(SDL_modelist[index], (1+next_mode+1)*sizeof(SDL_Rect *));
413 if ( SDL_modelist[index] == NULL ) { 413 if ( SDL_modelist[index] == NULL ) {
414 SDL_OutOfMemory(); 414 SDL_OutOfMemory();
415 SDL_nummodes[index] = 0; 415 SDL_nummodes[index] = 0;
416 free(mode); 416 SDL_free(mode);
417 return(-1); 417 return(-1);
418 } 418 }
419 SDL_modelist[index][next_mode] = mode; 419 SDL_modelist[index][next_mode] = mode;
420 SDL_modelist[index][next_mode+1] = NULL; 420 SDL_modelist[index][next_mode+1] = NULL;
421 SDL_nummodes[index]++; 421 SDL_nummodes[index]++;
453 unsigned int current_h; 453 unsigned int current_h;
454 const char *SDL_fbdev; 454 const char *SDL_fbdev;
455 FILE *modesdb; 455 FILE *modesdb;
456 456
457 /* Initialize the library */ 457 /* Initialize the library */
458 SDL_fbdev = getenv("SDL_FBDEV"); 458 SDL_fbdev = SDL_getenv("SDL_FBDEV");
459 if ( SDL_fbdev == NULL ) { 459 if ( SDL_fbdev == NULL ) {
460 SDL_fbdev = "/dev/fb0"; 460 SDL_fbdev = "/dev/fb0";
461 } 461 }
462 console_fd = open(SDL_fbdev, O_RDWR, 0); 462 console_fd = open(SDL_fbdev, O_RDWR, 0);
463 if ( console_fd < 0 ) { 463 if ( console_fd < 0 ) {
516 return(-1); 516 return(-1);
517 } 517 }
518 518
519 /* Check if the user wants to disable hardware acceleration */ 519 /* Check if the user wants to disable hardware acceleration */
520 { const char *fb_accel; 520 { const char *fb_accel;
521 fb_accel = getenv("SDL_FBACCEL"); 521 fb_accel = SDL_getenv("SDL_FBACCEL");
522 if ( fb_accel ) { 522 if ( fb_accel ) {
523 finfo.accel = atoi(fb_accel); 523 finfo.accel = atoi(fb_accel);
524 } 524 }
525 } 525 }
526 526
587 modesdb = fopen(FB_MODES_DB, "r"); 587 modesdb = fopen(FB_MODES_DB, "r");
588 for ( i=0; i<NUM_MODELISTS; ++i ) { 588 for ( i=0; i<NUM_MODELISTS; ++i ) {
589 SDL_nummodes[i] = 0; 589 SDL_nummodes[i] = 0;
590 SDL_modelist[i] = NULL; 590 SDL_modelist[i] = NULL;
591 } 591 }
592 if ( getenv("SDL_FB_BROKEN_MODES") != NULL ) { 592 if ( SDL_getenv("SDL_FB_BROKEN_MODES") != NULL ) {
593 FB_AddMode(this, current_index, current_w, current_h, 0); 593 FB_AddMode(this, current_index, current_w, current_h, 0);
594 } else if(modesdb) { 594 } else if(modesdb) {
595 while ( read_fbmodes_mode(modesdb, &vinfo) ) { 595 while ( read_fbmodes_mode(modesdb, &vinfo) ) {
596 for ( i=0; i<NUM_MODELISTS; ++i ) { 596 for ( i=0; i<NUM_MODELISTS; ++i ) {
597 unsigned int w, h; 597 unsigned int w, h;
680 return(-1); 680 return(-1);
681 } 681 }
682 if ( FB_OpenMouse(this) < 0 ) { 682 if ( FB_OpenMouse(this) < 0 ) {
683 const char *sdl_nomouse; 683 const char *sdl_nomouse;
684 684
685 sdl_nomouse = getenv("SDL_NOMOUSE"); 685 sdl_nomouse = SDL_getenv("SDL_NOMOUSE");
686 if ( ! sdl_nomouse ) { 686 if ( ! sdl_nomouse ) {
687 SDL_SetError("Unable to open mouse"); 687 SDL_SetError("Unable to open mouse");
688 FB_VideoQuit(this); 688 FB_VideoQuit(this);
689 return(-1); 689 return(-1);
690 } 690 }
865 /* Set up the new mode framebuffer */ 865 /* Set up the new mode framebuffer */
866 current->flags = SDL_FULLSCREEN; 866 current->flags = SDL_FULLSCREEN;
867 current->w = vinfo.xres; 867 current->w = vinfo.xres;
868 current->h = vinfo.yres; 868 current->h = vinfo.yres;
869 current->pitch = current->w; 869 current->pitch = current->w;
870 current->pixels = malloc(current->h*current->pitch); 870 current->pixels = SDL_malloc(current->h*current->pitch);
871 871
872 /* Set the update rectangle function */ 872 /* Set the update rectangle function */
873 this->UpdateRects = FB_VGA16Update; 873 this->UpdateRects = FB_VGA16Update;
874 874
875 /* We're done */ 875 /* We're done */
1067 1067
1068 surfaces_memtotal = size; 1068 surfaces_memtotal = size;
1069 surfaces_memleft = size; 1069 surfaces_memleft = size;
1070 1070
1071 if ( surfaces_memleft > 0 ) { 1071 if ( surfaces_memleft > 0 ) {
1072 bucket = (vidmem_bucket *)malloc(sizeof(*bucket)); 1072 bucket = (vidmem_bucket *)SDL_malloc(sizeof(*bucket));
1073 if ( bucket == NULL ) { 1073 if ( bucket == NULL ) {
1074 SDL_OutOfMemory(); 1074 SDL_OutOfMemory();
1075 return(-1); 1075 return(-1);
1076 } 1076 }
1077 bucket->prev = &surfaces; 1077 bucket->prev = &surfaces;
1099 1099
1100 bucket = surfaces.next; 1100 bucket = surfaces.next;
1101 while ( bucket ) { 1101 while ( bucket ) {
1102 freeable = bucket; 1102 freeable = bucket;
1103 bucket = bucket->next; 1103 bucket = bucket->next;
1104 free(freeable); 1104 SDL_free(freeable);
1105 } 1105 }
1106 surfaces.next = NULL; 1106 surfaces.next = NULL;
1107 } 1107 }
1108 1108
1109 static int FB_AllocHWSurface(_THIS, SDL_Surface *surface) 1109 static int FB_AllocHWSurface(_THIS, SDL_Surface *surface)
1150 vidmem_bucket *newbucket; 1150 vidmem_bucket *newbucket;
1151 1151
1152 #ifdef FBCON_DEBUG 1152 #ifdef FBCON_DEBUG
1153 fprintf(stderr, "Adding new free bucket of %d bytes\n", extra); 1153 fprintf(stderr, "Adding new free bucket of %d bytes\n", extra);
1154 #endif 1154 #endif
1155 newbucket = (vidmem_bucket *)malloc(sizeof(*newbucket)); 1155 newbucket = (vidmem_bucket *)SDL_malloc(sizeof(*newbucket));
1156 if ( newbucket == NULL ) { 1156 if ( newbucket == NULL ) {
1157 SDL_OutOfMemory(); 1157 SDL_OutOfMemory();
1158 return(-1); 1158 return(-1);
1159 } 1159 }
1160 newbucket->prev = bucket; 1160 newbucket->prev = bucket;
1208 bucket->size += bucket->next->size; 1208 bucket->size += bucket->next->size;
1209 bucket->next = bucket->next->next; 1209 bucket->next = bucket->next->next;
1210 if ( bucket->next ) { 1210 if ( bucket->next ) {
1211 bucket->next->prev = bucket; 1211 bucket->next->prev = bucket;
1212 } 1212 }
1213 free(freeable); 1213 SDL_free(freeable);
1214 } 1214 }
1215 if ( bucket->prev && ! bucket->prev->used ) { 1215 if ( bucket->prev && ! bucket->prev->used ) {
1216 #ifdef DGA_DEBUG 1216 #ifdef DGA_DEBUG
1217 printf("Merging with previous bucket, for %d total bytes\n", bucket->prev->size+bucket->size); 1217 printf("Merging with previous bucket, for %d total bytes\n", bucket->prev->size+bucket->size);
1218 #endif 1218 #endif
1220 bucket->prev->size += bucket->size; 1220 bucket->prev->size += bucket->size;
1221 bucket->prev->next = bucket->next; 1221 bucket->prev->next = bucket->next;
1222 if ( bucket->next ) { 1222 if ( bucket->next ) {
1223 bucket->next->prev = bucket->prev; 1223 bucket->next->prev = bucket->prev;
1224 } 1224 }
1225 free(freeable); 1225 SDL_free(freeable);
1226 } 1226 }
1227 } 1227 }
1228 surface->pixels = NULL; 1228 surface->pixels = NULL;
1229 surface->hwdata = NULL; 1229 surface->hwdata = NULL;
1230 } 1230 }
1487 int i; 1487 int i;
1488 1488
1489 /* Save hardware palette, if needed */ 1489 /* Save hardware palette, if needed */
1490 if ( finfo->visual == FB_VISUAL_PSEUDOCOLOR ) { 1490 if ( finfo->visual == FB_VISUAL_PSEUDOCOLOR ) {
1491 saved_cmaplen = 1<<vinfo->bits_per_pixel; 1491 saved_cmaplen = 1<<vinfo->bits_per_pixel;
1492 saved_cmap=(__u16 *)malloc(3*saved_cmaplen*sizeof(*saved_cmap)); 1492 saved_cmap=(__u16 *)SDL_malloc(3*saved_cmaplen*sizeof(*saved_cmap));
1493 if ( saved_cmap != NULL ) { 1493 if ( saved_cmap != NULL ) {
1494 FB_SavePaletteTo(this, saved_cmaplen, saved_cmap); 1494 FB_SavePaletteTo(this, saved_cmaplen, saved_cmap);
1495 } 1495 }
1496 } 1496 }
1497 1497
1507 if ( finfo->visual == FB_VISUAL_DIRECTCOLOR ) { 1507 if ( finfo->visual == FB_VISUAL_DIRECTCOLOR ) {
1508 __u16 new_entries[3*256]; 1508 __u16 new_entries[3*256];
1509 1509
1510 /* Save the colormap */ 1510 /* Save the colormap */
1511 saved_cmaplen = 256; 1511 saved_cmaplen = 256;
1512 saved_cmap=(__u16 *)malloc(3*saved_cmaplen*sizeof(*saved_cmap)); 1512 saved_cmap=(__u16 *)SDL_malloc(3*saved_cmaplen*sizeof(*saved_cmap));
1513 if ( saved_cmap != NULL ) { 1513 if ( saved_cmap != NULL ) {
1514 FB_SavePaletteTo(this, saved_cmaplen, saved_cmap); 1514 FB_SavePaletteTo(this, saved_cmaplen, saved_cmap);
1515 } 1515 }
1516 1516
1517 /* Allocate new identity colormap */ 1517 /* Allocate new identity colormap */
1527 static void FB_RestorePalette(_THIS) 1527 static void FB_RestorePalette(_THIS)
1528 { 1528 {
1529 /* Restore the original palette */ 1529 /* Restore the original palette */
1530 if ( saved_cmap ) { 1530 if ( saved_cmap ) {
1531 FB_RestorePaletteFrom(this, saved_cmaplen, saved_cmap); 1531 FB_RestorePaletteFrom(this, saved_cmaplen, saved_cmap);
1532 free(saved_cmap); 1532 SDL_free(saved_cmap);
1533 saved_cmap = NULL; 1533 saved_cmap = NULL;
1534 } 1534 }
1535 } 1535 }
1536 1536
1537 static int FB_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors) 1537 static int FB_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
1559 !(this->screen->flags & SDL_HWPALETTE) ) { 1559 !(this->screen->flags & SDL_HWPALETTE) ) {
1560 colors = this->screen->format->palette->colors; 1560 colors = this->screen->format->palette->colors;
1561 ncolors = this->screen->format->palette->ncolors; 1561 ncolors = this->screen->format->palette->ncolors;
1562 cmap.start = 0; 1562 cmap.start = 0;
1563 cmap.len = ncolors; 1563 cmap.len = ncolors;
1564 memset(r, 0, sizeof(r)); 1564 SDL_memset(r, 0, sizeof(r));
1565 memset(g, 0, sizeof(g)); 1565 SDL_memset(g, 0, sizeof(g));
1566 memset(b, 0, sizeof(b)); 1566 SDL_memset(b, 0, sizeof(b));
1567 if ( ioctl(console_fd, FBIOGETCMAP, &cmap) == 0 ) { 1567 if ( ioctl(console_fd, FBIOGETCMAP, &cmap) == 0 ) {
1568 for ( i=ncolors-1; i>=0; --i ) { 1568 for ( i=ncolors-1; i>=0; --i ) {
1569 colors[i].r = (r[i]>>8); 1569 colors[i].r = (r[i]>>8);
1570 colors[i].g = (g[i]>>8); 1570 colors[i].g = (g[i]>>8);
1571 colors[i].b = (b[i]>>8); 1571 colors[i].b = (b[i]>>8);
1584 int i, j; 1584 int i, j;
1585 1585
1586 if ( this->screen ) { 1586 if ( this->screen ) {
1587 /* Clear screen and tell SDL not to free the pixels */ 1587 /* Clear screen and tell SDL not to free the pixels */
1588 if ( this->screen->pixels && FB_InGraphicsMode(this) ) { 1588 if ( this->screen->pixels && FB_InGraphicsMode(this) ) {
1589 #if defined(__powerpc__) || defined(__ia64__) /* SIGBUS when using memset() ?? */ 1589 #if defined(__powerpc__) || defined(__ia64__) /* SIGBUS when using SDL_memset() ?? */
1590 Uint8 *rowp = (Uint8 *)this->screen->pixels; 1590 Uint8 *rowp = (Uint8 *)this->screen->pixels;
1591 int left = this->screen->pitch*this->screen->h; 1591 int left = this->screen->pitch*this->screen->h;
1592 while ( left-- ) { *rowp++ = 0; } 1592 while ( left-- ) { *rowp++ = 0; }
1593 #else 1593 #else
1594 memset(this->screen->pixels,0,this->screen->h*this->screen->pitch); 1594 SDL_memset(this->screen->pixels,0,this->screen->h*this->screen->pitch);
1595 #endif 1595 #endif
1596 } 1596 }
1597 /* This test fails when using the VGA16 shadow memory */ 1597 /* This test fails when using the VGA16 shadow memory */
1598 if ( ((char *)this->screen->pixels >= mapped_mem) && 1598 if ( ((char *)this->screen->pixels >= mapped_mem) &&
1599 ((char *)this->screen->pixels < (mapped_mem+mapped_memlen)) ) { 1599 ((char *)this->screen->pixels < (mapped_mem+mapped_memlen)) ) {
1609 1609
1610 /* Clean up defined video modes */ 1610 /* Clean up defined video modes */
1611 for ( i=0; i<NUM_MODELISTS; ++i ) { 1611 for ( i=0; i<NUM_MODELISTS; ++i ) {
1612 if ( SDL_modelist[i] != NULL ) { 1612 if ( SDL_modelist[i] != NULL ) {
1613 for ( j=0; SDL_modelist[i][j]; ++j ) { 1613 for ( j=0; SDL_modelist[i][j]; ++j ) {
1614 free(SDL_modelist[i][j]); 1614 SDL_free(SDL_modelist[i][j]);
1615 } 1615 }
1616 free(SDL_modelist[i]); 1616 SDL_free(SDL_modelist[i]);
1617 SDL_modelist[i] = NULL; 1617 SDL_modelist[i] = NULL;
1618 } 1618 }
1619 } 1619 }
1620 1620
1621 /* Clean up the memory bucket list */ 1621 /* Clean up the memory bucket list */