Skip to content

Commit 26a2d8a

Browse files
author
Linus Torvalds
committed
parse_date(): allow const date string
This is part of breaking up the tag ID patch by Eric Biederman.
1 parent ced7c84 commit 26a2d8a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

cache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ extern void *read_object_with_reference(const unsigned char *sha1,
208208
unsigned char *sha1_ret);
209209

210210
const char *show_date(unsigned long time, int timezone);
211-
void parse_date(char *date, char *buf, int bufsize);
211+
void parse_date(const char *date, char *buf, int bufsize);
212212
void datestamp(char *buf, int bufsize);
213213

214214
static inline void *xmalloc(size_t size)

date.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ static int is_date(int year, int month, int day, struct tm *tm)
224224
return 0;
225225
}
226226

227-
static int match_multi_number(unsigned long num, char c, char *date, char *end, struct tm *tm)
227+
static int match_multi_number(unsigned long num, char c, const char *date, char *end, struct tm *tm)
228228
{
229229
long num2, num3;
230230

@@ -270,7 +270,7 @@ static int match_multi_number(unsigned long num, char c, char *date, char *end,
270270
/*
271271
* We've seen a digit. Time? Year? Date?
272272
*/
273-
static int match_digit(char *date, struct tm *tm, int *offset, int *tm_gmt)
273+
static int match_digit(const char *date, struct tm *tm, int *offset, int *tm_gmt)
274274
{
275275
int n;
276276
char *end;
@@ -361,7 +361,7 @@ static int match_digit(char *date, struct tm *tm, int *offset, int *tm_gmt)
361361
return n;
362362
}
363363

364-
static int match_tz(char *date, int *offp)
364+
static int match_tz(const char *date, int *offp)
365365
{
366366
char *end;
367367
int offset = strtoul(date+1, &end, 10);
@@ -388,7 +388,7 @@ static int match_tz(char *date, int *offp)
388388

389389
/* Gr. strptime is crap for this; it doesn't have a way to require RFC2822
390390
(i.e. English) day/month names, and it doesn't work correctly with %z. */
391-
void parse_date(char *date, char *result, int maxlen)
391+
void parse_date(const char *date, char *result, int maxlen)
392392
{
393393
struct tm tm;
394394
int offset, sign, tm_gmt;

0 commit comments

Comments
 (0)