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/>.
32 #include "_quvi_script_s.h"
34 #include "misc/script_free.h"
35 #include "misc/slst.h"
38 extern void c_close(_quvi_t
);
41 /** @brief Free all of memory used by a library handle
42 @note If handle is NULL the function simply returns
43 @sa @ref getting_started
46 void quvi_free(quvi_t handle
)
48 _quvi_t q
= (_quvi_t
) handle
;
57 g_string_free(q
->opt
.user_agent
, TRUE
);
58 q
->opt
.user_agent
= NULL
;
60 g_string_free(q
->status
.errmsg
, TRUE
);
61 q
->status
.errmsg
= NULL
;
65 m_slist_free_full(q
->scripts
.subtitle_export
, m_script_free
);
66 q
->scripts
.subtitle_export
= NULL
;
68 m_slist_free_full(q
->scripts
.subtitle
, m_script_free
);
69 q
->scripts
.subtitle
= NULL
;
71 m_slist_free_full(q
->scripts
.playlist
, m_script_free
);
72 q
->scripts
.playlist
= NULL
;
74 m_slist_free_full(q
->scripts
.media
, m_script_free
);
75 q
->scripts
.media
= NULL
;
77 m_slist_free_full(q
->scripts
.scan
, m_script_free
);
78 q
->scripts
.scan
= NULL
;
80 m_slist_free_full(q
->scripts
.util
, m_script_free
);
81 q
->scripts
.util
= NULL
;
85 if (q
->handle
.lua
!= NULL
)
87 lua_close(q
->handle
.lua
);
91 if (q
->handle
.proxy
!= NULL
)
93 px_proxy_factory_free(q
->handle
.proxy
);
94 q
->handle
.proxy
= NULL
;
101 /* vim: set ts=2 sw=2 tw=72 expandtab: */