Skip to content

Commit 0b1e654

Browse files
rsahlberggitster
authored andcommitted
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 <[email protected]> Signed-off-by: Stefan Beller <[email protected]> Signed-off-by: Michael Haggerty <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fa5b183 commit 0b1e654

File tree

2 files changed

+12
-21
lines changed

2 files changed

+12
-21
lines changed

refs.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2090,6 +2090,16 @@ int refname_match(const char *abbrev_name, const char *full_name)
20902090
return 0;
20912091
}
20922092

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+
20932103
/* This function should make sure errno is meaningful on error */
20942104
static struct ref_lock *verify_lock(struct ref_lock *lock,
20952105
const unsigned char *old_sha1, int mustexist)
@@ -2888,32 +2898,22 @@ int rename_ref(const char *oldrefname, const char *newrefname, const char *logms
28882898
return 1;
28892899
}
28902900

2891-
int close_ref(struct ref_lock *lock)
2901+
static int close_ref(struct ref_lock *lock)
28922902
{
28932903
if (close_lock_file(lock->lk))
28942904
return -1;
28952905
lock->lock_fd = -1;
28962906
return 0;
28972907
}
28982908

2899-
int commit_ref(struct ref_lock *lock)
2909+
static int commit_ref(struct ref_lock *lock)
29002910
{
29012911
if (commit_lock_file(lock->lk))
29022912
return -1;
29032913
lock->lock_fd = -1;
29042914
return 0;
29052915
}
29062916

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-
29172917
/*
29182918
* copy the reflog message msg to buf, which has been allocated sufficiently
29192919
* large, while cleaning up the whitespaces. Especially, convert LF to space,

refs.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -198,15 +198,6 @@ extern struct ref_lock *lock_any_ref_for_update(const char *refname,
198198
const unsigned char *old_sha1,
199199
int flags, int *type_p);
200200

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-
210201
/*
211202
* Setup reflog before using. Set errno to something meaningful on failure.
212203
*/

0 commit comments

Comments
 (0)