]> git.ipfire.org Git - thirdparty/lldpd.git/commit - src/marshal.h
marshal: fix list marshalling and various other changes
authorVincent Bernat <bernat@luffy.cx>
Mon, 23 Jan 2012 18:55:49 +0000 (19:55 +0100)
committerVincent Bernat <bernat@luffy.cx>
Mon, 23 Jan 2012 18:55:49 +0000 (19:55 +0100)
commit6bf5e749dffa8ef2269f4578c7819676ffd9a282
tree2c4fc37165712bee34115d7fcc8109553b8cc864
parent4d1a5b3910987ae2498b7fb1eefe19876f6579a9
marshal: fix list marshalling and various other changes

Since last element and previous element are a pointer to a pointer, we
should handle this case differently. Unit tests are not failing
because the original memory space is still available on the stack. We
just ignore last and previous. This still allows to use the list for
the most useful operations: TAILQ_EMPTY, TAILQ_FOREACH and
TAILQ_REMOVE. We can't use TAILQ_INSERT_TAIL!

Another important change is that by default, macros will declare an
external structure. MARSHAL_EXPORT variable should be defined only for
one module. Otherwise, marshal structures will be defined several
times.

We also rename `_marshal_*` to `marshal_*_`. This enables more
graceful logging messages.
src/marshal.c
src/marshal.h
tests/check_marshal.c