Print this page
10132 smatch fixes for MDB
Reviewed by: Andy Fiddaman <andy@omniosce.org>

@@ -18,11 +18,11 @@
  *
  * CDDL HEADER END
  */
 /*
  * Copyright (c) 2013 by Delphix. All rights reserved.
- * Copyright (c) 2012 Joyent, Inc. All rights reserved.
+ * Copyright (c) 2018, Joyent, Inc.
  * Copyright (c) 2013 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  */
 /*
  * This file contains all of the interfaces for mdb's tab completion engine.
  * Currently some interfaces are private to mdb and its internal implementation,

@@ -401,12 +401,11 @@
 
         /*
          * If we have a match set, then we want to verify that we actually match
          * it.
          */
-        if (mcp->mtc_base != NULL &&
-            strncmp(name, mcp->mtc_base, strlen(mcp->mtc_base)) != 0)
+        if (strncmp(name, mcp->mtc_base, strlen(mcp->mtc_base)) != 0)
                 return;
 
         v = mdb_nv_lookup(&mcp->mtc_nv, name);
         if (v != NULL)
                 return;

@@ -441,17 +440,11 @@
 }
 
 const char *
 mdb_tab_match(mdb_tab_cookie_t *mcp)
 {
-        size_t blen;
-
-        if (mcp->mtc_base == NULL)
-                blen = 0;
-        else
-                blen = strlen(mcp->mtc_base);
-        return (mcp->mtc_match + blen);
+        return (mcp->mtc_match + strlen(mcp->mtc_base));
 }
 
 void
 mdb_tab_setmbase(mdb_tab_cookie_t *mcp, const char *base)
 {