[Xbubble-commits] xbubble/src utils.c,1.1,1.2 utils.h,1.1,1.2
Martin Quinson
xbubble-devel@lists.alioth.debian.org
Wed, 27 Apr 2005 15:28:19 +0000
Update of /cvsroot/xbubble/xbubble/src
In directory haydn:/tmp/cvs-serv17699
Modified Files:
utils.c utils.h
Log Message:
Refcounting on the whole sets (for animation mess cleanup)
Index: utils.h
===================================================================
RCS file: /cvsroot/xbubble/xbubble/src/utils.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- utils.h 5 Dec 2004 20:41:01 -0000 1.1
+++ utils.h 27 Apr 2005 15:28:16 -0000 1.2
@@ -7,6 +7,7 @@
void ** element;
int size;
int max_size;
+ int ref; /* refcounting on the whole set */
};
typedef struct _Set * Set;
Index: utils.c
===================================================================
RCS file: /cvsroot/xbubble/xbubble/src/utils.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- utils.c 5 Dec 2004 20:41:01 -0000 1.1
+++ utils.c 27 Apr 2005 15:28:15 -0000 1.2
@@ -79,6 +79,7 @@
s->element = (void **) xmalloc( sizeof(void *) * max_size);
s->max_size = max_size;
s->size = 0;
+ s->ref = 1;
return s;
}
@@ -89,6 +90,17 @@
}
}
+void set_ref(Set set) {
+ s->ref++;
+}
+
+void set_unref(Set set) {
+ if (!--s->ref) {
+ set_free(set);
+ }
+}
+
+
void set_add( Set s, void * p ) {
if ( s->size >= s->max_size ) {
s->max_size += SET_BLOCK;