Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kEHWj-0006yN-Ja for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Sep 2020 19:37:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kEHWi-0004L5-IB for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Sep 2020 19:37:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kEHWi-0004Kw-Ag for pgsql-hackers@lists.postgresql.org; Fri, 04 Sep 2020 19:37:36 +0000 Received: from mail-qk1-x72d.google.com ([2607:f8b0:4864:20::72d]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kEHWa-00074i-Uc for pgsql-hackers@postgresql.org; Fri, 04 Sep 2020 19:37:35 +0000 Received: by mail-qk1-x72d.google.com with SMTP id u3so7446227qkd.9 for ; Fri, 04 Sep 2020 12:37:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=ci9lf4uIStbu4IOtTLjO0/aehkgFir+psKmFeimrEoU=; b=fWUxYfBdTmFrt3xqTs74UR2HzhgVUx2wxlk3L0Osbr1Gbuvv+FF6i6grS2GETzOih1 BBysaLanzmY4byh4ixL01h4u1UfP4/eWdOTlhJ1qYEg9BlZXo+fIwecmfrTRU7f/lQRf LE3mf1j36ncpr87ejX6a7RK8rMhEZS3xcOc4+tgY7tRu35I2Fk9kK1QCFN+fu1NLhj5L HLysOOSPGMSVdrDdzPrKQ5PzOnIol7ueIvWsis0iMN7ljIZobvUe1Do7luZAp/4qoj23 nqfcAf91ZJI3QOGbkVgEpCPOc1K+8Kae7f0dDZacLL8MbX6fCQQFma0QUKDSivcODB+w 7zAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=ci9lf4uIStbu4IOtTLjO0/aehkgFir+psKmFeimrEoU=; b=VKt9WkVadfgwaZVgUfcUxc03lbCVaZdJGDS5WxIttIKONdaj+2xet+8CCyspblEIz1 bBMTHWZJPOj+h90uLRfE/aSwlOGAEZ5uGzHu2y6dO0x5YnkIHbQXUMNmqMxA/S6dcdi8 iRd7kqYvbVHj6fIrHyh3ZQs1cRCjLDRQEFodeLio35mTEL3g3zy/3Dz4+VtXQdU93b1I b6YrOIeOUhooQL/2shIV279HlKbU7vx0kF7pe+dsrgNIisPcDtYjDzk4GCTqOZFtY5BS CPDDXigIoXzJjPQK0gJEciUcAvpHNzuvWjQEsTiqUUaZn5uQPV7Awv51hnHTn8dsZ1pR u8eQ== X-Gm-Message-State: AOAM533/JcEy94kGWv1xcaDtQrW3xXh/w4F7pOsZQ1iH38H9NVCxPN4a rUJUz7uwVHpyt13knZ9O67uCpA== X-Google-Smtp-Source: ABdhPJw0RlfH34GK5PdcEMriy2mGvRf0pzTs6UROVlwNvCJfFw7w1Dr+rexERBFXM9XPxBedH/Q6vg== X-Received: by 2002:a05:620a:64b:: with SMTP id a11mr9263414qka.313.1599248247012; Fri, 04 Sep 2020 12:37:27 -0700 (PDT) Received: from perhan.alvh.no-ip.org ([190.95.19.47]) by smtp.gmail.com with ESMTPSA id k185sm5203211qkc.77.2020.09.04.12.37.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Sep 2020 12:37:26 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id DEA882A1598; Fri, 4 Sep 2020 15:37:24 -0400 (-04) Date: Fri, 4 Sep 2020 15:37:24 -0400 From: Alvaro Herrera To: Thomas Munro Cc: Tom Lane , Juan =?iso-8859-1?Q?Jos=E9_Santamar=EDa?= Flecha , pgsql-hackers Subject: Re: A micro-optimisation for walkdir() Message-ID: <20200904193724.GA7401@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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