Bug 1542736 - Part 9: Replace std::isspace with js::unicode::IsSpace. r=jwalden
authorAndré Bargull <andre.bargull@gmail.com>
Thu, 11 Apr 2019 11:37:26 +0000
changeset 530944 e28d3c25f82c2246bcd3edf3a73f5fb1d0899a20
parent 530943 ad9ff91000a99f6f12ea5338776aa883659c2986
child 530945 27abf0e843c3122eb5318774f1a069c8606665b7
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwalden
bugs1542736
milestone68.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 1542736 - Part 9: Replace std::isspace with js::unicode::IsSpace. r=jwalden Remove the last remaining call to ctype functions. Differential Revision: https://phabricator.services.mozilla.com/D26512
js/src/shell/jsoptparse.cpp
--- a/js/src/shell/jsoptparse.cpp
+++ b/js/src/shell/jsoptparse.cpp
@@ -1,21 +1,22 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * vim: set ts=8 sts=2 et sw=2 tw=80:
  * 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/. */
 
 #include "shell/jsoptparse.h"
 
-#include <ctype.h>
 #include <stdarg.h>
 
 #include "jsutil.h"
 
+#include "util/Unicode.h"
+
 using namespace js;
 using namespace js::cli;
 using namespace js::cli::detail;
 
 const char OptionParser::prognameMeta[] = "{progname}";
 
 #define OPTION_CONVERT_IMPL(__cls)                                             \
   bool Option::is##__cls##Option() const { return kind == OptionKind##__cls; } \
@@ -70,26 +71,26 @@ static void PrintParagraph(const char* t
   unsigned indent = 0;
   const char* it = text;
 
   if (padFirstLine) {
     printf("%*s", startColno, "");
   }
 
   /* Skip any leading spaces. */
-  while (*it != '\0' && isspace(*it)) {
+  while (*it != '\0' && unicode::IsSpace(*it)) {
     ++it;
   }
 
   while (*it != '\0') {
-    MOZ_ASSERT(!isspace(*it) || *it == '\n');
+    MOZ_ASSERT(!unicode::IsSpace(*it) || *it == '\n');
 
     /* Delimit the current token. */
     const char* limit = it;
-    while (!isspace(*limit) && *limit != '\0') {
+    while (!unicode::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.
      */
     size_t tokLen = limit - it;