summaryrefslogtreecommitdiff
path: root/refs.h
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2014-04-07 15:47:57 +0200
committerJunio C Hamano <gitster@pobox.com>2014-04-07 12:09:11 -0700
commit595deb8da69b4f816ff0c8e669b49f7527ff609b (patch)
tree06079681c325df9e94ec4cdc967290fd27535f3e /refs.h
parentf412411245d4329307dec8ac0b1860c791cdb212 (diff)
downloadgit-595deb8da69b4f816ff0c8e669b49f7527ff609b.tar.gz
update_refs(): fix constness
The old signature of update_refs() required a (const struct ref_update **) for its updates_orig argument. The "const" is presumably there to promise that the function will not modify the contents of the structures. But this declaration does not permit the function to be called with a (struct ref_update **), which is perfectly legitimate. C's type system is not powerful enough to express what we'd like. So remove the first "const" from the declaration. On the other hand, the function *can* promise not to modify the pointers within the array that is passed to it without inconveniencing its callers. So add a "const" that has that effect, making the final declaration (struct ref_update * const *). Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.h')
-rw-r--r--refs.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/refs.h b/refs.h
index a713b34ad8..08e60ac07f 100644
--- a/refs.h
+++ b/refs.h
@@ -228,7 +228,7 @@ int update_ref(const char *action, const char *refname,
/**
* Lock all refs and then perform all modifications.
*/
-int update_refs(const char *action, const struct ref_update **updates,
+int update_refs(const char *action, struct ref_update * const *updates,
int n, enum action_on_err onerr);
extern int parse_hide_refs_config(const char *var, const char *value, const char *);