diff options
author | Ciro Santilli <ciro.santilli@gmail.com> | 2014-09-16 13:49:25 +0400 |
---|---|---|
committer | Ciro Santilli <ciro.santilli@gmail.com> | 2014-09-16 15:07:04 +0400 |
commit | 3b2cb2c91ee77e5e45957e8355025e3e742c07bd (patch) | |
tree | 01213a03d821babf6103754afe64fed6e9849a6f /src | |
parent | 3a495c19bd280f5455047a9ac0e936f2c2f2f9a9 (diff) |
Factor 40 and 41 constants from source.
Diffstat (limited to 'src')
-rw-r--r-- | src/global.h | 3 | ||||
-rw-r--r-- | src/odb_loose.c | 2 | ||||
-rw-r--r-- | src/transports/smart_protocol.c | 6 |
3 files changed, 6 insertions, 5 deletions
diff --git a/src/global.h b/src/global.h index 106504628..a89a8d6ab 100644 --- a/src/global.h +++ b/src/global.h @@ -7,13 +7,14 @@ #ifndef INCLUDE_global_h__ #define INCLUDE_global_h__ +#include "common.h" #include "mwindow.h" #include "hash.h" typedef struct { git_error *last_error; git_error error_t; - char oid_fmt[41]; + char oid_fmt[GIT_OID_HEXSZ+1]; } git_global_st; #ifdef GIT_SSL diff --git a/src/odb_loose.c b/src/odb_loose.c index b2e8bed4d..ef6de41a9 100644 --- a/src/odb_loose.c +++ b/src/odb_loose.c @@ -714,7 +714,7 @@ struct foreach_state { GIT_INLINE(int) filename_to_oid(git_oid *oid, const char *ptr) { int v, i = 0; - if (strlen(ptr) != 41) + if (strlen(ptr) != GIT_OID_HEXSZ+1) return -1; if (ptr[2] != '/') { diff --git a/src/transports/smart_protocol.c b/src/transports/smart_protocol.c index 5ca5065ac..7c20382dc 100644 --- a/src/transports/smart_protocol.c +++ b/src/transports/smart_protocol.c @@ -640,9 +640,9 @@ static int gen_pktline(git_buf *buf, git_push *push) { push_spec *spec; size_t i, len; - char old_id[41], new_id[41]; + char old_id[GIT_OID_HEXSZ+1], new_id[GIT_OID_HEXSZ+1]; - old_id[40] = '\0'; new_id[40] = '\0'; + old_id[GIT_OID_HEXSZ] = '\0'; new_id[GIT_OID_HEXSZ] = '\0'; git_vector_foreach(&push->specs, i, spec) { len = 2*GIT_OID_HEXSZ + 7 + strlen(spec->rref); @@ -963,7 +963,7 @@ int git_smart__push(git_transport *transport, git_push *push) #ifdef PUSH_DEBUG { git_remote_head *head; - char hex[41]; hex[40] = '\0'; + char hex[GIT_OID_HEXSZ+1]; hex[GIT_OID_HEXSZ] = '\0'; git_vector_foreach(&push->remote->refs, i, head) { git_oid_fmt(hex, &head->oid); |