bug-gnulib
[Top][All Lists]
Advanced

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

Re: new module: relpath


From: Akim Demaille
Subject: Re: new module: relpath
Date: Tue, 19 Jun 2012 14:15:19 +0200

Le 18 juin 2012 à 18:31, Eli Zaretskii a écrit :

>> No, canonicalize_filename_mode is GPL because it calls xalloc() and dies
>> rather than return NULL.
> 
> Maybe I'm looking at the wrong source file in gnulib. but I see these
> at the beginning of canonicalize_filename_mode:
> 
>  if (name == NULL)
>    {
>      errno = EINVAL;
>      return NULL;
>    }
> 
>  if (name[0] == '\0')
>    {
>      errno = ENOENT;
>      return NULL;
>    }
> 
>  if (name[0] != '/')
>    {
>      rname = xgetcwd ();
>      if (!rname)
>        return NULL;

No, you are looking at the right file, but not the right place.

/* Return true if we've already seen the triple, <FILENAME, dev, ino>.
   If *HT is not initialized, initialize it.  */
static bool
seen_triple (Hash_table **ht, char const *filename, struct stat const *st)
{
  if (*ht == NULL)
    {
      size_t initial_capacity = 7;
      *ht = hash_initialize (initial_capacity,
                            NULL,
                            triple_hash,
                            triple_compare_ino_str,
                            triple_free);
      if (*ht == NULL)
        xalloc_die ();
    }

  if (seen_file (*ht, filename, st))
    return true;

  record_file (*ht, filename, st);
  return false;
}

Not to mention xgetcwd for instance.

Frankly, I am pretty lost now.  Does it make sense at all to
apply the changes I made to hoist xalloc.h out of relpath,
given that anyway it sits on top on non library-ready
modules?  They make the code more complex for no good reason.




reply via email to

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