Commit Diff


commit - 9e26f05792286fa1ff16e43516f1f4a688b672b9
commit + 102d840de78061d9f313aaa557ef64f586932143
blob - f450103ce056eeb7549745d5e9be8faf481f5f20
blob + ec4f8ac963eafff2950257bc022d8c5ab5f86a99
--- got/got.c
+++ got/got.c
@@ -877,7 +877,7 @@ cmd_import(int argc, char *argv[])
 	 * unveil(2) traverses exec(2); if an editor is used we have
 	 * to apply unveil after the log message has been written.
 	 */
-	if (logmsg == NULL || strlen(logmsg) == 0) {
+	if (logmsg == NULL || *logmsg == '\0') {
 		error = get_editor(&editor);
 		if (error)
 			goto done;
@@ -8914,7 +8914,7 @@ collect_commit_logmsg(struct got_pathlist_head *commit
 	size_t len;
 
 	/* if a message was specified on the command line, just use it */
-	if (a->cmdline_log != NULL && strlen(a->cmdline_log) != 0) {
+	if (a->cmdline_log != NULL && *a->cmdline_log != '\0') {
 		len = strlen(a->cmdline_log) + 1;
 		*logmsg = malloc(len + 1);
 		if (*logmsg == NULL)
blob - 6eed5edbe0ca8a4cc8d06fe1e24cf4c71e7648f6
blob + 1941a98fb622f228478b023b38875d38fd7d1561
--- gotwebd/config.c
+++ gotwebd/config.c
@@ -228,7 +228,7 @@ config_getsock(struct gotwebd *env, struct imsg *imsg)
 	    sock->conf.af_type == AF_UNIX ? "unix" :
 	    (sock->conf.af_type == AF_INET ? "inet" :
 	    (sock->conf.af_type == AF_INET6 ? "inet6" : "unknown")),
-	    strlen(sock->conf.unix_socket_name) ?
+	    *sock->conf.unix_socket_name != '\0' ?
 	    sock->conf.unix_socket_name : "none");
 
 	return 0;
blob - d87c6a8af195b8ced89fc29785a307e6156dba73
blob + d9bca1235cd0b28e27421abbdb85d29d125bd3f1
--- gotwebd/got_operations.c
+++ gotwebd/got_operations.c
@@ -342,7 +342,7 @@ got_get_repo_commits(struct request *c, size_t limit)
 
 	TAILQ_INIT(&refs);
 
-	if (qs->file != NULL && strlen(qs->file) > 0)
+	if (qs->file != NULL && *qs->file != '\0')
 		if (asprintf(&file_path, "%s/%s", qs->folder ? qs->folder : "",
 		    qs->file) == -1)
 			return got_error_from_errno("asprintf");
@@ -376,7 +376,7 @@ got_get_repo_commits(struct request *c, size_t limit)
 	if (error)
 		goto done;
 
-	if (qs->file != NULL && strlen(qs->file) > 0) {
+	if (qs->file != NULL && *qs->file != '\0') {
 		error = got_commit_graph_open(&graph, file_path, 0);
 		if (error)
 			goto done;
blob - d2716733267224b36363cf613d239bbbafff2239
blob + 59ca5bf55c49c212f0bcd9008f72ca685cfed645
--- gotwebd/gotweb.c
+++ gotwebd/gotweb.c
@@ -391,13 +391,13 @@ gotweb_get_server(uint8_t *server_name, uint8_t *subdo
 	struct server *srv = NULL;
 
 	/* check against the server name first */
-	if (strlen(server_name) > 0)
+	if (*server_name != '\0')
 		TAILQ_FOREACH(srv, &gotwebd_env->servers, entry)
 			if (strcmp(srv->name, server_name) == 0)
 				goto done;
 
 	/* check against subdomain second */
-	if (strlen(subdomain) > 0)
+	if (*subdomain != '\0')
 		TAILQ_FOREACH(srv, &gotwebd_env->servers, entry)
 			if (strcmp(srv->name, subdomain) == 0)
 				goto done;
@@ -613,7 +613,7 @@ qa_found:
 			}
 			break;
 		case INDEX_PAGE:
-			if (strlen(value) == 0)
+			if (*value == '\0')
 				break;
 			(*qs)->index_page = strtonum(value, INT64_MIN,
 			    INT64_MAX, &errstr);
@@ -634,7 +634,7 @@ qa_found:
 			}
 			break;
 		case PAGE:
-			if (strlen(value) == 0)
+			if (*value == '\0')
 				break;
 			(*qs)->page = strtonum(value, INT64_MIN,
 			    INT64_MAX, &errstr);
blob - 771a0c2547f73ef4ea0982ca4f4d1c6310d39522
blob + 1b80500f53fe828051e897701a7d5eef582c9b91
--- gotwebd/sockets.c
+++ gotwebd/sockets.c
@@ -231,7 +231,7 @@ sockets_conf_new_socket_fcgi(struct gotwebd *env, stru
 	memcpy(&acp->ss, &a->ss, sizeof(acp->ss));
 	acp->ipproto = a->ipproto;
 	acp->port = a->port;
-	if (strlen(a->ifname) != 0) {
+	if (*a->ifname != '\0') {
 		if (strlcpy(acp->ifname, a->ifname,
 		    sizeof(acp->ifname)) >= sizeof(acp->ifname)) {
 			fatalx("%s: interface name truncated",