47 lines
1.6 KiB
C
47 lines
1.6 KiB
C
/* *****************************************************************************
|
|
* core/free.c -- free elements of a handle.
|
|
* 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/>.
|
|
*
|
|
* TODO: dispatch this file into sources in the `manage` module!
|
|
* ************************************************************************** */
|
|
#include <libg1m/internals.h>
|
|
#include <stdlib.h>
|
|
|
|
/**
|
|
* g1m_free_line_content:
|
|
* Free an e-activity line content.
|
|
*
|
|
* @arg handle the line handle.
|
|
*/
|
|
|
|
void g1m_free_line_content(g1m_line_t *line)
|
|
{
|
|
int i;
|
|
|
|
if (line->g1m_line_type & (g1m_linetype_title | g1m_linetype_text
|
|
| g1m_linetype_picture))
|
|
free(line->g1m_line_content);
|
|
|
|
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]);
|
|
}
|
|
free(line->g1m_line_lines);
|
|
}
|
|
}
|