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
--- 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;