/src/neomutt/browser/private_data.c
Line | Count | Source (jump to first uncovered line) |
1 | | /** |
2 | | * @file |
3 | | * Private state data for the Browser |
4 | | * |
5 | | * @authors |
6 | | * Copyright (C) 2021 Richard Russon <rich@flatcap.org> |
7 | | * |
8 | | * @copyright |
9 | | * This program is free software: you can redistribute it and/or modify it under |
10 | | * the terms of the GNU General Public License as published by the Free Software |
11 | | * Foundation, either version 2 of the License, or (at your option) any later |
12 | | * version. |
13 | | * |
14 | | * This program is distributed in the hope that it will be useful, but WITHOUT |
15 | | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
16 | | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
17 | | * details. |
18 | | * |
19 | | * You should have received a copy of the GNU General Public License along with |
20 | | * this program. If not, see <http://www.gnu.org/licenses/>. |
21 | | */ |
22 | | |
23 | | /** |
24 | | * @page browser_private_data Private data for the Browser |
25 | | * |
26 | | * Private state data for the Browser |
27 | | */ |
28 | | |
29 | | #include "config.h" |
30 | | #include "mutt/lib.h" |
31 | | #include "private_data.h" |
32 | | #include "lib.h" |
33 | | |
34 | | /** |
35 | | * browser_private_data_free - Free Private Browser Data - Implements MuttWindow::wdata_free() - @ingroup window_wdata_free |
36 | | */ |
37 | | void browser_private_data_free(struct BrowserPrivateData **ptr) |
38 | 0 | { |
39 | 0 | if (!ptr || !*ptr) |
40 | 0 | return; |
41 | | |
42 | 0 | struct BrowserPrivateData *priv = *ptr; |
43 | |
|
44 | 0 | buf_pool_release(&priv->OldLastDir); |
45 | 0 | buf_pool_release(&priv->prefix); |
46 | 0 | destroy_state(&priv->state); |
47 | |
|
48 | 0 | FREE(ptr); |
49 | 0 | } |
50 | | |
51 | | /** |
52 | | * browser_private_data_new - Create new Browser Data |
53 | | * @retval ptr New BrowserPrivateData |
54 | | */ |
55 | | struct BrowserPrivateData *browser_private_data_new(void) |
56 | 0 | { |
57 | 0 | struct BrowserPrivateData *priv = mutt_mem_calloc(1, sizeof(struct BrowserPrivateData)); |
58 | |
|
59 | 0 | priv->OldLastDir = buf_pool_get(); |
60 | 0 | priv->prefix = buf_pool_get(); |
61 | |
|
62 | 0 | return priv; |
63 | 0 | } |