Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 26693ba

Browse files
committed
apply: tighten constness of line buffer
These point into a single line in the patch text we read from the input, and they are not used to modify it. Signed-off-by: Junio C Hamano <[email protected]>
1 parent c2066a3 commit 26693ba

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

builtin/apply.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,7 @@ static const char *stop_at_slash(const char *line, int llen)
10881088
* creation or deletion of an empty file. In any of these cases,
10891089
* both sides are the same name under a/ and b/ respectively.
10901090
*/
1091-
static char *git_header_name(char *line, int llen)
1091+
static char *git_header_name(const char *line, int llen)
10921092
{
10931093
const char *name;
10941094
const char *second = NULL;
@@ -1215,7 +1215,7 @@ static char *git_header_name(char *line, int llen)
12151215
}
12161216

12171217
/* Verify that we recognize the lines following a git header */
1218-
static int parse_git_header(char *line, int len, unsigned int size, struct patch *patch)
1218+
static int parse_git_header(const char *line, int len, unsigned int size, struct patch *patch)
12191219
{
12201220
unsigned long offset;
12211221

@@ -1331,7 +1331,7 @@ static int parse_range(const char *line, int len, int offset, const char *expect
13311331
return offset + ex;
13321332
}
13331333

1334-
static void recount_diff(char *line, int size, struct fragment *fragment)
1334+
static void recount_diff(const char *line, int size, struct fragment *fragment)
13351335
{
13361336
int oldlines = 0, newlines = 0, ret = 0;
13371337

@@ -1385,7 +1385,7 @@ static void recount_diff(char *line, int size, struct fragment *fragment)
13851385
* Parse a unified diff fragment header of the
13861386
* form "@@ -a,b +c,d @@"
13871387
*/
1388-
static int parse_fragment_header(char *line, int len, struct fragment *fragment)
1388+
static int parse_fragment_header(const char *line, int len, struct fragment *fragment)
13891389
{
13901390
int offset;
13911391

@@ -1399,7 +1399,7 @@ static int parse_fragment_header(char *line, int len, struct fragment *fragment)
13991399
return offset;
14001400
}
14011401

1402-
static int find_header(char *line, unsigned long size, int *hdrsize, struct patch *patch)
1402+
static int find_header(const char *line, unsigned long size, int *hdrsize, struct patch *patch)
14031403
{
14041404
unsigned long offset, len;
14051405

@@ -1511,7 +1511,7 @@ static void check_whitespace(const char *line, int len, unsigned ws_rule)
15111511
* between a "---" that is part of a patch, and a "---" that starts
15121512
* the next patch is to look at the line counts..
15131513
*/
1514-
static int parse_fragment(char *line, unsigned long size,
1514+
static int parse_fragment(const char *line, unsigned long size,
15151515
struct patch *patch, struct fragment *fragment)
15161516
{
15171517
int added, deleted;
@@ -1607,7 +1607,7 @@ static int parse_fragment(char *line, unsigned long size,
16071607
return offset;
16081608
}
16091609

1610-
static int parse_single_patch(char *line, unsigned long size, struct patch *patch)
1610+
static int parse_single_patch(const char *line, unsigned long size, struct patch *patch)
16111611
{
16121612
unsigned long offset = 0;
16131613
unsigned long oldlines = 0, newlines = 0, context = 0;

0 commit comments

Comments
 (0)