pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Juan José Santamaría Flecha <juanjo.santamaria@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: A micro-optimisation for walkdir()
Date: Fri, 4 Sep 2020 15:37:24 -0400
Message-ID: <20200904193724.GA7401@alvherre.pgsql> (raw)
In-Reply-To: <CA+hUKG+o2FXKJUw7iNwQ33S1sv2mT6V6K21sB8+CRWtfeSNCew@mail.gmail.com>

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





view thread (28+ messages)  latest in thread

Message-ID: <20200904193724.GA7401@alvherre.pgsql>
Permalink:  ../20200904193724.GA7401@alvherre.pgsql/
Also on:    postgresql.org/message-id/20200904193724.GA7401@alvherre.pgsql

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@2ndquadrant.com, thomas.munro@gmail.com, tgl@sss.pgh.pa.us, juanjo.santamaria@gmail.com
  Subject: Re: A micro-optimisation for walkdir()
  In-Reply-To: <20200904193724.GA7401@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox