coreutils
[Top][All Lists]
Advanced

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

Re: Duplication in Filetype Indicators


From: Bernhard Voelker
Subject: Re: Duplication in Filetype Indicators
Date: Thu, 1 Feb 2024 08:54:36 +0100
User-agent: Mozilla Thunderbird

On 2/1/24 01:39, SNUGGS wrote:
Any reason there is a duplicate `C_FILE` in `ls.c`?
https://github.com/coreutils/coreutils/blame/master/src/ls.c#L184-L185

The list directly corresponds to the 'enum filetype' some lines above:

  enum filetype
    {
      unknown,
      fifo,
      chardev,
      directory,
      blockdev,
      normal,
      symbolic_link,
      sock,
      whiteout,
      arg_directory
    };

  #define FILETYPE_INDICATORS                           \
    {                                                   \
      C_ORPHAN, C_FIFO, C_CHR, C_DIR, C_BLK, C_FILE,    \
      C_LINK, C_SOCK, C_FILE, C_DIR                     \
   }

This means that a whiteout file is shown like a 'normal' file.
Likewise for arg_directory as C_DIR.

The only usage is in function get_color_indicator:

      static enum indicator_no filetype_indicator[] = FILETYPE_INDICATORS;
      type = filetype_indicator[f->filetype];

Have a nice day,
Berny



reply via email to

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