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 <gitster@pobox.com>
Junio C Hamano committed
Apr 11, 2012 at 14:41 UTC
26693ba81ccffd46fc9e01bc3346fd74f555a31a
1 file changed
+7
-7
builtin/apply.c
+7
-7
@@ -1088,7 +1088,7 @@ static const char *stop_at_slash(const char *line, int llen)
1088
* creation or deletion of an empty file. In any of these cases,
1089
* both sides are the same name under a/ and b/ respectively.
1090
*/
1091
-static char *git_header_name(char *line, int llen)
1091
+static char *git_header_name(const char *line, int llen)
1092
{
1093
const char *name;
1094
const char *second = NULL;
@@ -1215,7 +1215,7 @@ static char *git_header_name(char *line, int llen)
1215
}
1216
1217
/* 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)
1219
{
1220
unsigned long offset;
1221
@@ -1331,7 +1331,7 @@ static int parse_range(const char *line, int len, int offset, const char *expect
1331
return offset + ex;
1332
}
1333
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)
1335
{
1336
int oldlines = 0, newlines = 0, ret = 0;
1337
@@ -1385,7 +1385,7 @@ static void recount_diff(char *line, int size, struct fragment *fragment)
1385
* Parse a unified diff fragment header of the
1386
* form "@@ -a,b +c,d @@"
1387
*/
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)
1389
{
1390
int offset;
1391
@@ -1399,7 +1399,7 @@ static int parse_fragment_header(char *line, int len, struct fragment *fragment)
1399
return offset;
1400
}
1401
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)
1403
{
1404
unsigned long offset, len;
1405
@@ -1511,7 +1511,7 @@ static void check_whitespace(const char *line, int len, unsigned ws_rule)
1511
* between a "---" that is part of a patch, and a "---" that starts
1512
* the next patch is to look at the line counts..
1513
*/
1514
-static int parse_fragment(char *line, unsigned long size,
1514
+static int parse_fragment(const char *line, unsigned long size,
1515
struct patch *patch, struct fragment *fragment)
1516
{
1517
int added, deleted;
@@ -1607,7 +1607,7 @@ static int parse_fragment(char *line, unsigned long size,
1607
return offset;
1608
}
1609
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)
1611
{
1612
unsigned long offset = 0;
1613
unsigned long oldlines = 0, newlines = 0, context = 0;