]> glassweightruler.freedombox.rocks Git - Ventoy.git/blob - SQUASHFS/squashfs-tools-4.4/squashfs-tools/unsquash-34.c
keep up with 1.0.67 (#1464)
[Ventoy.git] / SQUASHFS / squashfs-tools-4.4 / squashfs-tools / unsquash-34.c
1 /*
2 * Unsquash a squashfs filesystem. This is a highly compressed read only
3 * filesystem.
4 *
5 * Copyright (c) 2019
6 * Phillip Lougher <phillip@squashfs.org.uk>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2,
11 * or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 *
22 * unsquash-34.c
23 *
24 * Helper functions used by unsquash-3 and unsquash-4.
25 */
26
27 #include "unsquashfs.h"
28
29 long long *alloc_index_table(int indexes)
30 {
31 static long long *alloc_table = NULL;
32 static int alloc_size = 0;
33 int length = indexes * sizeof(long long);
34
35 if(alloc_size < length || length == 0) {
36 long long *table = realloc(alloc_table, length);
37
38 if(table == NULL && length !=0)
39 EXIT_UNSQUASH("alloc_index_table: failed to allocate "
40 "index table\n");
41
42 alloc_table = table;
43 alloc_size = length;
44 }
45
46 return alloc_table;
47 }