From ce0ae5d0654eedf0244bbded2e467dcadf324c0c Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Thu, 27 Mar 2014 00:17:35 +0100 Subject: [PATCH] Added a variable_new_deserialize_buffer() function --- include/System/variable.h | 4 +++- src/variable.c | 12 +++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/include/System/variable.h b/include/System/variable.h index 3bcd24c..655c9ed 100644 --- a/include/System/variable.h +++ b/include/System/variable.h @@ -1,5 +1,5 @@ /* $Id$ */ -/* Copyright (c) 2012-2013 Pierre Pronchery */ +/* Copyright (c) 2012-2014 Pierre Pronchery */ /* This file is part of DeforaOS System libSystem */ /* This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -50,6 +50,8 @@ typedef enum _VariableType Variable * variable_new(VariableType type, void * value); Variable * variable_new_copy(Variable * variable); Variable * variable_new_deserialize(size_t * size, char const * data); +Variable * variable_new_deserialize_buffer(size_t * size, + Buffer const * buffer); Variable * variable_new_deserialize_type(VariableType type, size_t * size, char const * data); void variable_delete(Variable * variable); diff --git a/src/variable.c b/src/variable.c index 338369e..7dc227a 100644 --- a/src/variable.c +++ b/src/variable.c @@ -1,5 +1,5 @@ /* $Id$ */ -/* Copyright (c) 2012-2013 Pierre Pronchery */ +/* Copyright (c) 2012-2014 Pierre Pronchery */ /* This file is part of DeforaOS System libSystem */ /* This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -229,6 +229,16 @@ Variable * variable_new_deserialize(size_t * size, char const * data) } +/* variable_new_deserialize_buffer */ +Variable * variable_new_deserialize_buffer(size_t * size, Buffer const * buffer) +{ + char const * data; + + data = buffer_get_data(buffer); + return variable_new_deserialize(size, data); +} + + /* variable_new_deserialize_type */ Variable * variable_new_deserialize_type(VariableType type, size_t * size, char const * data)