being operated on. We shouldn't use 1st slot, but we want
to avoid having to search all the way to the end of an
archive with a large number of members at link time. */
- new_files = xmalloc ((file_count + 2) * sizeof (char *));
- new_files[0] = files[0];
- new_files[1] = LIBDEPS;
- for (i = 1; i < file_count; i++)
- new_files[i+1] = files[i];
- file_count = ++i;
+ new_files = xmalloc ((file_count + 2) * sizeof (*new_files));
+ if (file_count)
+ {
+ new_files[0] = files[0];
+ memcpy (new_files + 1, files, file_count * sizeof (*files));
+ }
+ new_files[file_count != 0] = LIBDEPS;
+ file_count++;
+ new_files[file_count] = NULL;
files = new_files;
- files[i] = NULL;
}
switch (operation)