Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/bash/src/lib/sh/stringlist.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
4 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
5 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
6 | STRINGLIST * | - | ||||||||||||||||||||||||||||||||||||||||||||||||
7 | strlist_create (n) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
8 | int n; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
9 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
10 | STRINGLIST *ret; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
11 | register int i; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
12 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
13 | ret = (STRINGLIST *)sh_xmalloc((sizeof (STRINGLIST)), "stringlist.c", 46); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
14 | if (n
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
15 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
16 | ret->list = strvec_create (n+1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
17 | ret->list_size = n; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
18 | for (i = 0; i < n
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
19 | ret->list[i] = (char *) never executed: ret->list[i] = (char *) ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
20 | ((void *)0) never executed: ret->list[i] = (char *) ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
21 | ; never executed: ret->list[i] = (char *) ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
22 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
23 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
24 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
25 | ret->list = (char **) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
26 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
27 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
28 | ret->list_size = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
29 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
30 | ret->list_len = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
31 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
32 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
33 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
34 | STRINGLIST * | - | ||||||||||||||||||||||||||||||||||||||||||||||||
35 | strlist_resize (sl, n) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
36 | STRINGLIST *sl; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
37 | int n; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
38 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
39 | register int i; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
40 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
41 | if (sl == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
42 | return never executed: (sl = strlist_create (n));return (sl = strlist_create (n)); never executed: return (sl = strlist_create (n)); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
43 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
44 | if (n > sl->list_size
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
45 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
46 | sl->list = strvec_resize (sl->list, n + 1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
47 | for (i = sl->list_size; i <= n
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
48 | sl->list[i] = (char *) never executed: sl->list[i] = (char *) ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
49 | ((void *)0) never executed: sl->list[i] = (char *) ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
50 | ; never executed: sl->list[i] = (char *) ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
51 | sl->list_size = n; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
52 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
53 | return never executed: sl;return sl; never executed: return sl; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
54 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
55 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
56 | void | - | ||||||||||||||||||||||||||||||||||||||||||||||||
57 | strlist_flush (sl) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
58 | STRINGLIST *sl; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
59 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
60 | if (sl == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
61 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
62 | strvec_flush (sl->list); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
63 | sl->list_len = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
64 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
65 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
66 | void | - | ||||||||||||||||||||||||||||||||||||||||||||||||
67 | strlist_dispose (sl) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
68 | STRINGLIST *sl; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
69 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
70 | if (sl == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
71 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
72 | if (sl->list
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
73 | strvec_dispose (sl->list); never executed: strvec_dispose (sl->list); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
74 | sh_xfree((sl), "stringlist.c", 101); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
75 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
76 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
77 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||
78 | strlist_remove (sl, s) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
79 | STRINGLIST *sl; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
80 | char *s; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
81 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
82 | int r; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
83 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
84 | if (sl == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
85 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
86 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
87 | r = strvec_remove (sl->list, s); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
88 | if (r
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
89 | sl->list_len--; never executed: sl->list_len--; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
90 | return never executed: r;return r; never executed: return r; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
91 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
92 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
93 | STRINGLIST * | - | ||||||||||||||||||||||||||||||||||||||||||||||||
94 | strlist_copy (sl) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
95 | STRINGLIST *sl; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
96 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
97 | STRINGLIST *new; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
98 | register int i; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
99 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
100 | if (sl == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
101 | return never executed: ((STRINGLIST *)0);return ((STRINGLIST *)0); never executed: return ((STRINGLIST *)0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
102 | new = strlist_create (sl->list_size); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
103 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
104 | if (sl->list
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
105 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
106 | for (i = 0; i < sl->list_size
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
107 | new-> never executed: list[i] = ((new->list[i] = ((sl->list[i]) ? (char *)strcpy (sh_xmalloc((1 + strlen (sl->list[i])), "stringlist.c", 134), (sl->list[i])) : (char *) ((void *)0) );
never executed: new->list[i] = ((sl->list[i]) ? (char *)strcpy (sh_xmalloc((1 + strlen (sl->list[i])), "stringlist.c", 134), (sl->list[i])) : (char *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
108 | ((void *)0) never executed: new->list[i] = ((sl->list[i]) ? (char *)strcpy (sh_xmalloc((1 + strlen (sl->list[i])), "stringlist.c", 134), (sl->list[i])) : (char *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
109 | ); never executed: new->list[i] = ((sl->list[i]) ? (char *)strcpy (sh_xmalloc((1 + strlen (sl->list[i])), "stringlist.c", 134), (sl->list[i])) : (char *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
110 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
111 | new->list_size = sl->list_size; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
112 | new->list_len = sl->list_len; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
113 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
114 | if (new->
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
115 | new-> never executed: list[new->list_len] = (char *)new->list[new->list_len] = (char *) ((void *)0) ; never executed: new->list[new->list_len] = (char *) ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
116 | ((void *)0) never executed: new->list[new->list_len] = (char *) ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
117 | ; never executed: new->list[new->list_len] = (char *) ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
118 | return never executed: new;return new; never executed: return new; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
119 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
120 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
121 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
122 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
123 | STRINGLIST * | - | ||||||||||||||||||||||||||||||||||||||||||||||||
124 | strlist_merge (m1, m2) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
125 | STRINGLIST *m1, *m2; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
126 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
127 | STRINGLIST *sl; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
128 | int i, n, l1, l2; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
129 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
130 | l1 = m1
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
131 | l2 = m2
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
132 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
133 | sl = strlist_create (l1 + l2 + 1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
134 | for (i = n = 0; i < l1
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
135 | sl->list[n] = ((
never executed: sl->list[n] = ((m1->list[i]) ? (char *)strcpy (sh_xmalloc((1 + strlen (m1->list[i])), "stringlist.c", 158), (m1->list[i])) : (char *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
136 | ((void *)0) never executed: sl->list[n] = ((m1->list[i]) ? (char *)strcpy (sh_xmalloc((1 + strlen (m1->list[i])), "stringlist.c", 158), (m1->list[i])) : (char *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
137 | ); never executed: sl->list[n] = ((m1->list[i]) ? (char *)strcpy (sh_xmalloc((1 + strlen (m1->list[i])), "stringlist.c", 158), (m1->list[i])) : (char *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
138 | for (i = 0; i < l2
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
139 | sl->list[n] = ((
never executed: sl->list[n] = ((m2->list[i]) ? (char *)strcpy (sh_xmalloc((1 + strlen (m2->list[i])), "stringlist.c", 160), (m2->list[i])) : (char *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
140 | ((void *)0) never executed: sl->list[n] = ((m2->list[i]) ? (char *)strcpy (sh_xmalloc((1 + strlen (m2->list[i])), "stringlist.c", 160), (m2->list[i])) : (char *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
141 | ); never executed: sl->list[n] = ((m2->list[i]) ? (char *)strcpy (sh_xmalloc((1 + strlen (m2->list[i])), "stringlist.c", 160), (m2->list[i])) : (char *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
142 | sl->list_len = n; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
143 | sl->list[n] = (char *) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
144 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
145 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
146 | return never executed: (sl);return (sl); never executed: return (sl); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
147 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
148 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
149 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
150 | STRINGLIST * | - | ||||||||||||||||||||||||||||||||||||||||||||||||
151 | strlist_append (m1, m2) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
152 | STRINGLIST *m1, *m2; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
153 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
154 | register int i, n, len1, len2; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
155 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
156 | if (m1 == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
157 | return never executed: (m2 ? strlist_copy (m2) : (STRINGLIST *)0);return (m2 ? strlist_copy (m2) : (STRINGLIST *)0); never executed: return (m2 ? strlist_copy (m2) : (STRINGLIST *)0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
158 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
159 | len1 = m1->list_len; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
160 | len2 = m2
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
161 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
162 | if (len2
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
163 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
164 | m1 = strlist_resize (m1, len1 + len2 + 1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
165 | for (i = 0, n = len1; i < len2
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
166 | m1->list[n] = ((
never executed: m1->list[n] = ((m2->list[i]) ? (char *)strcpy (sh_xmalloc((1 + strlen (m2->list[i])), "stringlist.c", 183), (m2->list[i])) : (char *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
167 | ((void *)0) never executed: m1->list[n] = ((m2->list[i]) ? (char *)strcpy (sh_xmalloc((1 + strlen (m2->list[i])), "stringlist.c", 183), (m2->list[i])) : (char *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
168 | ); never executed: m1->list[n] = ((m2->list[i]) ? (char *)strcpy (sh_xmalloc((1 + strlen (m2->list[i])), "stringlist.c", 183), (m2->list[i])) : (char *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
169 | m1->list[n] = (char *) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
170 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
171 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
172 | m1->list_len = n; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
173 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
174 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
175 | return never executed: m1;return m1; never executed: return m1; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
176 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
177 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
178 | STRINGLIST * | - | ||||||||||||||||||||||||||||||||||||||||||||||||
179 | strlist_prefix_suffix (sl, prefix, suffix) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
180 | STRINGLIST *sl; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
181 | char *prefix, *suffix; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
182 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
183 | int plen, slen, tlen, llen, i; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
184 | char *t; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
185 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
186 | if (sl == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
187 | return never executed: sl;return sl; never executed: return sl; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
188 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
189 | plen = (((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
190 | slen = (((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
191 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
192 | if (plen == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
193 | return never executed: (sl);return (sl); never executed: return (sl); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
194 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
195 | for (i = 0; i < sl->list_len
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
196 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
197 | llen = (((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
198 | tlen = plen + llen + slen + 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
199 | t = (char *)sh_xmalloc((tlen + 1), "stringlist.c", 212); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
200 | if (plen
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
201 | strcpy (t, prefix); never executed: strcpy (t, prefix); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
202 | strcpy (t + plen, sl->list[i]); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
203 | if (slen
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
204 | strcpy (t + plen + llen, suffix); never executed: strcpy (t + plen + llen, suffix); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
205 | sh_xfree((sl->list[i]), "stringlist.c", 218); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
206 | sl->list[i] = t; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
207 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
208 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
209 | return never executed: (sl);return (sl); never executed: return (sl); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
210 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
211 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
212 | void | - | ||||||||||||||||||||||||||||||||||||||||||||||||
213 | strlist_print (sl, prefix) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
214 | STRINGLIST *sl; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
215 | char *prefix; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
216 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
217 | register int i; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
218 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
219 | if (sl == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
220 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
221 | for (i = 0; i < sl->list_len
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
222 | printf ("%s%s\n", prefix ? prefix : "", sl->list[i]); never executed: printf ("%s%s\n", prefix ? prefix : "", sl->list[i]); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
223 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
224 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
225 | void | - | ||||||||||||||||||||||||||||||||||||||||||||||||
226 | strlist_walk (sl, func) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
227 | STRINGLIST *sl; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
228 | sh_strlist_map_func_t *func; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
229 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
230 | register int i; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
231 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
232 | if (sl == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
233 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
234 | for (i = 0; i < sl->list_len
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
235 | if ((*
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
236 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
237 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
238 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
239 | void | - | ||||||||||||||||||||||||||||||||||||||||||||||||
240 | strlist_sort (sl) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
241 | STRINGLIST *sl; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
242 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
243 | if (sl == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
244 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
245 | strvec_sort (sl->list); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
246 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
247 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
248 | STRINGLIST * | - | ||||||||||||||||||||||||||||||||||||||||||||||||
249 | strlist_from_word_list (list, alloc, starting_index, ip) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
250 | WORD_LIST *list; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
251 | int alloc, starting_index, *ip; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
252 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
253 | STRINGLIST *ret; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
254 | int slen, len; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
255 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
256 | if (list == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
257 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
258 | if (ip
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
259 | * never executed: ip = 0;*ip = 0; never executed: *ip = 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
260 | return never executed: ((STRINGLIST *)0);return ((STRINGLIST *)0); never executed: return ((STRINGLIST *)0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
261 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
262 | slen = list_length (list); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
263 | ret = (STRINGLIST *)sh_xmalloc((sizeof (STRINGLIST)), "stringlist.c", 276); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
264 | ret->list = strvec_from_word_list (list, alloc, starting_index, &len); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
265 | ret->list_size = slen + starting_index; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
266 | ret->list_len = len; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
267 | if (ip
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
268 | * never executed: ip = len;*ip = len; never executed: *ip = len; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
269 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
270 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
271 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
272 | WORD_LIST * | - | ||||||||||||||||||||||||||||||||||||||||||||||||
273 | strlist_to_word_list (sl, alloc, starting_index) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
274 | STRINGLIST *sl; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
275 | int alloc, starting_index; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
276 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
277 | WORD_LIST *list; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
278 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
279 | if (sl == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
280 | return never executed: ((WORD_LIST *)return ((WORD_LIST *) ((void *)0) ); never executed: return ((WORD_LIST *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
281 | ((void *)0) never executed: return ((WORD_LIST *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
282 | ); never executed: return ((WORD_LIST *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
283 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
284 | list = strvec_to_word_list (sl->list, alloc, starting_index); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
285 | return never executed: list;return list; never executed: return list; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
286 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
Switch to Source code | Preprocessed file |