From 073faa7aeca239e2bf5422f6961241009a080f4e Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 28 Apr 2014 18:06:58 +0200 Subject: add version when marshaling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/libmdsserver/linked-list.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/libmdsserver/linked-list.c') diff --git a/src/libmdsserver/linked-list.c b/src/libmdsserver/linked-list.c index 916eaf9..601bda0 100644 --- a/src/libmdsserver/linked-list.c +++ b/src/libmdsserver/linked-list.c @@ -430,7 +430,7 @@ void linked_list_remove(linked_list_t* restrict this, ssize_t node) */ size_t linked_list_marshal_size(const linked_list_t* restrict this) { - return sizeof(size_t) * (4 + this->reuse_head + 3 * this->end); + return sizeof(size_t) * (4 + this->reuse_head + 3 * this->end) + sizeof(int); } @@ -442,6 +442,9 @@ size_t linked_list_marshal_size(const linked_list_t* restrict this) */ void linked_list_marshal(const linked_list_t* restrict this, char* restrict data) { + ((int*)data)[0] = LINKED_LIST_T_VERSION; + data += sizeof(int) / sizeof(char); + ((size_t*)data)[0] = this->capacity; ((size_t*)data)[1] = this->end; ((size_t*)data)[2] = this->reuse_head; @@ -473,6 +476,9 @@ int linked_list_unmarshal(linked_list_t* restrict this, char* restrict data) { size_t n; + /* ((int*)data)[0] == LINKED_LIST_T_VERSION */ + data += sizeof(int) / sizeof(char); + this->reusable = NULL; this->values = NULL; this->next = NULL; -- cgit v1.2.3-70-g09d2