Commit c113a550 authored by Bob Pendleton's avatar Bob Pendleton

changed to use SDL_realloc()

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402576
parent a2ae2815
...@@ -63,7 +63,6 @@ X11_TrackColormap(Display * display, int scrNum, Colormap colormap, ...@@ -63,7 +63,6 @@ X11_TrackColormap(Display * display, int scrNum, Colormap colormap,
XStandardColormap * cmap, Visual * visual) XStandardColormap * cmap, Visual * visual)
{ {
int i; int i;
cmapTableEntry *newTable = NULL;
/* search the table to find out if we already have this one. We /* search the table to find out if we already have this one. We
only want one entry for each display, screen number, visualid, only want one entry for each display, screen number, visualid,
...@@ -79,18 +78,12 @@ X11_TrackColormap(Display * display, int scrNum, Colormap colormap, ...@@ -79,18 +78,12 @@ X11_TrackColormap(Display * display, int scrNum, Colormap colormap,
/* increase the table by one entry. If the table is NULL create the /* increase the table by one entry. If the table is NULL create the
first entrty */ first entrty */
newTable = SDL_malloc((numCmaps + 1) * sizeof(cmapTableEntry)); cmapTable = SDL_realloc(cmapTable, (numCmaps + 1) * sizeof(cmapTableEntry));
if (NULL == newTable) { if (NULL == cmapTable) {
SDL_SetError("Out of memory in X11_TrackColormap()"); SDL_SetError("Out of memory in X11_TrackColormap()");
return; return;
} }
if (NULL != cmapTable) {
SDL_memcpy(newTable, cmapTable, numCmaps * sizeof(cmapTableEntry));
SDL_free(cmapTable);
}
cmapTable = newTable;
cmapTable[numCmaps].display = display; cmapTable[numCmaps].display = display;
cmapTable[numCmaps].scrNum = scrNum; cmapTable[numCmaps].scrNum = scrNum;
cmapTable[numCmaps].colormap = colormap; cmapTable[numCmaps].colormap = colormap;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment