Re: A micro-optimisation for walkdir()

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

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?

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2020-09-04 19:38:32 Re: Concurrent failure in create_am with buildfarm member conchuela
Previous Message Jeff Davis 2020-09-04 19:33:24 Re: Disk-based hash aggregate's cost model