mirror of
https://github.com/git-for-windows/git.git
synced 2026-06-24 03:34:47 -05:00
Merge branch 'size-t/grep'
This commit is contained in:
18
grep.c
18
grep.c
@@ -864,9 +864,9 @@ void free_grep_patterns(struct grep_opt *opt)
|
||||
free_pattern_expr(opt->pattern_expression);
|
||||
}
|
||||
|
||||
static const char *end_of_line(const char *cp, unsigned long *left)
|
||||
static const char *end_of_line(const char *cp, size_t *left)
|
||||
{
|
||||
unsigned long l = *left;
|
||||
size_t l = *left;
|
||||
while (l && *cp != '\n') {
|
||||
l--;
|
||||
cp++;
|
||||
@@ -1454,7 +1454,7 @@ static int should_lookahead(struct grep_opt *opt)
|
||||
}
|
||||
|
||||
static int look_ahead(struct grep_opt *opt,
|
||||
unsigned long *left_p,
|
||||
size_t *left_p,
|
||||
unsigned *lno_p,
|
||||
const char **bol_p)
|
||||
{
|
||||
@@ -1567,7 +1567,7 @@ static int grep_source_1(struct grep_opt *opt, struct grep_source *gs, int colle
|
||||
{
|
||||
const char *bol;
|
||||
const char *peek_bol = NULL;
|
||||
unsigned long left;
|
||||
size_t left;
|
||||
unsigned lno = 1;
|
||||
unsigned last_hit = 0;
|
||||
int binary_match_only = 0;
|
||||
@@ -1737,7 +1737,7 @@ static int grep_source_1(struct grep_opt *opt, struct grep_source *gs, int colle
|
||||
goto next_line;
|
||||
}
|
||||
if (show_function && (!peek_bol || peek_bol < bol)) {
|
||||
unsigned long peek_left = left;
|
||||
size_t peek_left = left;
|
||||
const char *peek_eol = eol;
|
||||
|
||||
/*
|
||||
@@ -1856,7 +1856,7 @@ int grep_source(struct grep_opt *opt, struct grep_source *gs)
|
||||
|
||||
static void grep_source_init_buf(struct grep_source *gs,
|
||||
const char *buf,
|
||||
unsigned long size)
|
||||
size_t size)
|
||||
{
|
||||
gs->type = GREP_SOURCE_BUF;
|
||||
gs->name = NULL;
|
||||
@@ -1867,7 +1867,7 @@ static void grep_source_init_buf(struct grep_source *gs,
|
||||
gs->identifier = NULL;
|
||||
}
|
||||
|
||||
int grep_buffer(struct grep_opt *opt, const char *buf, unsigned long size)
|
||||
int grep_buffer(struct grep_opt *opt, const char *buf, size_t size)
|
||||
{
|
||||
struct grep_source gs;
|
||||
int r;
|
||||
@@ -1933,11 +1933,9 @@ void grep_source_clear_data(struct grep_source *gs)
|
||||
static int grep_source_load_oid(struct grep_source *gs)
|
||||
{
|
||||
enum object_type type;
|
||||
size_t size_st = 0;
|
||||
|
||||
gs->buf = odb_read_object(gs->repo->objects, gs->identifier,
|
||||
&type, &size_st);
|
||||
gs->size = cast_size_t_to_ulong(size_st);
|
||||
&type, &gs->size);
|
||||
if (!gs->buf)
|
||||
return error(_("'%s': unable to read %s"),
|
||||
gs->name,
|
||||
|
||||
4
grep.h
4
grep.h
@@ -212,7 +212,7 @@ void append_grep_pattern(struct grep_opt *opt, const char *pat, const char *orig
|
||||
void append_header_grep_pattern(struct grep_opt *, enum grep_header_field, const char *);
|
||||
void compile_grep_patterns(struct grep_opt *opt);
|
||||
void free_grep_patterns(struct grep_opt *opt);
|
||||
int grep_buffer(struct grep_opt *opt, const char *buf, unsigned long size);
|
||||
int grep_buffer(struct grep_opt *opt, const char *buf, size_t size);
|
||||
|
||||
/* The field parameter is only used to filter header patterns
|
||||
* (where appropriate). If filtering isn't desirable
|
||||
@@ -235,7 +235,7 @@ struct grep_source {
|
||||
struct repository *repo; /* if GREP_SOURCE_OID */
|
||||
|
||||
const char *buf;
|
||||
unsigned long size;
|
||||
size_t size;
|
||||
|
||||
char *path; /* for attribute lookups */
|
||||
struct userdiff_driver *driver;
|
||||
|
||||
Reference in New Issue
Block a user