The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=b60164c9f4d823b3e9fbcb733f92d181c704f415

commit b60164c9f4d823b3e9fbcb733f92d181c704f415
Author:     Warner Losh <[email protected]>
AuthorDate: 2022-11-29 20:02:40 +0000
Commit:     Warner Losh <[email protected]>
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));
 }
 
 /*

Reply via email to