From http://www.jwz.org/xscreensaver/xscreensaver-5.37.tar.gz
[xscreensaver] / hacks / glx / discoball.c
index 5e8ee92593a5faeca7c9574a6a81f75846ee7047..015c59a50f5405ed46e64a2d711d98319396885e 100644 (file)
@@ -15,6 +15,7 @@
                        "*wireframe:    False       \n" \
 
 # define refresh_ball 0
+# define release_ball 0
 #undef countof
 #define countof(x) (sizeof((x))/sizeof((*x)))
 
@@ -537,20 +538,16 @@ ball_handle_event (ModeInfo *mi, XEvent *event)
 }
 
 
+static void free_ball (ModeInfo *mi);
+
+
 ENTRYPOINT void 
 init_ball (ModeInfo *mi)
 {
   ball_configuration *bp;
   int wire = MI_IS_WIREFRAME(mi);
 
-  if (!bps) {
-    bps = (ball_configuration *)
-      calloc (MI_NUM_SCREENS(mi), sizeof (ball_configuration));
-    if (!bps) {
-      fprintf(stderr, "%s: out of memory\n", progname);
-      exit(1);
-    }
-  }
+  MI_INIT (mi, bps, free_ball);
 
   bp = &bps[MI_SCREEN(mi)];
 
@@ -689,8 +686,8 @@ draw_ball (ModeInfo *mi)
 }
 
 
-ENTRYPOINT void
-release_ball (ModeInfo *mi)
+static void
+free_ball (ModeInfo *mi)
 {
   ball_configuration *bp = &bps[MI_SCREEN(mi)];
   while (bp->tiles)