Commit 492639f5 authored by Ignacio Casal Quinteiro's avatar Ignacio Casal Quinteiro Committed by Ignacio Casal

vfb: factor out method to free a single screen info

parent 356ffd67
......@@ -156,22 +156,16 @@ vfbBitsPerPixel(int depth)
return 32;
}
void
ddxGiveUp(enum ExitCode error)
static void
freeScreenInfo(vfbScreenInfoPtr pvfb)
{
int i;
/* clean up the framebuffers */
switch (fbmemtype) {
#ifdef HAVE_MMAP
case MMAPPED_FILE_FB:
for (i = 0; i < vfbNumScreens; i++) {
if (-1 == unlink(vfbScreens[i].mmap_file)) {
perror("unlink");
ErrorF("unlink %s failed, %s",
vfbScreens[i].mmap_file, strerror(errno));
}
if (-1 == unlink(pvfb->mmap_file)) {
perror("unlink");
ErrorF("unlink %s failed, %s",
pvfb->mmap_file, strerror(errno));
}
break;
#else /* HAVE_MMAP */
......@@ -181,11 +175,9 @@ ddxGiveUp(enum ExitCode error)
#ifdef HAS_SHM
case SHARED_MEMORY_FB:
for (i = 0; i < vfbNumScreens; i++) {
if (-1 == shmdt((char *) vfbScreens[i].pXWDHeader)) {
perror("shmdt");
ErrorF("shmdt failed, %s", strerror(errno));
}
if (-1 == shmdt((char *) pvfb->pXWDHeader)) {
perror("shmdt");
ErrorF("shmdt failed, %s", strerror(errno));
}
break;
#else /* HAS_SHM */
......@@ -194,13 +186,22 @@ ddxGiveUp(enum ExitCode error)
#endif /* HAS_SHM */
case NORMAL_MEMORY_FB:
for (i = 0; i < vfbNumScreens; i++) {
free(vfbScreens[i].pXWDHeader);
}
free(pvfb->pXWDHeader);
break;
}
}
void
ddxGiveUp(enum ExitCode error)
{
int i;
/* clean up the framebuffers */
for (i = 0; i < vfbNumScreens; i++) {
freeScreenInfo(&vfbScreens[i]);
}
}
#ifdef __APPLE__
void
DarwinHandleGUI(int argc, char *argv[])
......
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