Add misc/url.* with m_url_(un)escaped_form
[libquvi.git] / src / api / scan_free.c
blobd5b2d27ebdcf45b797a8016710e9ed019dfb2043
1 /* libquvi
2 * Copyright (C) 2012-2013 Toni Gundogdu <legatvs@gmail.com>
4 * This file is part of libquvi <http://quvi.sourceforge.net/>.
6 * This library is free software: you can redistribute it and/or
7 * modify it under the terms of the GNU Affero General Public
8 * License as published by the Free Software Foundation, either
9 * version 3 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General
17 * Public License along with this library. If not, see
18 * <http://www.gnu.org/licenses/>.
21 /** @file scan_free.c */
23 #include "config.h"
25 #include <glib.h>
27 #include "quvi.h"
28 /* -- */
29 #include "_quvi_s.h"
30 #include "_quvi_scan_s.h"
31 /* -- */
32 #include "misc/slst.h"
34 static void _url_free(gpointer p, gpointer userdata)
36 if (p == NULL)
37 return;
39 g_free(p);
40 p = NULL;
43 /** @brief Free all of memory used by a scan handle
44 @note If handle is NULL the function simply returns
45 @sa @ref scan_media
46 @ingroup scan
48 void quvi_scan_free(quvi_scan_t handle)
50 _quvi_scan_t qs = (_quvi_scan_t) handle;
52 if (handle == NULL)
53 return;
55 /* URLs */
57 m_slist_free_full(qs->url.media, _url_free);
58 qs->url.media = NULL;
60 g_string_free(qs->url.input, TRUE);
61 qs->url.input = NULL;
63 g_free(qs);
64 qs = NULL;
67 /* vim: set ts=2 sw=2 tw=72 expandtab: */