-/*---------------------------------------------------------------------.
-| Read the next filename from name_file and null-terminate it. Put it |
-| into name_buffer, reallocating and adjusting name_buffer_length if |
-| necessary. Return 0 at end of file, 1 otherwise. |
-`---------------------------------------------------------------------*/
-
-static int
-read_name_from_file (void)
-{
- int character;
- size_t counter = 0;
-
- /* FIXME: getc may be called even if character was EOF the last time here. */
-
- /* FIXME: This + 2 allocation might serve no purpose. */
-
- while (character = getc (name_file),
- character != EOF && character != filename_terminator)
- {
- if (counter == name_buffer_length)
- {
- name_buffer_length += NAME_FIELD_SIZE;
- name_buffer = xrealloc (name_buffer, name_buffer_length + 2);
- }
- name_buffer[counter++] = character;
- }
-
- if (counter == 0 && character == EOF)
- return 0;
-
- if (counter == name_buffer_length)
- {
- name_buffer_length += NAME_FIELD_SIZE;
- name_buffer = xrealloc (name_buffer, name_buffer_length + 2);
- }
- name_buffer[counter] = '\0';