Bug 1280844 - Remove useless assert() in pathsub.c. r?mt. draft
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 21 Jun 2016 09:59:17 +1000
changeset 380169 861c92565f6c16310f84953804e9365d7c1302cc
parent 380168 1d074646eac0776e03818fec6ab2dede4f6aa9f3
child 380170 f715f0bb465f9925ecd19d6fca66093147e6401e
push id21158
push usernnethercote@mozilla.com
push dateMon, 20 Jun 2016 23:59:39 +0000
reviewersmt
bugs1280844
milestone50.0a1
Bug 1280844 - Remove useless assert() in pathsub.c. r?mt. The assert() assumes that |from| and |to| are non-null, which the subsequent check does not assume. It's also redundant w.r.t. the subsequent checks, which will cause informative termination on failure. It's also the only assert() in this file. MozReview-Commit-ID: GSAgvINeEpJ
security/nss/coreconf/nsinstall/pathsub.c
--- a/security/nss/coreconf/nsinstall/pathsub.c
+++ b/security/nss/coreconf/nsinstall/pathsub.c
@@ -1,16 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
 ** Pathname subroutines.
 */
-#include <assert.h>
 #if defined(FREEBSD) || defined(BSDI) || defined(DARWIN)
 #include <sys/types.h>
 #endif /* FREEBSD */
 #include <dirent.h>
 #include <errno.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -153,17 +152,16 @@ xchdir(char *dir)
 
 int
 relatepaths(char *from, char *to, char *outpath)
 {
     char *cp, *cp2;
     int len;
     char buf[NAME_MAX];
 
-    assert(*from == '/' && *to == '/');
     if (!from || *from != '/')
 	fail("relatepaths: from path does not start with /");
     if (!to || *to != '/')
 	fail("relatepaths: to   path does not start with /");
 
     for (cp = to, cp2 = from; *cp == *cp2; cp++, cp2++)
 	if (*cp == '\0')
 	    break;