aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-04-13 13:32:16 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-04-13 13:32:16 +0000
commit6b4377f3337d7d3e21e63aa1341d33fd51c2f97c (patch)
tree6dbc501701a7fc5d1f2e62e6c5cba3fb44af8174
parentc2cb0f32b44a9918364af39c24b5643388c553f6 (diff)
downloadbusybox-w32-6b4377f3337d7d3e21e63aa1341d33fd51c2f97c.tar.gz
busybox-w32-6b4377f3337d7d3e21e63aa1341d33fd51c2f97c.tar.bz2
busybox-w32-6b4377f3337d7d3e21e63aa1341d33fd51c2f97c.zip
- remove unneeded include, use shorter boilerplate while at it and also
shrink filter_accept_reject_list() a tiny bit while at it. text data bss dec hex filename 59 0 0 59 3b filter_accept_reject_list.o 62 0 0 62 3e filter_accept_reject_list.o.orig
-rw-r--r--archival/libunarchive/filter_accept_all.c19
-rw-r--r--archival/libunarchive/filter_accept_list.c19
-rw-r--r--archival/libunarchive/filter_accept_reject_list.c24
-rw-r--r--archival/libunarchive/find_list_entry.c18
4 files changed, 17 insertions, 63 deletions
diff --git a/archival/libunarchive/filter_accept_all.c b/archival/libunarchive/filter_accept_all.c
index bf5d8aaa9..e2ff06d51 100644
--- a/archival/libunarchive/filter_accept_all.c
+++ b/archival/libunarchive/filter_accept_all.c
@@ -1,24 +1,11 @@
1/* vi: set sw=4 ts=4: */
1/* 2/*
2 * Copyright (C) 2002 by Glenn McGrath 3 * Copyright (C) 2002 by Glenn McGrath
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify 5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */ 6 */
18 7
19#include <fnmatch.h>
20#include <stdlib.h> 8#include <stdlib.h>
21
22#include "unarchive.h" 9#include "unarchive.h"
23 10
24/* Accept any non-null name, its not really a filter at all */ 11/* Accept any non-null name, its not really a filter at all */
diff --git a/archival/libunarchive/filter_accept_list.c b/archival/libunarchive/filter_accept_list.c
index bedd0e178..253021a86 100644
--- a/archival/libunarchive/filter_accept_list.c
+++ b/archival/libunarchive/filter_accept_list.c
@@ -1,24 +1,11 @@
1/* vi: set sw=4 ts=4: */
1/* 2/*
2 * Copyright (C) 2002 by Glenn McGrath 3 * Copyright (C) 2002 by Glenn McGrath
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify 5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */ 6 */
18 7
19#include <fnmatch.h>
20#include <stdlib.h> 8#include <stdlib.h>
21
22#include "unarchive.h" 9#include "unarchive.h"
23 10
24/* 11/*
diff --git a/archival/libunarchive/filter_accept_reject_list.c b/archival/libunarchive/filter_accept_reject_list.c
index 1ac414675..be56a446f 100644
--- a/archival/libunarchive/filter_accept_reject_list.c
+++ b/archival/libunarchive/filter_accept_reject_list.c
@@ -1,24 +1,11 @@
1/* vi: set sw=4 ts=4: */
1/* 2/*
2 * Copyright (C) 2002 by Glenn McGrath 3 * Copyright (C) 2002 by Glenn McGrath
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify 5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */ 6 */
18 7
19#include <fnmatch.h>
20#include <stdlib.h> 8#include <stdlib.h>
21
22#include "unarchive.h" 9#include "unarchive.h"
23 10
24/* 11/*
@@ -27,16 +14,17 @@
27char filter_accept_reject_list(archive_handle_t *archive_handle) 14char filter_accept_reject_list(archive_handle_t *archive_handle)
28{ 15{
29 const char *key = archive_handle->file_header->name; 16 const char *key = archive_handle->file_header->name;
30 const llist_t *accept_entry = find_list_entry(archive_handle->accept, key);
31 const llist_t *reject_entry = find_list_entry(archive_handle->reject, key); 17 const llist_t *reject_entry = find_list_entry(archive_handle->reject, key);
18 const llist_t *accept_entry;
32 19
33 /* If the key is in a reject list fail */ 20 /* If the key is in a reject list fail */
34 if (reject_entry) { 21 if (reject_entry) {
35 return(EXIT_FAILURE); 22 return(EXIT_FAILURE);
36 } 23 }
24 accept_entry = find_list_entry(archive_handle->accept, key);
37 25
38 /* Fail if an accept list was specified and the key wasnt in there */ 26 /* Fail if an accept list was specified and the key wasnt in there */
39 if (archive_handle->accept && (accept_entry == NULL)) { 27 if ((accept_entry == NULL) && archive_handle->accept) {
40 return(EXIT_FAILURE); 28 return(EXIT_FAILURE);
41 } 29 }
42 30
diff --git a/archival/libunarchive/find_list_entry.c b/archival/libunarchive/find_list_entry.c
index d14e51aa7..49bdd2d09 100644
--- a/archival/libunarchive/find_list_entry.c
+++ b/archival/libunarchive/find_list_entry.c
@@ -1,28 +1,20 @@
1/* vi: set sw=4 ts=4: */
1/* 2/*
2 * This program is free software; you can redistribute it and/or modify 3 * Copyright (C) 2002 by Glenn McGrath
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 * 4 *
7 * This program is distributed in the hope that it will be useful, 5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 */ 6 */
16 7
17#include <fnmatch.h> 8#include <fnmatch.h>
18#include <stdlib.h> 9#include <stdlib.h>
19#include "unarchive.h" 10#include "unarchive.h"
20 11
12/* Find a string in a list */
21const llist_t *find_list_entry(const llist_t *list, const char *filename) 13const llist_t *find_list_entry(const llist_t *list, const char *filename)
22{ 14{
23 while (list) { 15 while (list) {
24 if (fnmatch(list->data, filename, 0) == 0) { 16 if (fnmatch(list->data, filename, 0) == 0) {
25 return(list); 17 return (list);
26 } 18 }
27 list = list->link; 19 list = list->link;
28 } 20 }