Lines Matching refs:array

35 /* Allocate an array of strings with room for N members. */
44 strvec_resize (array, nsize)
45 char **array;
48 return ((char **)xrealloc (array, nsize * sizeof (char *)));
51 /* Return the length of ARRAY, a NULL terminated array of char *. */
53 strvec_len (array)
54 char **array;
58 for (i = 0; array[i]; i++);
62 /* Free the contents of ARRAY, a NULL terminated array of char *. */
64 strvec_flush (array)
65 char **array;
69 if (array == 0)
72 for (i = 0; array[i]; i++)
73 free (array[i]);
77 strvec_dispose (array)
78 char **array;
80 if (array == 0)
83 strvec_flush (array);
84 free (array);
88 strvec_remove (array, name)
89 char **array, *name;
94 if (array == 0)
97 for (i = 0; array[i]; i++)
98 if (STREQ (name, array[i]))
100 x = array[i];
101 for (j = i; array[j]; j++)
102 array[j] = array[j + 1];
113 strvec_search (array, name)
114 char **array, *name;
118 for (i = 0; array[i]; i++)
119 if (STREQ (name, array[i]))
128 strvec_copy (array)
129 char **array;
135 len = strvec_len (array);
138 for (i = 0; array[i]; i++)
139 ret[i] = savestring (array[i]);
163 /* Sort ARRAY, a null terminated array of pointers to strings. */
165 strvec_sort (array)
166 char **array;
168 qsort (array, strvec_len (array), sizeof (char *), (QSFUNC *)strvec_strcmp);
171 /* Cons up a new array of words. The words are taken from LIST,
173 so you should free everything in this array when you are done.
174 The array is NULL terminated. If IP is non-null, it gets the
175 number of words in the returned array. STARTING_INDEX says where
176 to start filling in the returned array; it can be used to reserve
177 space at the beginning of the array. */
185 char **array;
188 array = (char **)xmalloc ((1 + count + starting_index) * sizeof (char *));
191 array[count] = (char *)NULL;
193 array[count] = alloc ? savestring (list->word->word) : list->word->word;
194 array[count] = (char *)NULL;
198 return (array);
201 /* Convert an array of strings into the form used internally by the shell.
207 strvec_to_word_list (array, alloc, starting_index)
208 char **array;
215 if (array == 0 || array[0] == 0)
218 for (count = 0; array[count]; count++)
223 w = make_bare_word (alloc ? array[i] : "");
227 w->word = array[i];