Skip to content

Commit 43b3646

Browse files
dschoGit for Windows Build Agent
authored andcommitted
Merge branch 'size-t/grep'
2 parents 8b54073 + 3180985 commit 43b3646

2 files changed

Lines changed: 10 additions & 12 deletions

File tree

lib/grep.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -864,9 +864,9 @@ void free_grep_patterns(struct grep_opt *opt)
864864
free_pattern_expr(opt->pattern_expression);
865865
}
866866

867-
static const char *end_of_line(const char *cp, unsigned long *left)
867+
static const char *end_of_line(const char *cp, size_t *left)
868868
{
869-
unsigned long l = *left;
869+
size_t l = *left;
870870
while (l && *cp != '\n') {
871871
l--;
872872
cp++;
@@ -1454,7 +1454,7 @@ static int should_lookahead(struct grep_opt *opt)
14541454
}
14551455

14561456
static int look_ahead(struct grep_opt *opt,
1457-
unsigned long *left_p,
1457+
size_t *left_p,
14581458
unsigned *lno_p,
14591459
const char **bol_p)
14601460
{
@@ -1567,7 +1567,7 @@ static int grep_source_1(struct grep_opt *opt, struct grep_source *gs, int colle
15671567
{
15681568
const char *bol;
15691569
const char *peek_bol = NULL;
1570-
unsigned long left;
1570+
size_t left;
15711571
unsigned lno = 1;
15721572
unsigned last_hit = 0;
15731573
int binary_match_only = 0;
@@ -1737,7 +1737,7 @@ static int grep_source_1(struct grep_opt *opt, struct grep_source *gs, int colle
17371737
goto next_line;
17381738
}
17391739
if (show_function && (!peek_bol || peek_bol < bol)) {
1740-
unsigned long peek_left = left;
1740+
size_t peek_left = left;
17411741
const char *peek_eol = eol;
17421742

17431743
/*
@@ -1856,7 +1856,7 @@ int grep_source(struct grep_opt *opt, struct grep_source *gs)
18561856

18571857
static void grep_source_init_buf(struct grep_source *gs,
18581858
const char *buf,
1859-
unsigned long size)
1859+
size_t size)
18601860
{
18611861
gs->type = GREP_SOURCE_BUF;
18621862
gs->name = NULL;
@@ -1867,7 +1867,7 @@ static void grep_source_init_buf(struct grep_source *gs,
18671867
gs->identifier = NULL;
18681868
}
18691869

1870-
int grep_buffer(struct grep_opt *opt, const char *buf, unsigned long size)
1870+
int grep_buffer(struct grep_opt *opt, const char *buf, size_t size)
18711871
{
18721872
struct grep_source gs;
18731873
int r;
@@ -1933,11 +1933,9 @@ void grep_source_clear_data(struct grep_source *gs)
19331933
static int grep_source_load_oid(struct grep_source *gs)
19341934
{
19351935
enum object_type type;
1936-
size_t size_st = 0;
19371936

19381937
gs->buf = odb_read_object(gs->repo->objects, gs->identifier,
1939-
&type, &size_st);
1940-
gs->size = cast_size_t_to_ulong(size_st);
1938+
&type, &gs->size);
19411939
if (!gs->buf)
19421940
return error(_("'%s': unable to read %s"),
19431941
gs->name,

lib/grep.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ void append_grep_pattern(struct grep_opt *opt, const char *pat, const char *orig
212212
void append_header_grep_pattern(struct grep_opt *, enum grep_header_field, const char *);
213213
void compile_grep_patterns(struct grep_opt *opt);
214214
void free_grep_patterns(struct grep_opt *opt);
215-
int grep_buffer(struct grep_opt *opt, const char *buf, unsigned long size);
215+
int grep_buffer(struct grep_opt *opt, const char *buf, size_t size);
216216

217217
/* The field parameter is only used to filter header patterns
218218
* (where appropriate). If filtering isn't desirable
@@ -235,7 +235,7 @@ struct grep_source {
235235
struct repository *repo; /* if GREP_SOURCE_OID */
236236

237237
const char *buf;
238-
unsigned long size;
238+
size_t size;
239239

240240
char *path; /* for attribute lookups */
241241
struct userdiff_driver *driver;

0 commit comments

Comments
 (0)