refs.c: remove unlock_ref/close_ref/commit_ref from the refs api

unlock|close|commit_ref can be made static since there are no more external callers. Signed-off-by: Ronnie Sahlberg <sahlberg@google.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ronnie Sahlberg committed Dec 12, 2014 at 09:57 UTC 0b1e654801e52243b63b57e27b50acdfe7c8f853
2 files changed +12 -21
refs.c
+12 -12
@@ -2090,6 +2090,16 @@ int refname_match(const char *abbrev_name, const char *full_name)
2090 return 0;
2091 }
2092
2093 +static void unlock_ref(struct ref_lock *lock)
2094 +{
2095 + /* Do not free lock->lk -- atexit() still looks at them */
2096 + if (lock->lk)
2097 + rollback_lock_file(lock->lk);
2098 + free(lock->ref_name);
2099 + free(lock->orig_ref_name);
2100 + free(lock);
2101 +}
2102 +
2103 /* This function should make sure errno is meaningful on error */
2104 static struct ref_lock *verify_lock(struct ref_lock *lock,
2105 const unsigned char *old_sha1, int mustexist)
@@ -2888,7 +2898,7 @@ int rename_ref(const char *oldrefname, const char *newrefname, const char *logms
2898 return 1;
2899 }
2900
2891 -int close_ref(struct ref_lock *lock)
2901 +static int close_ref(struct ref_lock *lock)
2902 {
2903 if (close_lock_file(lock->lk))
2904 return -1;
@@ -2896,7 +2906,7 @@ int close_ref(struct ref_lock *lock)
2906 return 0;
2907 }
2908
2899 -int commit_ref(struct ref_lock *lock)
2909 +static int commit_ref(struct ref_lock *lock)
2910 {
2911 if (commit_lock_file(lock->lk))
2912 return -1;
@@ -2904,16 +2914,6 @@ int commit_ref(struct ref_lock *lock)
2914 return 0;
2915 }
2916
2907 -void unlock_ref(struct ref_lock *lock)
2908 -{
2909 - /* Do not free lock->lk -- atexit() still looks at them */
2910 - if (lock->lk)
2911 - rollback_lock_file(lock->lk);
2912 - free(lock->ref_name);
2913 - free(lock->orig_ref_name);
2914 - free(lock);
2915 -}
2916 -
2917 /*
2918 * copy the reflog message msg to buf, which has been allocated sufficiently
2919 * large, while cleaning up the whitespaces. Especially, convert LF to space,
refs.h
-9
@@ -198,15 +198,6 @@ extern struct ref_lock *lock_any_ref_for_update(const char *refname,
198 const unsigned char *old_sha1,
199 int flags, int *type_p);
200
201 -/** Close the file descriptor owned by a lock and return the status */
202 -extern int close_ref(struct ref_lock *lock);
203 -
204 -/** Close and commit the ref locked by the lock */
205 -extern int commit_ref(struct ref_lock *lock);
206 -
207 -/** Release any lock taken but not written. **/
208 -extern void unlock_ref(struct ref_lock *lock);
209 -
201 /*
202 * Setup reflog before using. Set errno to something meaningful on failure.
203 */