Commit Diff


commit - 39c864a48b9d156c8b748725f5f89b3bd3f65038
commit + 4448825ab554378228429f5ac53c9cf943cc2503
blob - 26af2f2535488277861a555a77b409586c5ada8e
blob + b713aa2e5f2e3920e0055fb2366825c0e1487eff
--- got/got.c
+++ got/got.c
@@ -878,7 +878,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;
@@ -8915,7 +8915,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 - b13f0b45ecb8c13c605728f061a869d69085a4e0
blob + 1c8057cb99a030e7a3b45871f35124b82101e918
--- 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 - 61bee36696a4edd811768fba90d50e909418b91f
blob + a7525287e2c962f40938fd909cdb0b9142d1f605
--- 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 - 983fb20185d96176ed732dfe115d8e8dd355b575
blob + 57acfb3983fd313a2a166e1c1296ed5262cb5b3d
--- gotwebd/gotweb.c
+++ gotwebd/gotweb.c
@@ -392,13 +392,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;
@@ -614,7 +614,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);
@@ -635,7 +635,7 @@ qa_found:
 			}
 			break;
 		case PAGE:
-			if (strlen(value) == 0)
+			if (*value == '\0')
 				break;
 			(*qs)->page = strtonum(value, INT64_MIN,
 			    INT64_MAX, &errstr);
blob - bf53d6f9bff50c34f85de2733fe7ae29ff2401d7
blob + 3f932978bf05a203c0c4bcd43bf7390fb4d153c8
--- 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",