[PATCH] maint: ptx, csplit: use the COUNTED_BY attribute for heap buffer
From:
Pádraig Brady
Subject:
[PATCH] maint: ptx, csplit: use the COUNTED_BY attribute for heap buffers
Date:
Tue, 13 Oct 2026 12:38:42 +0100
From: Ismail Ramzi <ismail@bugqore.com>
* src/csplit.c (struct buffer_record): Annotate the input data
area with COUNTED_BY (bytes_alloc).
* src/ptx.c (WORD_TABLE): Annotate the word array with
COUNTED_BY (alloc), moving the count field ahead of the pointer
so the attribute can reference an already-declared field.
Link: https://github.com/coreutils/coreutils/pull/377
---
src/csplit.c | 2 +-
src/ptx.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/csplit.c b/src/csplit.c
index d453afbbf..0c8e6a1c5 100644
--- a/src/csplit.c
+++ b/src/csplit.c
@@ -99,7 +99,7 @@ struct buffer_record
intmax_t start_line; /* First line number in this buffer. */
intmax_t first_available; /* First line that can be retrieved. */
idx_t num_lines; /* Number of complete lines in this buffer. */
- char *buffer; /* Data area. */
+ char *buffer COUNTED_BY (bytes_alloc); /* Data area. */
struct line *line_start; /* Head of list of pointers to lines. */
struct line *curr_line; /* The line start record currently in use. */
struct buffer_record *next;
diff --git a/src/ptx.c b/src/ptx.c
index bb9683e06..7e0ce8121 100644
--- a/src/ptx.c
+++ b/src/ptx.c
@@ -118,9 +118,9 @@ WORD;
typedef struct
{
- WORD *start; /* array of WORDs */
idx_t alloc; /* allocated length */
idx_t length; /* number of used entries */
+ WORD *start COUNTED_BY (alloc); /* array of WORDs */
}
WORD_TABLE;
--
2.55.0
[Prev in Thread]
Current Thread
[Next in Thread]
[PATCH] maint: ptx, csplit: use the COUNTED_BY attribute for heap buffers,
Pádraig Brady<=