"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Mark Jamsek <mark@jamsek.com>
Subject:
change got_object_commit_dup() return type
To:
Game of Trees <gameoftrees@openbsd.org>
Date:
Mon, 12 Sep 2022 15:43:40 +1000

Download raw body.

Thread
This can be void. We could arguably drop the function and do this
inline, but using the function is more consistent with Got style imo.

ok?

diff /home/mark/src/got
commit - 568eae9578c8babb5be9eea6c85b9e016a6cdb29
path + /home/mark/src/got
blob - cb676e08ed97b46d2255d4e5b79240ed2b64d571
file + include/got_object.h
--- include/got_object.h
+++ include/got_object.h
@@ -353,5 +353,5 @@ const struct got_error *got_object_tag_create(struct g
     const char *, struct got_object_id *, const char *,
     time_t, const char *, const char *, struct got_repository *, int verbosity);
 
-const struct got_error *got_object_commit_dup(struct got_commit_object **,
+void got_object_commit_dup(struct got_commit_object **,
     struct got_commit_object *);
blob - 90b0dd61d77d94bbc79178c6692a4fc8946ce780
file + lib/object.c
--- lib/object.c
+++ lib/object.c
@@ -2354,11 +2354,10 @@ done:
 	return err;
 }
 
-const struct got_error *
+void
 got_object_commit_dup(struct got_commit_object **ret,
     struct got_commit_object *commit)
 {
 	*ret = commit;
 	commit->refcnt++;
-	return NULL;
 }
blob - 536b7b498bd4706495d95afcbdf091af274ce20d
file + tog/tog.c
--- tog/tog.c
+++ tog/tog.c
@@ -2226,11 +2226,8 @@ queue_commits(struct tog_log_thread_args *a)
 					    "alloc_commit_queue_entry");
 					break;
 				}
-
-				err = got_object_commit_dup(&matched->commit,
+				got_object_commit_dup(&matched->commit,
 				    entry->commit);
-				if (err)
-					break;
 
 				matched->idx = a->limit_commits->ncommits;
 				TAILQ_INSERT_TAIL(&a->limit_commits->head,
@@ -3041,14 +3038,8 @@ limit_log_view(struct tog_view *view)
 				    "alloc_commit_queue_entry");
 				break;
 			}
+			got_object_commit_dup(&matched->commit, entry->commit);
 
-			err = got_object_commit_dup(&matched->commit,
-			    entry->commit);
-			if (err) {
-				free(matched);
-				return err;
-			}
-
 			matched->idx = s->limit_commits.ncommits;
 			TAILQ_INSERT_TAIL(&s->limit_commits.head,
 			    matched, entry);

-- 
Mark Jamsek <fnc.bsdbox.org>
GPG: F2FF 13DE 6A06 C471 CA80  E6E2 2930 DC66 86EE CF68