[Pkg-wmaker-commits] [wmbubble] 104/207: Don't bother to dynamically allocate things where the size is fixed at compile time

Doug Torrance dtorrance-guest at moszumanska.debian.org
Mon Aug 24 04:18:12 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch master
in repository wmbubble.

commit f95fdbfa5e0629a9d1fce04dece2f14b856f2df3
Author: Robert Jacobs <rnjacobs at mit.edu>
Date:   Sat Sep 3 01:04:15 2011 -0700

    Don't bother to dynamically allocate things where the size is fixed at compile time
---
 bubblemon.c         |  7 -------
 include/bubblemon.h | 10 +++-------
 2 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/bubblemon.c b/bubblemon.c
index 83ef7e7..1e51cae 100644
--- a/bubblemon.c
+++ b/bubblemon.c
@@ -1436,18 +1436,11 @@ void bubblemon_allocate_buffers(void) {
 	/* storage for bubbles */
 	bm.bubbles = (Bubble *) malloc(sizeof(Bubble) * bm.maxbubbles);
 
-	/* Allocate (zeroed) bubble memory */
-	bm.bubblebuf = calloc(BOX_SIZE * (BOX_SIZE+4), sizeof(char));
-
 	/* Allocate water level memory */
-	bm.waterlevels = malloc(BOX_SIZE * sizeof(int));
 	for (ii = 0; ii < BOX_SIZE; ii++) {
 		bm.waterlevels[ii] = MAKEY(BOX_SIZE);
 	}
 
-	/* Allocate water level velocity memory */
-	bm.waterlevels_dy = calloc(BOX_SIZE, sizeof(int));
-
 	empty_loadgraph = calloc(BOX_SIZE * BOX_SIZE,3);
 	empty_memgraph = calloc(BOX_SIZE * BOX_SIZE,3);
 	graph_numbers_n_rgb = calloc(3*4*9*12,1);
diff --git a/include/bubblemon.h b/include/bubblemon.h
index 63b99af..3d68b01 100644
--- a/include/bubblemon.h
+++ b/include/bubblemon.h
@@ -73,20 +73,16 @@ typedef struct {
 
     /* memory / swap screen buffer */
     unsigned char mem_buf[BOX_SIZE * BOX_SIZE * 3 + 1];
-    /* memory screen graph buffer */
-    unsigned char his_bufa[BOX_SIZE * 31 * 3 + 1];
-    /* loadavg screen graph buffer */
-    unsigned char his_bufb[BOX_SIZE * 33 * 3 + 1];
 
     int screen_type;		/* 0 - memory, 1 - cpu */
     int picture_lock;		/* blend coeff not changed when this is not 0 */
 
     /* bubble stuff */
     int samples;
-    unsigned char *bubblebuf;
+    unsigned char bubblebuf[BOX_SIZE * (BOX_SIZE+4)];;
 
-    int *waterlevels;
-    int *waterlevels_dy;
+    int waterlevels[BOX_SIZE];
+    int waterlevels_dy[BOX_SIZE];
     Bubble *bubbles;
     int n_bubbles;
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbubble.git



More information about the Pkg-wmaker-commits mailing list