# include <stdlib.h>
#endif
-static OtkGCCache *gccache;
+static OtkGCCache *gccache = NULL;
OtkGCCacheContext *OtkGCCacheContext_New()
{
self->count = 0;
self->hits = 0;
self->fault = False;
+
+ return self;
}
void OtkGCCache_Initialize(int screen_count)
{
- int i;
+ unsigned int i;
gccache = malloc(sizeof(OtkGCCache));
void OtkGCCache_Destroy()
{
- int i;
+ unsigned int i;
for (i = 0; i < gccache->context_count; ++i)
OtkGCCacheContext_Destroy(gccache->contexts[i]);
{
Window hd = OtkDisplay_ScreenInfo(OBDisplay, screen)->root_window;
OtkGCCacheContext *c;
- int i;
+ unsigned int i;
for (i = 0; i < gccache->context_count; ++i) {
c = gccache->contexts[i];
int function, int subwindow, int linewidth)
{
const unsigned long pixel = OtkColor_Pixel(color);
- const unsigned int screen = color->screen;
+ const int screen = color->screen;
const int key = color->red ^ color->green ^ color->blue;
int k = (key % gccache->cache_size) * gccache->cache_buckets;
- int i = 0; // loop variable
+ unsigned int i = 0; // loop variable
OtkGCCacheItem *c = gccache->cache[k], *prev = 0;
/*
void OtkGCCache_Purge()
{
- int i;
+ unsigned int i;
for (i = 0; i < gccache->cache_total_size; ++i) {
OtkGCCacheItem *d = gccache->cache[i];
if (d->ctx && d->count == 0) {
- release(d->ctx);
+ OtkGCCache_InternalRelease(d->ctx);
d->ctx = 0;
}
}