libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rewrite try_dlopen (2)


From: Ralf Wildenhues
Subject: Re: rewrite try_dlopen (2)
Date: Tue, 5 Oct 2004 16:49:02 +0200
User-agent: Mutt/1.4.1i

Oh well.  Whoever wants to try out this patch,

* Ralf Wildenhues wrote on Tue, Oct 05, 2004 at 03:27:55PM CEST:
> +/* Similar to GNU getline. */
> +static ssize_t
> +get_line(char **linep, size_t *len, FILE *file)
> +{
> +  char *line;
> +
> +  assert(linep);
> +  assert(len);
> +  assert(file);
> +
> +  if (*linep == NULL || *len == 0) 
> +    {
> +      *len = LT_FILENAME_MAX;
> +      *linep = MALLOC (char, *len);
> +      if (*linep == NULL)
> +     {
> +       LT__SETERROR (NO_MEMORY);
> +       return -1;
> +     }
> +    }
> +    
> +  line = *linep;
> +  if (!fgets (line, (int) *len, file))
> +    return LT_STRLEN(line);
> +
> +  while ((line[LT_STRLEN(line) -1] != '\n') && (!feof (file)))
> +    {
> +      *linep = REALLOC (char, *linep, *len *2);
> +      line = *linep;
> +      if (!line)
> +       return -1;

..this following line:
> +      *len *= 2;

> +      if (!fgets (&line[*len -1], (int) *len +1, file))
> +     break;

needs to be down here.

> +    }
> +  return LT_STRLEN(line);
> +}

Sorry for the inconvenience.

Regards,
Ralf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]