X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=hacks%2Fjulia.c;h=c41aba517f52844c0fae9172354014a5d62408fe;hp=a121711d423aad4dce911732e6305519e1888f52;hb=4361b69d3178d7fc98d0388f9a223af6c2651aba;hpb=d6b0217f2417bd19187f0ebc389d6c5c2233b11c diff --git a/hacks/julia.c b/hacks/julia.c index a121711d..c41aba51 100644 --- a/hacks/julia.c +++ b/hacks/julia.c @@ -46,6 +46,7 @@ static const char sccsid[] = "@(#)julia.c 4.03 97/04/10 xlockmore"; "*ignoreRotation: True \n" \ # define UNIFORM_COLORS +# define release_julia 0 # include "xlockmore.h" /* in xscreensaver distribution */ #else /* !STANDALONE */ # include "xlock.h" /* in xlockmore distribution */ @@ -152,6 +153,8 @@ incr(ModeInfo * mi, juliastruct * jp) } } +static void free_julia (ModeInfo * mi); + ENTRYPOINT void init_julia(ModeInfo * mi) { @@ -161,11 +164,7 @@ init_julia(ModeInfo * mi) XGCValues gcv; int i; - if (julias == NULL) { - if ((julias = (juliastruct *) calloc(MI_NUM_SCREENS(mi), - sizeof (juliastruct))) == NULL) - return; - } + MI_INIT (mi, julias, free_julia); jp = &julias[MI_SCREEN(mi)]; jp->centerx = MI_WIN_WIDTH(mi) / 2; @@ -414,35 +413,27 @@ draw_julia (ModeInfo * mi) } } -ENTRYPOINT void -release_julia (ModeInfo * mi) +static void +free_julia (ModeInfo * mi) { - if (julias != NULL) { - int screen; - - for (screen = 0; screen < MI_NUM_SCREENS(mi); screen++) { - Display *display = MI_DISPLAY(mi); - juliastruct *jp = &julias[screen]; - int buffer; - - if (jp->pointBuffer) { - for (buffer = 0; buffer < jp->nbuffers; buffer++) - if (jp->pointBuffer[buffer]) - (void) free((void *) jp->pointBuffer[buffer]); - (void) free((void *) jp->pointBuffer); - } - if (jp->stippledGC != None) - XFreeGC(display, jp->stippledGC); - if (jp->pixmap != None) - XFreePixmap(display, jp->pixmap); + Display *display = MI_DISPLAY(mi); + juliastruct *jp = &julias[MI_SCREEN(mi)]; + int buffer; + + if (jp->pointBuffer) { + for (buffer = 0; buffer < jp->nbuffers; buffer++) + if (jp->pointBuffer[buffer]) + (void) free((void *) jp->pointBuffer[buffer]); + (void) free((void *) jp->pointBuffer); + } + if (jp->stippledGC != None) + XFreeGC(display, jp->stippledGC); + if (jp->pixmap != None) + XFreePixmap(display, jp->pixmap); #ifndef HAVE_JWXYZ - if (jp->cursor) - XFreeCursor (display, jp->cursor); + if (jp->cursor) + XFreeCursor (display, jp->cursor); #endif - } - (void) free((void *) julias); - julias = NULL; - } } ENTRYPOINT void