1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-16 03:34:13 +01:00

wrlib: Added clean-up of library internals in 'RShutdown'

The library uses internally a cache of tables to convert image to different
depths, there is now an internal function 'r_destroy_conversion_tables' to
free them.
This commit is contained in:
David Maciejak
2014-05-08 23:57:03 +02:00
committed by Carlos R. Mafra
parent e237ec15a0
commit 1b2e8a6491
4 changed files with 76 additions and 0 deletions

View File

@@ -34,6 +34,8 @@
#include <assert.h>
#include "wraster.h"
#include "convert.h"
#ifdef USE_XSHM
extern Pixmap R_CreateXImageMappedPixmap(RContext * context, RXImage * ximage);
@@ -62,6 +64,38 @@ typedef struct RStdConversionTable {
static RConversionTable *conversionTable = NULL;
static RStdConversionTable *stdConversionTable = NULL;
static void release_conversion_table(void)
{
RConversionTable *tmp = conversionTable;
while (tmp) {
RConversionTable *tmp_to_delete = tmp;
tmp = tmp->next;
free(tmp_to_delete);
}
conversionTable = NULL;
}
static void release_std_conversion_table(void)
{
RStdConversionTable *tmp = stdConversionTable;
while (tmp) {
RStdConversionTable *tmp_to_delete = tmp;
tmp = tmp->next;
free(tmp_to_delete);
}
stdConversionTable = NULL;
}
void r_destroy_conversion_tables(void)
{
release_conversion_table();
release_std_conversion_table();
}
static unsigned short *computeTable(unsigned short mask)
{
RConversionTable *tmp = conversionTable;