- /* First time, initialize */
- if (script_paths == NULL)
- len = sizeof(vchar_t *);
- else
- len = script_paths->l;
-
- /* Add a slot for a new path */
- len += sizeof(vchar_t *);
- if ((new_storage = vrealloc(script_paths, len)) == NULL) {
- plog(LLV_ERROR, LOCATION, NULL,
- "Cannot allocate memory: %s\n", strerror(errno));
- return -1;
- }
- script_paths = new_storage;
-
- size = len / sizeof(vchar_t *);
- sp = (vchar_t **)script_paths->v;
- sp[size - 1] = NULL;
- sp[size - 2] = path;
-
- return (size - 2);