From nobody Tue Jan 24 22:13:05 2023 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 4P1h756lvHz3bg9s; Tue, 24 Jan 2023 22:13: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 4P1h754CBXz3Fls; Tue, 24 Jan 2023 22:13:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674598385; 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=NDbPy44PbB/6vl8znJi8pd4GBLQDnF5mrCctm+ZxXaQ=; b=lyv4VUKCr+brgebI01qTCJLfdqppQ0LBthmkR/BCfGr0IeXh+fN+UpxtvbmaGe2tR1FTP9 AuneFsTloEyNkhOQHhub6Yh61+ubXgYgQ7Ld3CrLWLjFW/5w8J/3Ht+KHpVM3YBDo6rA8+ 3CniFNi6hsPvA4tv5qpy8w2EHlxtuZiMWMdWjRkiPuWbJh0LCi8YqWuBy2gc2twIkBtIaR 8LK1g8V6VkfHTyx7A3mLtEm3l3e41VwIUPeNizhBztb3E+7HjIGWaWlLc5J6/9aK67WHa6 HWDs4T3yfZNiaXCm/jxaHDo8BRgp+sGTaK0wCRkqHJO+ZqdffGou3WUjRACDXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674598385; 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=NDbPy44PbB/6vl8znJi8pd4GBLQDnF5mrCctm+ZxXaQ=; b=T9D/txpQoy5kKk29L3N4hpmCIU1VFdlO+zxpQQgD8A+MtwufHqZBNN9dkgEfRAdxqU5Cwp L2QixwYX1qL/smTjhBh4jeuODGg1QOY4nLc5SntbF/fk5no9UEDqUes8ExZxosr3sPfRrr CyG1qz+3reDBXdcXrkdh8IzfNQE3vFzex4eIeysSH1CstmYVRig3nGHKtUYuUb+TFGzFZj 3eqRxMUixuuqAYtQ61HHtvS/UozSMG/uXi62mx6aCLKfy9mbKp9VKZ/u2josOfBrPMA8Qc K+J7v8xYc4ArXPhdSKywfFndyEuYVQXvNsj9ZgfDSYjXqWb2z3QOC+CGMjoCLg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674598385; a=rsa-sha256; cv=none; b=CfVHsw66GGFHZqHYMGwWKysGB7/aNeXiH88hU4gTTJz39G6Az7SY+yZobLrBDogOWY0MbF tq5oK0tCUJZXBJ+oP2jsjJmuFLj/V1e7K86zRUlDdqCT4xO/4GzPqFy6d2rdI7hiDS2wha jGpMywz0xELHcjpfJoVFmWa00rf6wA3EEaBxR6TiypU4X3F0EiGLdWgfsDnxN6yDcSes9G K7JYDIZCcTYs3xbd9I4wEEIO3IInYN1VxEJ2qYwSV6jnyeMll0E4LSSCbaqNJNSQ4S4AAL 8AvIwhfAwobB8Et1R61GahW2R2wGx8uLG25M0ABS6kmTnF+EWsinmXw96t0zPA== 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 4P1h7534ZdzQfS; Tue, 24 Jan 2023 22:13:05 +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 30OMD5nG087936; Tue, 24 Jan 2023 22:13:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30OMD5BF087935; Tue, 24 Jan 2023 22:13:05 GMT (envelope-from git) Date: Tue, 24 Jan 2023 22:13:05 GMT Message-Id: <202301242213.30OMD5BF087935@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 6e6aabe8bc2c - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 6e6aabe8bc2cd31c84e9be263afd9d003a27cca2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=6e6aabe8bc2cd31c84e9be263afd9d003a27cca2 commit 6e6aabe8bc2cd31c84e9be263afd9d003a27cca2 Author: Warner Losh AuthorDate: 2022-11-29 20:02:40 +0000 Commit: Warner Losh CommitDate: 2023-01-24 21:49:37 +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 (cherry picked from commit b60164c9f4d823b3e9fbcb733f92d181c704f415) --- 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)); } /*