Skip to content

Commit 8d133a4

Browse files
peffgitster
authored andcommitted
strvec: use size_t to store nr and alloc
We converted argv_array (which later became strvec) to use size_t in 819f0e7 (argv-array: use size_t for count and alloc, 2020-07-28) in order to avoid the possibility of integer overflow. But later, commit d70a9eb (strvec: rename struct fields, 2020-07-28) accidentally converted these back to ints! Those two commits were part of the same patch series. I'm pretty sure what happened is that they were originally written in the opposite order and then cleaned up and re-ordered during an interactive rebase. And when resolving the inevitable conflict, I mistakenly took the "rename" patch completely, accidentally dropping the type change. We can correct it now; better late than never. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 225bc32 commit 8d133a4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

strvec.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ extern const char *empty_strvec[];
2929
*/
3030
struct strvec {
3131
const char **v;
32-
int nr;
33-
int alloc;
32+
size_t nr;
33+
size_t alloc;
3434
};
3535

3636
#define STRVEC_INIT { empty_strvec, 0, 0 }

0 commit comments

Comments
 (0)