1 |
vapier 13/09/29 10:01:55 |
2 |
|
3 |
Modified: qdepends.c |
4 |
Log: |
5 |
qdepends: pass back an empty node when parsing is OK so -f can exit appropriately |
6 |
|
7 |
Revision Changes Path |
8 |
1.61 portage-utils/qdepends.c |
9 |
|
10 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qdepends.c?rev=1.61&view=markup |
11 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qdepends.c?rev=1.61&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qdepends.c?r1=1.60&r2=1.61 |
13 |
|
14 |
Index: qdepends.c |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-projects/portage-utils/qdepends.c,v |
17 |
retrieving revision 1.60 |
18 |
retrieving revision 1.61 |
19 |
diff -u -r1.60 -r1.61 |
20 |
--- qdepends.c 29 Sep 2013 09:14:14 -0000 1.60 |
21 |
+++ qdepends.c 29 Sep 2013 10:01:55 -0000 1.61 |
22 |
@@ -1,10 +1,10 @@ |
23 |
/* |
24 |
- * Copyright 2005-2010 Gentoo Foundation |
25 |
+ * Copyright 2005-2013 Gentoo Foundation |
26 |
* Distributed under the terms of the GNU General Public License v2 |
27 |
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/qdepends.c,v 1.60 2013/09/29 09:14:14 vapier Exp $ |
28 |
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qdepends.c,v 1.61 2013/09/29 10:01:55 vapier Exp $ |
29 |
* |
30 |
* Copyright 2005-2010 Ned Ludd - <solar@g.o> |
31 |
- * Copyright 2005-2010 Mike Frysinger - <vapier@g.o> |
32 |
+ * Copyright 2005-2013 Mike Frysinger - <vapier@g.o> |
33 |
*/ |
34 |
|
35 |
#ifdef APPLET_qdepends |
36 |
@@ -32,7 +32,7 @@ |
37 |
"Pretty format specified depend strings", |
38 |
COMMON_OPTS_HELP |
39 |
}; |
40 |
-static const char qdepends_rcsid[] = "$Id: qdepends.c,v 1.60 2013/09/29 09:14:14 vapier Exp $"; |
41 |
+static const char qdepends_rcsid[] = "$Id: qdepends.c,v 1.61 2013/09/29 10:01:55 vapier Exp $"; |
42 |
#define qdepends_usage(ret) usage(ret, QDEPENDS_FLAGS, qdepends_long_opts, qdepends_opts_help, lookup_applet_idx("qdepends")) |
43 |
|
44 |
static char qdep_name_only = 0; |
45 |
@@ -58,6 +58,10 @@ |
46 |
}; |
47 |
typedef struct _dep_node dep_node; |
48 |
|
49 |
+static const dep_node null_node = { |
50 |
+ .type = DEP_NULL, |
51 |
+}; |
52 |
+ |
53 |
/* prototypes */ |
54 |
#ifdef NDEBUG |
55 |
# define dep_dump_tree(r) |
56 |
@@ -246,7 +250,7 @@ |
57 |
|
58 |
#undef _maybe_consume_word |
59 |
|
60 |
- return ret; |
61 |
+ return ret ? : xmemdup(&null_node, sizeof(null_node)); |
62 |
|
63 |
error_out: |
64 |
warnf("DEPEND: %s", depend); |
65 |
@@ -294,11 +298,13 @@ |
66 |
_dep_print_tree(fp, root->neighbor, space); |
67 |
} |
68 |
|
69 |
-_q_static void dep_print_depend(FILE *fp, const char *depend) |
70 |
+_q_static bool dep_print_depend(FILE *fp, const char *depend) |
71 |
{ |
72 |
- dep_node *dep_tree = dep_grow_tree(depend); |
73 |
+ dep_node *dep_tree; |
74 |
+ |
75 |
+ dep_tree = dep_grow_tree(depend); |
76 |
if (dep_tree == NULL) |
77 |
- return; |
78 |
+ return false; |
79 |
|
80 |
if (!quiet) |
81 |
fprintf(fp, "DEPEND=\"\n"); |
82 |
@@ -308,6 +314,8 @@ |
83 |
dep_burn_tree(dep_tree); |
84 |
if (!quiet) |
85 |
fprintf(fp, "\"\n"); |
86 |
+ |
87 |
+ return true; |
88 |
} |
89 |
|
90 |
void dep_burn_tree(dep_node *root) |
91 |
@@ -545,7 +553,8 @@ |
92 |
|
93 |
if (do_format) { |
94 |
while (optind < argc) { |
95 |
- dep_print_depend(stdout, argv[optind++]); |
96 |
+ if (!dep_print_depend(stdout, argv[optind++])) |
97 |
+ return EXIT_FAILURE; |
98 |
if (optind < argc) |
99 |
fprintf(stdout, "\n"); |
100 |
} |