зеркало из https://github.com/microsoft/git.git
sparse: Fix errors and silence warnings
* load_file() returns a void pointer but is using 0 for the return
value
* builtin/receive-pack.c forgot to include builtin.h
* packet_trace_prefix can be marked static
* ll_merge takes a pointer for its last argument, not an int
* crc32 expects a pointer as the second argument but Z_NULL is defined
to be 0 (see 38f4d13
sparse fix: Using plain integer as NULL pointer,
2006-11-18 for more info)
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
cb35c0646d
Коммит
1e4cd68c00
|
@ -414,10 +414,10 @@ static void *load_file(const char *filename, size_t *sz)
|
||||||
err_ret:
|
err_ret:
|
||||||
if (errno != ENOENT)
|
if (errno != ENOENT)
|
||||||
error(_("'%s': %s"), filename, strerror(errno));
|
error(_("'%s': %s"), filename, strerror(errno));
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (!S_ISREG(st.st_mode))
|
if (!S_ISREG(st.st_mode))
|
||||||
return 0;
|
return NULL;
|
||||||
*sz = xsize_t(st.st_size);
|
*sz = xsize_t(st.st_size);
|
||||||
i = open(filename, O_RDONLY);
|
i = open(filename, O_RDONLY);
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
|
@ -427,7 +427,7 @@ static void *load_file(const char *filename, size_t *sz)
|
||||||
error(_("'%s': short read %s"), filename, strerror(errno));
|
error(_("'%s': short read %s"), filename, strerror(errno));
|
||||||
close(i);
|
close(i);
|
||||||
free(data);
|
free(data);
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
close(i);
|
close(i);
|
||||||
data[*sz] = 0;
|
data[*sz] = 0;
|
||||||
|
|
|
@ -294,7 +294,7 @@ static void *unpack_raw_entry(struct object_entry *obj, union delta_base *delta_
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
obj->idx.offset = consumed_bytes;
|
obj->idx.offset = consumed_bytes;
|
||||||
input_crc32 = crc32(0, Z_NULL, 0);
|
input_crc32 = crc32(0, NULL, 0);
|
||||||
|
|
||||||
p = fill(1);
|
p = fill(1);
|
||||||
c = *p;
|
c = *p;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "cache.h"
|
#include "builtin.h"
|
||||||
#include "pack.h"
|
#include "pack.h"
|
||||||
#include "refs.h"
|
#include "refs.h"
|
||||||
#include "pkt-line.h"
|
#include "pkt-line.h"
|
||||||
|
|
|
@ -116,7 +116,7 @@ struct sha1file *sha1fd_throughput(int fd, const char *name, struct progress *tp
|
||||||
|
|
||||||
void crc32_begin(struct sha1file *f)
|
void crc32_begin(struct sha1file *f)
|
||||||
{
|
{
|
||||||
f->crc32 = crc32(0, Z_NULL, 0);
|
f->crc32 = crc32(0, NULL, 0);
|
||||||
f->do_crc = 1;
|
f->do_crc = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ int check_pack_crc(struct packed_git *p, struct pack_window **w_curs,
|
||||||
off_t offset, off_t len, unsigned int nr)
|
off_t offset, off_t len, unsigned int nr)
|
||||||
{
|
{
|
||||||
const uint32_t *index_crc;
|
const uint32_t *index_crc;
|
||||||
uint32_t data_crc = crc32(0, Z_NULL, 0);
|
uint32_t data_crc = crc32(0, NULL, 0);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
unsigned int avail;
|
unsigned int avail;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "cache.h"
|
#include "cache.h"
|
||||||
#include "pkt-line.h"
|
#include "pkt-line.h"
|
||||||
|
|
||||||
const char *packet_trace_prefix = "git";
|
static const char *packet_trace_prefix = "git";
|
||||||
static const char trace_key[] = "GIT_TRACE_PACKET";
|
static const char trace_key[] = "GIT_TRACE_PACKET";
|
||||||
|
|
||||||
void packet_trace_identity(const char *prog)
|
void packet_trace_identity(const char *prog)
|
||||||
|
|
2
rerere.c
2
rerere.c
|
@ -438,7 +438,7 @@ static int merge(const char *name, const char *path)
|
||||||
ret = 1;
|
ret = 1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
ret = ll_merge(&result, path, &base, NULL, &cur, "", &other, "", 0);
|
ret = ll_merge(&result, path, &base, NULL, &cur, "", &other, "", NULL);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче