From nobody Tue Nov 29 20:12:04 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NMD5K1D42z4jfmv; Tue, 29 Nov 2022 20:12:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NMD5K0LVcz3K2X; Tue, 29 Nov 2022 20:12:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669752725; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uWe6EgMxXIURctor6G62oyRDSTBdYmyMwjXV1p/hLHU=; b=nqqwZplWW5c/moupv/XjsRAb8MniCzrksyTZSGgD0aCtuqYqmtqzHc4QPa5l9JV4MY1dFY vwjz2yfqGtKip5TU9JUjTLjHI4mKU1eWlvTxuqd693480W190UvYdXou4gz7LNvJxxUwY8 tR8S5yIwFETtYPWL0jQyEW0SeUj4vv4GR5sKAMJ7oNAXOZhdzS+2AO5rq1fl7e1pyxoIjl s6UEcjx5qrzXvvFP5dX8IOtShZ81gSIrR1tDy29J7c1c0cs0NOjx6EcyEf1QRGrvameZGI MtOnBneUH+Mor/ByMXtkoQpfgy/GV8C/oOJP6qGV11jv0KRpCZL9gwcxI2IGAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669752725; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uWe6EgMxXIURctor6G62oyRDSTBdYmyMwjXV1p/hLHU=; b=nuiwgVUjiJv65RAnIdKuYIruk+UYxMyK9u+TjvLfaIaqwAIKYLsvSu91JGMn5Qa0BTLCh8 k3yqtfoxOarCxaUEFX05kRU1GdCpV+4ILDyM/W8028MjW/Z3ICigd+8xK3hFUrYpUBVGvD jbzZZwqQM+H6dV3h+WG4S3pH3cYUYKRBI042rtIEgAeOKqxaN0L1Cmv5xtpfRqrlHvQ/um RhLzsF5KuTEB1i3HJ4IAGqg2NcaUXISExtJ4+FKSNN5g27b3DMknKXq6rUkbccv9ZJjX3g zMdug/dpVCUo95Y+t1XLtSzDHphYNsfnc0pvnlcc8TprKScVNPYVp0m86FSI4Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1669752725; a=rsa-sha256; cv=none; b=b/8o9r+h4QEJMaYlTZy9NS3nMQdZ/djmmgj3FIaqr2UdKSr3BGTPCWyfIbwHuFHuahELv7 s+FDWuYzm46gJG+CZquiWz7f2fCpKryCOisx5TLTxDDMOqYCpaQWlzel6ILdbS5uFRew62 FKVlEehz23FyKuE5KzH9ZDhiCGYrwStzKkyM/Mx+Ttx/T5pwIq3Ji8JUc4D+F1kYRmDgeY BRWcCow8C8iZXT7npl4KMA9RUv6hMUeYGsxyOhzbFYnqpigx5p+d9ZsLgy0zv48uKhfXdy VtrGCyIM+Bvay40tADS6VNONWJEUs4Ep4bncF9ZvpPTtodoZNns9JzIKoBhijQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NMD5J6WG9zVRN; Tue, 29 Nov 2022 20:12:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2ATKC4Vr069725; Tue, 29 Nov 2022 20:12:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2ATKC4S1069724; Tue, 29 Nov 2022 20:12:04 GMT (envelope-from git) Date: Tue, 29 Nov 2022 20:12:04 GMT Message-Id: <202211292012.2ATKC4S1069724@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: b60164c9f4d8 - main - stand/ofw: Use strpbrk instead of two strchrs List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b60164c9f4d823b3e9fbcb733f92d181c704f415 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=b60164c9f4d823b3e9fbcb733f92d181c704f415 commit b60164c9f4d823b3e9fbcb733f92d181c704f415 Author: Warner Losh AuthorDate: 2022-11-29 20:02:40 +0000 Commit: Warner Losh CommitDate: 2022-11-29 20:10:16 +0000 stand/ofw: Use strpbrk instead of two strchrs No need to call strchr twice, when one call to strpbrk will do the job.. Test booted with qemu-powerpc + mac99 successfully. Minor style(9) tweaks as well. Sponsored by: Netflix --- stand/libofw/devicename.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/stand/libofw/devicename.c b/stand/libofw/devicename.c index 11c0a1719ff3..353675db6b1f 100644 --- a/stand/libofw/devicename.c +++ b/stand/libofw/devicename.c @@ -43,27 +43,24 @@ static int ofw_parsedev(struct ofw_devdesc **, const char *, const char **); int ofw_getdev(void **vdev, const char *devspec, const char **path) { - struct ofw_devdesc **dev = (struct ofw_devdesc **)vdev; - int rv; + struct ofw_devdesc **dev = (struct ofw_devdesc **)vdev; + int rv; - /* - * If it looks like this is just a path and no - * device, go with the current device. - */ - if ((devspec == NULL) || - ((strchr(devspec, '@') == NULL) && - (strchr(devspec, ':') == NULL))) { - - if (((rv = ofw_parsedev(dev, getenv("currdev"), NULL)) == 0) && - (path != NULL)) - *path = devspec; - return(rv); - } + /* + * If it looks like this is just a path and no device, go with the current + * device. + */ + if (devspec == NULL || strpbrk(devspec, ":@") == NULL) { + if (((rv = ofw_parsedev(dev, getenv("currdev"), NULL)) == 0) && + (path != NULL)) + *path = devspec; + return(rv); + } - /* - * Try to parse the device name off the beginning of the devspec - */ - return(ofw_parsedev(dev, devspec, path)); + /* + * Try to parse the device name off the beginning of the devspec + */ + return(ofw_parsedev(dev, devspec, path)); } /*