1 |
vapier 11/02/24 01:29:27 |
2 |
|
3 |
Modified: virtuals.c |
4 |
Log: |
5 |
use a proper linked list structure for the package todo rather than building up and breaking down strings all the time |
6 |
|
7 |
Revision Changes Path |
8 |
1.25 portage-utils/libq/virtuals.c |
9 |
|
10 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/libq/virtuals.c?rev=1.25&view=markup |
11 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/libq/virtuals.c?rev=1.25&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/libq/virtuals.c?r1=1.24&r2=1.25 |
13 |
|
14 |
Index: virtuals.c |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-projects/portage-utils/libq/virtuals.c,v |
17 |
retrieving revision 1.24 |
18 |
retrieving revision 1.25 |
19 |
diff -u -r1.24 -r1.25 |
20 |
--- virtuals.c 21 Feb 2011 07:33:22 -0000 1.24 |
21 |
+++ virtuals.c 24 Feb 2011 01:29:27 -0000 1.25 |
22 |
@@ -1,12 +1,12 @@ |
23 |
/* |
24 |
* Copyright 2005-2010 Gentoo Foundation |
25 |
* Distributed under the terms of the GNU General Public License v2 |
26 |
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/libq/virtuals.c,v 1.24 2011/02/21 07:33:22 vapier Exp $ |
27 |
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/libq/virtuals.c,v 1.25 2011/02/24 01:29:27 vapier Exp $ |
28 |
* |
29 |
* Copyright 2005-2010 Ned Ludd - <solar@g.o> |
30 |
* Copyright 2005-2010 Mike Frysinger - <vapier@g.o> |
31 |
* |
32 |
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/libq/virtuals.c,v 1.24 2011/02/21 07:33:22 vapier Exp $ |
33 |
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/libq/virtuals.c,v 1.25 2011/02/24 01:29:27 vapier Exp $ |
34 |
*/ |
35 |
|
36 |
#include <stdio.h> |
37 |
@@ -31,10 +31,25 @@ |
38 |
|
39 |
/* void free_virtuals(queue *list); */ |
40 |
|
41 |
+static queue *append_set(queue *q, queue *ll) |
42 |
+{ |
43 |
+ queue *z; |
44 |
+ |
45 |
+ if (!q) |
46 |
+ return ll; |
47 |
+ |
48 |
+ z = q; |
49 |
+ while (z->next) |
50 |
+ z = z->next; |
51 |
+ z->next = ll; |
52 |
+ |
53 |
+ return q; |
54 |
+} |
55 |
+ |
56 |
/* add a set to a cache */ |
57 |
queue *add_set(const char *vv, const char *ss, queue *q) |
58 |
{ |
59 |
- queue *ll, *z; |
60 |
+ queue *ll; |
61 |
char *s, *ptr; |
62 |
char *v, *vptr; |
63 |
|
64 |
@@ -58,14 +73,7 @@ |
65 |
strcpy(ll->item, s); |
66 |
strcpy(ll->name, v); |
67 |
|
68 |
- if (q == NULL) |
69 |
- q = ll; |
70 |
- else { |
71 |
- z = q; |
72 |
- while (z->next != NULL) |
73 |
- z = z->next; |
74 |
- z->next = ll; |
75 |
- } |
76 |
+ q = append_set(q, ll); |
77 |
|
78 |
*v = 0; |
79 |
strcpy(v, vptr); |