sed: minor int width fixes

* sed/compile.c (finish_program):
* sed/execute.c (reset_addresses):
Use idx_t, not int, for vars that might exceed INT_MAX in theory.
* sed/debug.c (block_level, debug_print_command):
Use off_t, not int, likewise.
This commit is contained in:
Paul Eggert committed 2026-05-25 10:30:53 -07:00
1 parent 163b6e8819
commit 31df9f71cb
3 files changed
+5 -5

No files matched your search

+1 -1
View File
@@ -1612,7 +1612,7 @@ finish_program (struct vector *program)
}
#ifdef lint
for (int i = 0; i < program->v_length; ++i)
for (idx_t i = 0; i < program->v_length; ++i)
{
const struct sed_cmd *sc = &program->v[i];
+2 -2
View File
@@ -27,7 +27,7 @@
#include <sys/types.h>
/* indentation level when printing the program */
static int block_level = 0;
static off_t block_level = 0;
void
@@ -416,7 +416,7 @@ debug_print_command (const struct vector *program, const struct sed_cmd *sc)
if (sc->cmd == '}')
--block_level;
for (int j = 0; j < block_level; ++j)
for (off_t j = 0; j < block_level; j++)
fputs (" ", stdout);
debug_print_addr (sc->a1);
+2 -2
View File
@@ -698,9 +698,9 @@ static void
reset_addresses (struct vector *vec)
{
struct sed_cmd *cur_cmd;
int n;
idx_t n;
for (cur_cmd = vec->v, n = vec->v_length; n--; cur_cmd++)
for (cur_cmd = vec->v, n = vec->v_length; n != 0; cur_cmd++, n--)
if (cur_cmd->a1
&& cur_cmd->a1->addr_type == ADDR_IS_NUM
&& cur_cmd->a1->addr_number == 0)