Skip to content

Commit 7ec1eb9

Browse files
committed
Merge early parts of jk/cached-textconv
2 parents dcc30eb + aed6ca5 commit 7ec1eb9

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

cache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ static inline void *read_sha1_file(const unsigned char *sha1, enum object_type *
701701
return read_sha1_file_repl(sha1, type, size, NULL);
702702
}
703703
extern int hash_sha1_file(const void *buf, unsigned long len, const char *type, unsigned char *sha1);
704-
extern int write_sha1_file(void *buf, unsigned long len, const char *type, unsigned char *return_sha1);
704+
extern int write_sha1_file(const void *buf, unsigned long len, const char *type, unsigned char *return_sha1);
705705
extern int pretend_sha1_file(void *, unsigned long, enum object_type, unsigned char *);
706706
extern int force_object_loose(const unsigned char *sha1, time_t mtime);
707707

diff.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,10 @@ static void emit_rewrite_diff(const char *name_a,
551551
emit_rewrite_lines(&ecbdata, '-', data_one, size_one);
552552
if (lc_b)
553553
emit_rewrite_lines(&ecbdata, '+', data_two, size_two);
554+
if (textconv_one)
555+
free((char *)data_one);
556+
if (textconv_two)
557+
free((char *)data_two);
554558
}
555559

556560
struct diff_words_buffer {

sha1_file.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2271,7 +2271,7 @@ static int create_tmpfile(char *buffer, size_t bufsiz, const char *filename)
22712271
}
22722272

22732273
static int write_loose_object(const unsigned char *sha1, char *hdr, int hdrlen,
2274-
void *buf, unsigned long len, time_t mtime)
2274+
const void *buf, unsigned long len, time_t mtime)
22752275
{
22762276
int fd, ret;
22772277
unsigned char compressed[4096];
@@ -2307,7 +2307,7 @@ static int write_loose_object(const unsigned char *sha1, char *hdr, int hdrlen,
23072307
git_SHA1_Update(&c, hdr, hdrlen);
23082308

23092309
/* Then the data itself.. */
2310-
stream.next_in = buf;
2310+
stream.next_in = (void *)buf;
23112311
stream.avail_in = len;
23122312
do {
23132313
unsigned char *in0 = stream.next_in;
@@ -2342,7 +2342,7 @@ static int write_loose_object(const unsigned char *sha1, char *hdr, int hdrlen,
23422342
return move_temp_to_file(tmpfile, filename);
23432343
}
23442344

2345-
int write_sha1_file(void *buf, unsigned long len, const char *type, unsigned char *returnsha1)
2345+
int write_sha1_file(const void *buf, unsigned long len, const char *type, unsigned char *returnsha1)
23462346
{
23472347
unsigned char sha1[20];
23482348
char hdr[32];

0 commit comments

Comments
 (0)