name-rev: respect const qualifier
Keep the const qualifier of the first parameter of get_rev_name() even when casting the object pointer to a commit pointer, and further for the parameter of get_commit_rev_name(), as all these uses are read-only. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
71620ca86c
commit
36d2419c9a
|
@ -32,7 +32,7 @@ static struct commit_rev_name rev_names;
|
||||||
/* How many generations are maximally preferred over _one_ merge traversal? */
|
/* How many generations are maximally preferred over _one_ merge traversal? */
|
||||||
#define MERGE_TRAVERSAL_WEIGHT 65535
|
#define MERGE_TRAVERSAL_WEIGHT 65535
|
||||||
|
|
||||||
static struct rev_name *get_commit_rev_name(struct commit *commit)
|
static struct rev_name *get_commit_rev_name(const struct commit *commit)
|
||||||
{
|
{
|
||||||
struct rev_name **slot = commit_rev_name_peek(&rev_names, commit);
|
struct rev_name **slot = commit_rev_name_peek(&rev_names, commit);
|
||||||
|
|
||||||
|
@ -357,11 +357,11 @@ static const char *get_exact_ref_match(const struct object *o)
|
||||||
static const char *get_rev_name(const struct object *o, struct strbuf *buf)
|
static const char *get_rev_name(const struct object *o, struct strbuf *buf)
|
||||||
{
|
{
|
||||||
struct rev_name *n;
|
struct rev_name *n;
|
||||||
struct commit *c;
|
const struct commit *c;
|
||||||
|
|
||||||
if (o->type != OBJ_COMMIT)
|
if (o->type != OBJ_COMMIT)
|
||||||
return get_exact_ref_match(o);
|
return get_exact_ref_match(o);
|
||||||
c = (struct commit *) o;
|
c = (const struct commit *) o;
|
||||||
n = get_commit_rev_name(c);
|
n = get_commit_rev_name(c);
|
||||||
if (!n)
|
if (!n)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in New Issue