Skip to content

Commit

Permalink
Use size_t, not int, for byte counts.
Browse files Browse the repository at this point in the history
Derived from #37.
  • Loading branch information
dag-erling committed Jul 30, 2024
1 parent a0cafd4 commit 3cfb56c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/tre-match-parallel.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ tre_tnfa_run_parallel(const tre_tnfa_t *tnfa, const void *string, int len,
everything in a single large block from the stack frame using alloca()
or with malloc() if alloca is unavailable. */
{
int tbytes, rbytes, pbytes, xbytes, total_bytes;
size_t tbytes, rbytes, pbytes, xbytes, total_bytes;
char *tmp_buf;
/* Compute the length of the block we need. */
tbytes = sizeof(*tmp_tags) * num_tags;
Expand All @@ -167,11 +167,11 @@ tre_tnfa_run_parallel(const tre_tnfa_t *tnfa, const void *string, int len,
#ifdef TRE_USE_ALLOCA
buf = alloca(total_bytes);
#else /* !TRE_USE_ALLOCA */
buf = xmalloc((unsigned)total_bytes);
buf = xmalloc(total_bytes);
#endif /* !TRE_USE_ALLOCA */
if (buf == NULL)
return REG_ESPACE;
memset(buf, 0, (size_t)total_bytes);
memset(buf, 0, total_bytes);

/* Get the various pointers within tmp_buf (properly aligned). */
tmp_tags = (void *)buf;
Expand Down

0 comments on commit 3cfb56c

Please sign in to comment.