2017-02-24 02:29:56 +01:00
|
|
|
/* *****************************************************************************
|
2017-02-26 13:04:01 +01:00
|
|
|
* core/free.c -- free elements of a handle.
|
2017-02-24 02:29:56 +01:00
|
|
|
* Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
|
|
|
|
*
|
|
|
|
* This file is part of libg1m.
|
|
|
|
* libg1m is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU Lesser General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3.0 of the License,
|
|
|
|
* or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* libg1m is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
* See the GNU Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* along with libg1m; if not, see <http://www.gnu.org/licenses/>.
|
2017-03-19 23:27:21 +01:00
|
|
|
*
|
|
|
|
* TODO: dispatch this file into sources in the `manage` module!
|
2017-02-24 02:29:56 +01:00
|
|
|
* ************************************************************************** */
|
2016-11-21 10:26:52 +01:00
|
|
|
#include <libg1m/internals.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2016-12-13 03:28:28 +01:00
|
|
|
/**
|
|
|
|
* g1m_free_line_content:
|
|
|
|
* Free an e-activity line content.
|
|
|
|
*
|
|
|
|
* @arg handle the line handle.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void g1m_free_line_content(g1m_line_t *line)
|
|
|
|
{
|
2017-03-25 19:04:50 +01:00
|
|
|
int i;
|
|
|
|
|
2017-04-13 00:18:10 +02:00
|
|
|
if (line->g1m_line_type & (g1m_linetype_title | g1m_linetype_text
|
2016-12-13 03:28:28 +01:00
|
|
|
| g1m_linetype_picture))
|
2017-04-13 00:18:10 +02:00
|
|
|
free(line->g1m_line_content);
|
2016-12-13 03:28:28 +01:00
|
|
|
|
2017-04-13 00:18:10 +02:00
|
|
|
if (line->g1m_line_type & g1m_linetype_eact) {
|
|
|
|
for (i = 0; i < line->g1m_line_count; i++) {
|
|
|
|
g1m_free_line_content(line->g1m_line_lines[i]);
|
|
|
|
free(line->g1m_line_lines[i]);
|
2016-12-13 03:28:28 +01:00
|
|
|
}
|
2017-04-13 00:18:10 +02:00
|
|
|
free(line->g1m_line_lines);
|
2016-12-13 03:28:28 +01:00
|
|
|
}
|
|
|
|
}
|