From dec7443048033cc620b9c5a4f84e4d43e90f0f18 Mon Sep 17 00:00:00 2001
From: Tristan Partin <tristan@partin.io>
Date: Wed, 29 Jul 2026 21:12:10 +0000
Subject: [PATCH v1 2/2] Make use of counted_by attribute

These are two trivial changes that show how pg_attribute_counted_by can
be used throughout the codebase.

Signed-off-by: Tristan Partin <tristan@partin.io>
---
 src/backend/storage/file/buffile.c | 2 +-
 src/backend/utils/sort/tuplesort.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c
index 5c59913646b..649d21420a2 100644
--- a/src/backend/storage/file/buffile.c
+++ b/src/backend/storage/file/buffile.c
@@ -72,7 +72,7 @@ struct BufFile
 {
 	int			numFiles;		/* number of physical files in set */
 	/* all files except the last have length exactly MAX_PHYSICAL_FILESIZE */
-	File	   *files;			/* palloc'd array with numFiles entries */
+	File	   *files pg_attribute_counted_by(numFiles);	/* palloc'd array with numFiles entries */
 
 	bool		isInterXact;	/* keep open over transactions? */
 	bool		dirty;			/* does buffer need to be written? */
diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c
index c0e7527b9ca..49868071c66 100644
--- a/src/backend/utils/sort/tuplesort.c
+++ b/src/backend/utils/sort/tuplesort.c
@@ -364,7 +364,7 @@ struct Sharedsort
 	 * Tapes array used by workers to report back information needed by the
 	 * leader to concatenate all worker tapes into one for merging
 	 */
-	TapeShare	tapes[FLEXIBLE_ARRAY_MEMBER];
+	TapeShare	tapes[FLEXIBLE_ARRAY_MEMBER] pg_attribute_counted_by(nTapes);
 };
 
 /*
-- 
Tristan Partin
https://tristan.partin.io

