aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-02-23 11:30:36 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-02-23 11:30:36 +0100
commit8596f5307ce55ff362d9d22f0b1310f341b0b1e7 (patch)
tree08e8b924d528b29c5adfba505b8006703d479886
parentrest (diff)
downloadcalp-8596f5307ce55ff362d9d22f0b1310f341b0b1e7.tar.gz
calp-8596f5307ce55ff362d9d22f0b1310f341b0b1e7.tar.xz
Something.
-rw-r--r--linked_list.inc.h5
-rw-r--r--main.c3
-rw-r--r--strbuf.c5
3 files changed, 12 insertions, 1 deletions
diff --git a/linked_list.inc.h b/linked_list.inc.h
index e20c6339..11c7844c 100644
--- a/linked_list.inc.h
+++ b/linked_list.inc.h
@@ -2,6 +2,9 @@
// #error "Set TYPE before including this file"
// #else
+#include <stdio.h>
+#include "err.h"
+
// INIT_F ( LLIST(TYPE) ) {
template <class T>
llist<T>::llist () {
@@ -169,8 +172,10 @@ int llist<T>::reset () {
* Manual looping rather than itterators since we destroyed the
* loop variable.
*/
+ fprintf(stderr, _RED "head = %p, tail = %p\n" _RESET, this->head, this->tail);
while (link != this->tail) {
next = link->after;
+ fprintf(stderr, _RED "link = %p\n" _RESET, link);
// FFREE(LINK(TYPE), link);
delete link;
link = next;
diff --git a/main.c b/main.c
index fbd23466..91a5f423 100644
--- a/main.c
+++ b/main.c
@@ -60,10 +60,11 @@ int main (int argc, char** argv) {
printf("component %s, [%u] children\n", ev->type, ev->components.length);
if (strcmp(ev->type, "VEVENT") != 0) continue;
+ content_line* cl = get_property(ev, "SUMMARY");
printf("%3lu : %3lu | %s | %s\n",
i + 1, j + 1,
filename,
- get_property(ev, "SUMMARY")->val->cur->value->key->mem);
+ cl->val->cur->value->key->mem);
}
}
} else if (strcmp(args.argv[0], "-g") == 0) {
diff --git a/strbuf.c b/strbuf.c
index 02f29336..37b0cf3e 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -22,6 +22,7 @@ strbuf::strbuf () {
}
int strbuf_realloc(strbuf* str, size_t len) {
+ fprintf(stderr, "str->mem = %p\n", str->mem);
str->mem = (char*) realloc(str->mem, len);
str->alloc = len;
return 0;
@@ -66,11 +67,15 @@ int strbuf_cap(strbuf* s) {
strbuf::strbuf(strbuf& src) {
// int retval = 0;
+#if 0
if (this->alloc < src.len) {
/* +1 in length is to have room for '\0'. */
strbuf_realloc(this, src.len + 1);
// retval = 1;
}
+#endif
+
+ this->mem = (char*) calloc(sizeof(*this->mem), src.len + 1);
this->len = src.len;
memcpy(this->mem, src.mem, src.len);