aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-02-06 11:41:37 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-02-06 11:41:37 +0100
commit783cb95713a2e97bda53d5f3c2112303d38d3507 (patch)
tree5f0eed3224ef0972e2a3cb6ee968ade1583cd980
parentAdd llist FIRST & LAST, rewrote code to use them. (diff)
downloadcalp-783cb95713a2e97bda53d5f3c2112303d38d3507.tar.gz
calp-783cb95713a2e97bda53d5f3c2112303d38d3507.tar.xz
Remove GC.
-rw-r--r--main.c12
-rw-r--r--vcal.c28
-rw-r--r--vcal.h13
3 files changed, 0 insertions, 53 deletions
diff --git a/main.c b/main.c
index 87be26ff..6ed74323 100644
--- a/main.c
+++ b/main.c
@@ -61,16 +61,4 @@ int main (int argc, char* argv[argc]) {
}
}
free_vcalendar(&cal);
-
- for (int i = 0; i < gc_ptr; i++) {
- if (gc_vect[i] != NULL) {
- // printf("clines[%i] : [%s] := [%s]\n", i, clines[i]->key.mem, clines[i]->val.mem);
- // printf("gc_vect[%i] : [%s] := [%s]\n", i, gc_vect[i]->key.mem, gc_vect[i]->vals.head->after->value->mem);
- printf("gc_vect[%i] : [%s] := [%s]\n", i,
- ((content_line*) gc_vect[i])->key.mem,
- ((content_line*) gc_vect[i])->vals.head->after->value->mem);
- }
- }
-
- free(gc_vect);
}
diff --git a/vcal.c b/vcal.c
index 5ad35feb..a2a0bd90 100644
--- a/vcal.c
+++ b/vcal.c
@@ -42,7 +42,6 @@ content_line* RESOLVE(content_line)
APPEND(LLIST(strbuf)) (&dest->vals, &new->vals);
FREE(strbuf)(&new->key);
- gc_free(new);
free(new);
return dest;
@@ -53,8 +52,6 @@ content_line* get_property (vevent* ev, char* key) {
}
INIT_F(content_line) {
- gc_register(this);
-
INIT(strbuf, &this->key);
// INIT(strbuf, &this->val);
INIT( LLIST(strbuf), &this->vals );
@@ -63,7 +60,6 @@ INIT_F(content_line) {
}
INIT_F(content_line, int keylen, int vallen) {
- gc_register(this);
INIT(strbuf, &this->key, keylen);
// INIT(strbuf, &this->val, vallen);
INIT( LLIST(strbuf), &this->vals );
@@ -89,8 +85,6 @@ FREE_F(content_line) {
// LLIST_FREE(strbuf)(&this->vals);
FREE(LLIST(strbuf))(&this->vals);
- gc_free(this);
-
// TODO remaining fields
return 0;
}
@@ -126,10 +120,6 @@ int push_event(vcalendar* cal, vevent* ev) {
}
INIT_F(vcalendar) {
- // TODO remove
- gc_vect = calloc(sizeof(*gc_vect), 10000);
- gc_ptr = 0;
-
this->alloc = 1;
this->events = calloc(sizeof(*this->events), this->alloc);
this->n_events = 0;
@@ -143,21 +133,3 @@ int free_vcalendar (vcalendar* cal) {
free (cal->events);
return 0;
}
-
-void** gc_vect;
-int gc_ptr;
-
-int gc_register(void* ptr) {
- gc_vect[gc_ptr++] = ptr;
- return 0;
-}
-
-int gc_free(void* ptr) {
- for (int i = 0; i < gc_ptr; i++) {
- if (gc_vect[i] == ptr) {
- gc_vect[i] = NULL;
- }
- }
-
- return 0;
-}
diff --git a/vcal.h b/vcal.h
index d25a77aa..946b626c 100644
--- a/vcal.h
+++ b/vcal.h
@@ -73,17 +73,4 @@ int free_vcalendar (vcalendar* cal);
*/
int push_event(vcalendar* cal, vevent* ev);
-/*
- * NOTE
- * these create a very basic garbage collector. It shouldn't be used,
- * but is useful for finding lost memmory during debugging.
- * TODO
- * remove it.
- */
-extern void** gc_vect;
-extern int gc_ptr;
-
-int gc_register(void* ptr);
-int gc_free(void* ptr);
-
#endif /* VCAL_H */