commit 6b42af1e1d379806c1ef2cccfa084a7b8de605f1 from: Omar Polo via: Thomas Adam date: Fri Sep 02 15:54:01 2022 UTC gotwebd: minor tweaks drop: - a tautological s[strlen(s)] == '\0' - a few duplicates checks - a lone if (error) when it's always NULL - an extra NULL check part of a bigger diff that's ok stsp@ commit - 4630b4b581adda0b6e703db535a33f297f6f3701 commit + 6b42af1e1d379806c1ef2cccfa084a7b8de605f1 blob - 8bab9ebf45502b258b33fe85e4c48fc1643e1e37 blob + 666bccbe101c17a74289291ee61102b8a25c7017 --- gotwebd/got_operations.c +++ gotwebd/got_operations.c @@ -227,8 +227,7 @@ got_get_repo_commit(struct request *c, struct repo_com name += 6; if (strncmp(name, "remotes/", 8) == 0) { name += 8; - s = strstr(name, "/" GOT_REF_HEAD); - if (s != NULL && s[strlen(s)] == '\0') + if (strstr(name, "/" GOT_REF_HEAD) != NULL) continue; } error = got_ref_resolve(&ref_id, t->repo, re->ref); @@ -522,10 +521,6 @@ got_get_repo_commits(struct request *c, int limit) if (commit) { got_object_commit_close(commit); commit = NULL; - } - if (t->next_id == NULL) { - error = got_error_from_errno("strdup"); - goto done; } TAILQ_REMOVE(&t->repo_commits, new_repo_commit, entry); @@ -585,9 +580,6 @@ got_get_repo_tags(struct request *c, int limit) repo_dir->name) == -1) return got_error_from_errno("asprintf"); - if (error) - return error; - if (qs->commit == NULL && qs->action == TAGS) { error = got_ref_open(&ref, repo, qs->headref, 0); if (error) @@ -724,10 +716,6 @@ got_get_repo_tags(struct request *c, int limit) got_object_commit_close(commit); commit = NULL; } - if (t->next_id == NULL) { - error = got_error_from_errno("strdup"); - goto err; - } TAILQ_REMOVE(&t->repo_tags, new_repo_tag, entry); gotweb_free_repo_tag(new_repo_tag); goto done; blob - 07bf64267469d191992ebd75b8bd4d22fee7a4f6 blob + d53434630171a876941517eff6fb77fb26a15bea --- gotwebd/gotweb.c +++ gotwebd/gotweb.c @@ -606,10 +606,8 @@ gotweb_free_transport(struct transport *t) } gotweb_free_repo_dir(t->repo_dir); gotweb_free_querystring(t->qs); - if (t != NULL) { - free(t->next_id); - free(t->prev_id); - } + free(t->next_id); + free(t->prev_id); free(t); }