From http://www.jwz.org/xscreensaver/xscreensaver-5.37.tar.gz
[xscreensaver] / hacks / glx / antmaze.c
index a66c4b5c0b6b3a1741a606beabc5d1d42394566a..229257b9576fc7680ab606e862ce8eabf6d8fa01 100644 (file)
@@ -26,6 +26,7 @@ static const char sccsid[] = "@(#)antmaze.c   5.01 2001/03/01 xlockmore";
                        "*fpsSolid:     True    \n"
 
 # define refresh_antmaze 0
+# define release_antmaze 0
 # include "xlockmore.h"                /* from the xscreensaver distribution */
 #else /* !STANDALONE */
 # include "xlock.h"            /* from the xlockmore distribution */
@@ -81,7 +82,7 @@ ENTRYPOINT ModeSpecOpt antmaze_opts =
 
 #ifdef USE_MODULES
 ModStruct   antmaze_description =
-{"antmaze", "init_antmaze", "draw_antmaze", "release_antmaze",
+{"antmaze", "init_antmaze", "draw_antmaze", NULL,
  "draw_antmaze", "change_antmaze", NULL, &antmaze_opts,
  1000, 1, 1, 1, 4, 1.0, "",
  "draws some ants", 0, NULL};
@@ -1287,15 +1288,6 @@ static void pinit(antmazestruct *mp)
 /*   glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, front_specular); */
 }
 
-ENTRYPOINT void release_antmaze(ModeInfo * mi) 
-{
-  if(antmaze) {
-       free((void *) antmaze);
-       antmaze = (antmazestruct *) NULL;
-  }
-  FreeAllGL(mi);
-}
-
 #define MAX_MAGNIFICATION 10
 #define max(a, b) a < b ? b : a
 #define min(a, b) a < b ? a : b
@@ -1337,11 +1329,7 @@ ENTRYPOINT void init_antmaze(ModeInfo * mi)
 
   antmazestruct *mp;
   
-  if (antmaze == NULL) {
-       if ((antmaze = (antmazestruct *) calloc(MI_NUM_SCREENS(mi),
-                                               sizeof (antmazestruct))) == NULL)
-         return;
-  }
+  MI_INIT(mi, antmaze, NULL);
   mp = &antmaze[MI_SCREEN(mi)];
   mp->step = NRAND(90);
   mp->ant_position = NRAND(90);
@@ -1492,7 +1480,7 @@ ENTRYPOINT void draw_antmaze(ModeInfo * mi)
 
   /* sync */
   if(!draw_antmaze_strip(mi)) {
-    release_antmaze(mi);
+    MI_ABORT(mi);
     return;
   }
 
@@ -1518,7 +1506,7 @@ ENTRYPOINT void draw_antmaze(ModeInfo * mi)
 
   /* sync */
   if(!draw_antmaze_strip(mi)) {
-    release_antmaze(mi);
+    MI_ABORT(mi);
     return;
   }