Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
apply: rename 'try' variables
author
Brandon Williams
<bmwill@google.com>
Wed, 14 Feb 2018 18:59:29 +0000
(10:59 -0800)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 22 Feb 2018 18:08:05 +0000
(10:08 -0800)
Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
apply.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
585c0e2
)
diff --git
a/apply.c
b/apply.c
index 321a9fa68d491f7e5e89dc9e398b067f67a10c77..071f653c670370f8458e66f8a5581f5c2d34f289 100644
(file)
--- a/
apply.c
+++ b/
apply.c
@@
-2386,8
+2386,8
@@
static void update_pre_post_images(struct image *preimage,
static int line_by_line_fuzzy_match(struct image *img,
struct image *preimage,
struct image *postimage,
static int line_by_line_fuzzy_match(struct image *img,
struct image *preimage,
struct image *postimage,
- unsigned long
try
,
- int
try
_lno,
+ unsigned long
current
,
+ int
current
_lno,
int preimage_limit)
{
int i;
int preimage_limit)
{
int i;
@@
-2404,9
+2404,9
@@
static int line_by_line_fuzzy_match(struct image *img,
for (i = 0; i < preimage_limit; i++) {
size_t prelen = preimage->line[i].len;
for (i = 0; i < preimage_limit; i++) {
size_t prelen = preimage->line[i].len;
- size_t imglen = img->line[
try
_lno+i].len;
+ size_t imglen = img->line[
current
_lno+i].len;
- if (!fuzzy_matchlines(img->buf +
try
+ imgoff, imglen,
+ if (!fuzzy_matchlines(img->buf +
current
+ imgoff, imglen,
preimage->buf + preoff, prelen))
return 0;
if (preimage->line[i].flag & LINE_COMMON)
preimage->buf + preoff, prelen))
return 0;
if (preimage->line[i].flag & LINE_COMMON)
@@
-2443,7
+2443,7
@@
static int line_by_line_fuzzy_match(struct image *img,
*/
extra_chars = preimage_end - preimage_eof;
strbuf_init(&fixed, imgoff + extra_chars);
*/
extra_chars = preimage_end - preimage_eof;
strbuf_init(&fixed, imgoff + extra_chars);
- strbuf_add(&fixed, img->buf +
try
, imgoff);
+ strbuf_add(&fixed, img->buf +
current
, imgoff);
strbuf_add(&fixed, preimage_eof, extra_chars);
fixed_buf = strbuf_detach(&fixed, &fixed_len);
update_pre_post_images(preimage, postimage,
strbuf_add(&fixed, preimage_eof, extra_chars);
fixed_buf = strbuf_detach(&fixed, &fixed_len);
update_pre_post_images(preimage, postimage,
@@
-2455,8
+2455,8
@@
static int match_fragment(struct apply_state *state,
struct image *img,
struct image *preimage,
struct image *postimage,
struct image *img,
struct image *preimage,
struct image *postimage,
- unsigned long
try
,
- int
try
_lno,
+ unsigned long
current
,
+ int
current
_lno,
unsigned ws_rule,
int match_beginning, int match_end)
{
unsigned ws_rule,
int match_beginning, int match_end)
{
@@
-2466,12
+2466,12
@@
static int match_fragment(struct apply_state *state,
size_t fixed_len, postlen;
int preimage_limit;
size_t fixed_len, postlen;
int preimage_limit;
- if (preimage->nr +
try
_lno <= img->nr) {
+ if (preimage->nr +
current
_lno <= img->nr) {
/*
* The hunk falls within the boundaries of img.
*/
preimage_limit = preimage->nr;
/*
* The hunk falls within the boundaries of img.
*/
preimage_limit = preimage->nr;
- if (match_end && (preimage->nr +
try
_lno != img->nr))
+ if (match_end && (preimage->nr +
current
_lno != img->nr))
return 0;
} else if (state->ws_error_action == correct_ws_error &&
(ws_rule & WS_BLANK_AT_EOF)) {
return 0;
} else if (state->ws_error_action == correct_ws_error &&
(ws_rule & WS_BLANK_AT_EOF)) {
@@
-2482,7
+2482,7
@@
static int match_fragment(struct apply_state *state,
* match with img, and the remainder of the preimage
* must be blank.
*/
* match with img, and the remainder of the preimage
* must be blank.
*/
- preimage_limit = img->nr -
try
_lno;
+ preimage_limit = img->nr -
current
_lno;
} else {
/*
* The hunk extends beyond the end of the img and
} else {
/*
* The hunk extends beyond the end of the img and
@@
-2492,27
+2492,27
@@
static int match_fragment(struct apply_state *state,
return 0;
}
return 0;
}
- if (match_beginning &&
try
_lno)
+ if (match_beginning &&
current
_lno)
return 0;
/* Quick hash check */
for (i = 0; i < preimage_limit; i++)
return 0;
/* Quick hash check */
for (i = 0; i < preimage_limit; i++)
- if ((img->line[
try
_lno + i].flag & LINE_PATCHED) ||
- (preimage->line[i].hash != img->line[
try
_lno + i].hash))
+ if ((img->line[
current
_lno + i].flag & LINE_PATCHED) ||
+ (preimage->line[i].hash != img->line[
current
_lno + i].hash))
return 0;
if (preimage_limit == preimage->nr) {
/*
* Do we have an exact match? If we were told to match
return 0;
if (preimage_limit == preimage->nr) {
/*
* Do we have an exact match? If we were told to match
- * at the end, size must be exactly at
try
+fragsize,
- * otherwise
try
+fragsize must be still within the preimage,
+ * at the end, size must be exactly at
current
+fragsize,
+ * otherwise
current
+fragsize must be still within the preimage,
* and either case, the old piece should match the preimage
* exactly.
*/
if ((match_end
* and either case, the old piece should match the preimage
* exactly.
*/
if ((match_end
- ? (
try
+ preimage->len == img->len)
- : (
try
+ preimage->len <= img->len)) &&
- !memcmp(img->buf +
try
, preimage->buf, preimage->len))
+ ? (
current
+ preimage->len == img->len)
+ : (
current
+ preimage->len <= img->len)) &&
+ !memcmp(img->buf +
current
, preimage->buf, preimage->len))
return 1;
} else {
/*
return 1;
} else {
/*
@@
-2543,7
+2543,7
@@
static int match_fragment(struct apply_state *state,
*/
if (state->ws_ignore_action == ignore_ws_change)
return line_by_line_fuzzy_match(img, preimage, postimage,
*/
if (state->ws_ignore_action == ignore_ws_change)
return line_by_line_fuzzy_match(img, preimage, postimage,
-
try, try
_lno, preimage_limit);
+
current, current
_lno, preimage_limit);
if (state->ws_error_action != correct_ws_error)
return 0;
if (state->ws_error_action != correct_ws_error)
return 0;
@@
-2577,10
+2577,10
@@
static int match_fragment(struct apply_state *state,
*/
strbuf_init(&fixed, preimage->len + 1);
orig = preimage->buf;
*/
strbuf_init(&fixed, preimage->len + 1);
orig = preimage->buf;
- target = img->buf +
try
;
+ target = img->buf +
current
;
for (i = 0; i < preimage_limit; i++) {
size_t oldlen = preimage->line[i].len;
for (i = 0; i < preimage_limit; i++) {
size_t oldlen = preimage->line[i].len;
- size_t tgtlen = img->line[
try
_lno + i].len;
+ size_t tgtlen = img->line[
current
_lno + i].len;
size_t fixstart = fixed.len;
struct strbuf tgtfix;
int match;
size_t fixstart = fixed.len;
struct strbuf tgtfix;
int match;
@@
-2666,8
+2666,8
@@
static int find_pos(struct apply_state *state,
int match_beginning, int match_end)
{
int i;
int match_beginning, int match_end)
{
int i;
- unsigned long backwards, forwards,
try
;
- int backwards_lno, forwards_lno,
try
_lno;
+ unsigned long backwards, forwards,
current
;
+ int backwards_lno, forwards_lno,
current
_lno;
/*
* If match_beginning or match_end is specified, there is no
/*
* If match_beginning or match_end is specified, there is no
@@
-2687,25
+2687,25
@@
static int find_pos(struct apply_state *state,
if ((size_t) line > img->nr)
line = img->nr;
if ((size_t) line > img->nr)
line = img->nr;
-
try
= 0;
+
current
= 0;
for (i = 0; i < line; i++)
for (i = 0; i < line; i++)
-
try
+= img->line[i].len;
+
current
+= img->line[i].len;
/*
* There's probably some smart way to do this, but I'll leave
* that to the smart and beautiful people. I'm simple and stupid.
*/
/*
* There's probably some smart way to do this, but I'll leave
* that to the smart and beautiful people. I'm simple and stupid.
*/
- backwards =
try
;
+ backwards =
current
;
backwards_lno = line;
backwards_lno = line;
- forwards =
try
;
+ forwards =
current
;
forwards_lno = line;
forwards_lno = line;
-
try
_lno = line;
+
current
_lno = line;
for (i = 0; ; i++) {
if (match_fragment(state, img, preimage, postimage,
for (i = 0; ; i++) {
if (match_fragment(state, img, preimage, postimage,
-
try, try
_lno, ws_rule,
+
current, current
_lno, ws_rule,
match_beginning, match_end))
match_beginning, match_end))
- return
try
_lno;
+ return
current
_lno;
again:
if (backwards_lno == 0 && forwards_lno == img->nr)
again:
if (backwards_lno == 0 && forwards_lno == img->nr)
@@
-2718,8
+2718,8
@@
static int find_pos(struct apply_state *state,
}
backwards_lno--;
backwards -= img->line[backwards_lno].len;
}
backwards_lno--;
backwards -= img->line[backwards_lno].len;
-
try
= backwards;
-
try
_lno = backwards_lno;
+
current
= backwards;
+
current
_lno = backwards_lno;
} else {
if (forwards_lno == img->nr) {
i++;
} else {
if (forwards_lno == img->nr) {
i++;
@@
-2727,8
+2727,8
@@
static int find_pos(struct apply_state *state,
}
forwards += img->line[forwards_lno].len;
forwards_lno++;
}
forwards += img->line[forwards_lno].len;
forwards_lno++;
-
try
= forwards;
-
try
_lno = forwards_lno;
+
current
= forwards;
+
current
_lno = forwards_lno;
}
}
}
}