From: Josh Rickmar Subject: Re: Move predeclaration to correct header To: Omar Polo Cc: gameoftrees@openbsd.org Date: Mon, 3 Jul 2023 15:12:54 -0400 On Mon, Jul 03, 2023 at 07:11:05PM +0200, Omar Polo wrote: > On 2023/07/03 11:23:01 -0400, Josh Rickmar wrote: > > Spotted this while copying library code for cvg. > > > > ok? > > ok > > although we can also do the opposite and make it static since it is > used only once in lib/worktree.c. Don't see anything that could be refactored to use this API, so here's the static version. diff d556241a037d31a830ef830c6cb301419bb84087 9dec9de109dcd16846c3e71ede4bbf63ffec85d7 commit - d556241a037d31a830ef830c6cb301419bb84087 commit + 9dec9de109dcd16846c3e71ede4bbf63ffec85d7 blob - a35884552cf66d678f0db623e1dd92d976a7014e blob + fefcc854456ad7fdcd7841dda7f3095162a212e6 --- lib/got_lib_worktree.h +++ lib/got_lib_worktree.h @@ -73,9 +73,6 @@ const struct got_error *got_worktree_get_base_ref_name #define GOT_WORKTREE_BASE_REF_PREFIX "refs/got/worktree/base" -const struct got_error *got_worktree_get_base_ref_name(char **, - struct got_worktree *worktree); - /* Temporary branch which accumulates commits during a rebase operation. */ #define GOT_WORKTREE_REBASE_TMP_REF_PREFIX "refs/got/worktree/rebase/tmp" blob - 39490809ede903773452d7a6331a5a959b7b756a blob + 20e319355137e3ec594f1a28760412c19ab58905 --- lib/worktree.c +++ lib/worktree.c @@ -2350,8 +2350,8 @@ const struct got_error * return get_ref_name(refname, worktree, prefix); } -const struct got_error * -got_worktree_get_base_ref_name(char **refname, struct got_worktree *worktree) +static const struct got_error * +get_base_ref_name(char **refname, struct got_worktree *worktree) { return get_ref_name(refname, worktree, GOT_WORKTREE_BASE_REF_PREFIX); } @@ -2448,7 +2448,7 @@ ref_base_commit(struct got_worktree *worktree, struct struct got_reference *ref = NULL; char *refname; - err = got_worktree_get_base_ref_name(&refname, worktree); + err = get_base_ref_name(&refname, worktree); if (err) return err;