diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2014-10-01 12:28:15 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-10-01 13:45:11 -0700 |
commit | 7108ad232fc7a4c889e82b40c52125adc9796ff5 (patch) | |
tree | 21a15d1fe052aa839d0b4f536da92695b74d0f1b /refs.c | |
parent | 0a06f148373285822baf5f3e83696732a556a2d1 (diff) | |
download | git-7108ad232fc7a4c889e82b40c52125adc9796ff5.tar.gz |
cache.h: define constants LOCK_SUFFIX and LOCK_SUFFIX_LEN
There are a few places that use these values, so define constants for
them.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.c')
-rw-r--r-- | refs.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -79,7 +79,8 @@ out: if (refname[1] == '\0') return -1; /* Component equals ".". */ } - if (cp - refname >= 5 && !memcmp(cp - 5, ".lock", 5)) + if (cp - refname >= LOCK_SUFFIX_LEN && + !memcmp(cp - LOCK_SUFFIX_LEN, LOCK_SUFFIX, LOCK_SUFFIX_LEN)) return -1; /* Refname ends with ".lock". */ return cp - refname; } @@ -2602,11 +2603,11 @@ static int delete_ref_loose(struct ref_lock *lock, int flag) { if (!(flag & REF_ISPACKED) || flag & REF_ISSYMREF) { /* loose */ - int err, i = strlen(lock->lk->filename) - 5; /* .lock */ + int err, i = strlen(lock->lk->filename) - LOCK_SUFFIX_LEN; lock->lk->filename[i] = 0; err = unlink_or_warn(lock->lk->filename); - lock->lk->filename[i] = '.'; + lock->lk->filename[i] = LOCK_SUFFIX[0]; if (err && errno != ENOENT) return 1; } |