Re: A micro-optimisation for walkdir()

Поиск
Список
Период
Сортировка
От Juan José Santamaría Flecha
Тема Re: A micro-optimisation for walkdir()
Дата
Msg-id CAC+AXB2Wve5=AxY=_khxoDAK7rq91fKKCD4i29JWjX8DTwpkXw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: A micro-optimisation for walkdir()  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Ответы Re: A micro-optimisation for walkdir()
Список pgsql-hackers
On Fri, Sep 4, 2020 at 9:37 PM Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
On 2020-Sep-04, Thomas Munro wrote:

> @@ -10,6 +10,7 @@ struct dirent
>  {
>       long            d_ino;
>       unsigned short d_reclen;
> +     unsigned char d_type;
>       unsigned short d_namlen;
>       char            d_name[MAX_PATH];
>  };
> @@ -20,4 +21,26 @@ DIR                   *opendir(const char *);
>  struct dirent *readdir(DIR *);
>  int                  closedir(DIR *);

> +/* File types for 'd_type'. */
> +enum
> +  {
> +     DT_UNKNOWN = 0,
> +# define DT_UNKNOWN          DT_UNKNOWN

Uhm ... what do these #defines do?  They look a bit funny.

Would it make sense to give this enum a name, and then use that name in
struct dirent's definition, instead of unsigned char?

They mimic POSIX dirent.h. I would rather stick to that.

Regards,

Juan José Santamaría Flecha   

В списке pgsql-hackers по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: BUG #16419: wrong parsing BC year in to_date() function
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: [Patch] Add missing libraries to Libs.private of libpq.pc