diff src/video/dga/SDL_dgavideo.c @ 1338:604d73db6802

Removed uses of stdlib.h and string.h
author Sam Lantinga <slouken@libsdl.org>
date Tue, 07 Feb 2006 09:29:18 +0000
parents 3692456e7b0f
children c71e05b4dc2e
line wrap: on
line diff
--- a/src/video/dga/SDL_dgavideo.c	Tue Feb 07 07:03:29 2006 +0000
+++ b/src/video/dga/SDL_dgavideo.c	Tue Feb 07 09:29:18 2006 +0000
@@ -23,16 +23,14 @@
 /* DGA 2.0 based SDL video driver implementation.
 */
 
-#include <stdlib.h>
-#include <string.h>
+#include <stdio.h>
+
 #include <X11/Xlib.h>
 #include <Xext/extensions/xf86dga.h>
 
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-
 #include "SDL.h"
+#include "SDL_stdlib.h"
+#include "SDL_string.h"
 #include "SDL_error.h"
 #include "SDL_video.h"
 #include "SDL_mouse.h"
@@ -390,7 +388,7 @@
 
 	/* Query for the list of available video modes */
 	modes = SDL_NAME(XDGAQueryModes)(DGA_Display, DGA_Screen, &num_modes);
-	qsort(modes, num_modes, sizeof *modes, cmpmodes);
+	SDL_qsort(modes, num_modes, sizeof *modes, cmpmodes);
 	for ( i=0; i<num_modes; ++i ) {
 #ifdef DGA_DEBUG
 		PrintMode(&modes[i]);
@@ -449,7 +447,7 @@
 
 	/* Search for a matching video mode */
 	modes = SDL_NAME(XDGAQueryModes)(DGA_Display, DGA_Screen, &num_modes);
-	qsort(modes, num_modes, sizeof *modes, cmpmodes);
+	SDL_qsort(modes, num_modes, sizeof *modes, cmpmodes);
 	for ( i=0; i<num_modes; ++i ) {
 		int depth;
 
@@ -968,7 +966,7 @@
 	if ( ! DGA_colormap ) {
 		return(0);
 	}
-	xcmap = (XColor *)alloca(ncolors*sizeof(*xcmap));
+	xcmap = SDL_stack_alloc(XColor, ncolors);
 	for ( i=0; i<ncolors; ++i ) {
 		xcmap[i].pixel = firstcolor + i;
 		xcmap[i].red   = (colors[i].r<<8)|colors[i].r;
@@ -980,6 +978,7 @@
 	pXStoreColors(DGA_Display, DGA_colormap, xcmap, ncolors);
 	pXSync(DGA_Display, False);
 	UNLOCK_DISPLAY();
+	SDL_stack_free(xcmap);
 
 	/* That was easy. :) */
 	return(1);