URI: 
       use maps everywhere relevant - ics2txt - convert icalendar .ics file to plain text
  HTML git clone git://bitreich.org/ics2txt git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/ics2txt
   DIR Log
   DIR Files
   DIR Refs
   DIR Tags
   DIR README
       ---
   DIR commit 775c76c450eed349600344550bbb6c140bdf1811
   DIR parent d4d55c6876bf51dd555a0dbfae0316343d44997e
  HTML Author: Josuah Demangeon <me@josuah.net>
       Date:   Sun, 28 Jun 2020 18:53:48 +0200
       
       use maps everywhere relevant
       
       Diffstat:
         M src/ical.c                          |      22 +++++++++++++++-------
         M src/ical.h                          |       2 +-
       
       2 files changed, 16 insertions(+), 8 deletions(-)
       ---
   DIR diff --git a/src/ical.c b/src/ical.c
       @@ -130,19 +130,25 @@ err:
        }
        
        static void
       -ical_free_vnode_value(void *v)
       +ical_free_value_void(void *v)
        {
                ical_free_value(v);
        }
        
       +static void
       +ical_free_vnode_void(void *v)
       +{
       +        ical_free_vnode(v);
       +}
       +
        void
        ical_free_vnode(struct ical_vnode *node)
        {
                if (node == NULL)
                        return;
                debug("free vnode %p %s", node, node->name);
       -        map_free(&node->values, ical_free_vnode_value);
       -        ical_free_vnode(node->child);
       +        map_free(&node->values, ical_free_value_void);
       +        map_free(&node->child, ical_free_vnode_void);
                ical_free_vnode(node->next);
                free(node);
        }
       @@ -190,12 +196,14 @@ ical_begin_vnode(struct ical_vcalendar *vcal, char const *name)
                        goto err;
                if (vcal->root == NULL) {
                        vcal->root = new;
       -                vcal->current = new;
                } else {
       -                new->next = vcal->current->child;
       -                vcal->current->child = new;
       -                vcal->current = new;
       +                new->next = map_get(&vcal->current->child, new->name);
       +                if (map_set(&vcal->current->child, new->name, new) < 0) {
       +                        e = -ICAL_ERR_SYSTEM;
       +                        goto err;
       +                }
                }
       +        vcal->current = new;
                return 0;
        err:
                ical_free_vnode(new);
   DIR diff --git a/src/ical.h b/src/ical.h
       @@ -34,7 +34,7 @@ struct ical_vnode {
                char name[32];
                time_t beg, end;
                struct map values; /*(struct ical_value *)*/
       -        struct ical_vnode *child;
       +        struct map child; /*(struct ical_vnode *)*/
                struct ical_vnode *next;
        };