Re: A micro-optimisation for walkdir()

From: Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: A micro-optimisation for walkdir()
Date: 2020-09-04 20:03:38
Message-ID: CAC+AXB2Wve5=AxY=_khxoDAK7rq91fKKCD4i29JWjX8DTwpkXw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Sep 4, 2020 at 9:37 PM Alvaro Herrera <alvherre(at)2ndquadrant(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2020-09-04 20:07:00 Re: [Patch] Add missing libraries to Libs.private of libpq.pc
Previous Message David G. Johnston 2020-09-04 19:45:36 Re: BUG #16419: wrong parsing BC year in to_date() function