Bug 1248352 - Allow shell option parsing code to handle help text containing blank lines r=jandem
authorJon Coppeard <jcoppeard@mozilla.com>
Fri, 26 Feb 2016 11:04:15 +0000
changeset 322033 f19129c21eb309e5ce4142c7941c7ebd0aa3995b
parent 322032 ca189bd124fa6c2ecbd1fdca56aab60ed09d26bb
child 322034 07438c9bfc83970721893d77a6daf1bc0c5fd72d
child 322133 94593f55cd01bd9d2f227f211eec535a61bc7670
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1248352
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1248352 - Allow shell option parsing code to handle help text containing blank lines r=jandem
js/src/shell/jsoptparse.cpp
--- a/js/src/shell/jsoptparse.cpp
+++ b/js/src/shell/jsoptparse.cpp
@@ -90,30 +90,28 @@ PrintParagraph(const char* text, unsigne
     if (padFirstLine)
         printf("%*s", startColno, "");
 
     /* Skip any leading spaces. */
     while (*it != '\0' && isspace(*it))
         ++it;
 
     while (*it != '\0') {
-        MOZ_ASSERT(!isspace(*it));
+        MOZ_ASSERT(!isspace(*it) || *it == '\n');
 
         /* Delimit the current token. */
         const char* limit = it;
         while (!isspace(*limit) && *limit != '\0')
             ++limit;
 
         /*
          * If the current token is longer than the available number of columns,
          * then make a line break before printing the token.
          */
-        MOZ_ASSERT(limit - it > 0);
         size_t tokLen = limit - it;
-        MOZ_ASSERT(tokLen);
         if (tokLen + colno >= limitColno) {
             printf("\n%*s%.*s", startColno + indent, "", int(tokLen), it);
             colno = startColno + tokLen;
         } else {
             printf("%.*s", int(tokLen), it);
             colno += tokLen;
         }