Move notFound into its own file
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Apr 2017 19:44:12 +0000 (19:44 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Apr 2017 19:44:12 +0000 (19:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=170972

Reviewed by Zalan Bujtas.

It is odd to require including <wtf/Vector.h> just to use WTF::notFound.
This is not causing any current problems, but does in few changes I have
queued up.

* WTF.xcodeproj/project.pbxproj:
* wtf/NotFound.h: Added.
* wtf/Vector.h:
* wtf/text/StringCommon.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@215571 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WTF/ChangeLog
Source/WTF/WTF.xcodeproj/project.pbxproj
Source/WTF/wtf/NotFound.h [new file with mode: 0644]
Source/WTF/wtf/Vector.h
Source/WTF/wtf/text/StringCommon.h

index 7da6db7..cdd2781 100644 (file)
@@ -1,3 +1,19 @@
+2017-04-20  Sam Weinig  <sam@webkit.org>
+
+        Move notFound into its own file
+        https://bugs.webkit.org/show_bug.cgi?id=170972
+
+        Reviewed by Zalan Bujtas.
+
+        It is odd to require including <wtf/Vector.h> just to use WTF::notFound.
+        This is not causing any current problems, but does in few changes I have
+        queued up.
+
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/NotFound.h: Added.
+        * wtf/Vector.h:
+        * wtf/text/StringCommon.h:
+
 2017-04-20  Filip Pizlo  <fpizlo@apple.com>
 
         Optimize SharedArrayBuffer in the DFG+FTL
index c34d148..94c116b 100644 (file)
                7CD4C2701E2C82B900929470 /* StringConcatenateNumbers.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CD4C26F1E2C82B900929470 /* StringConcatenateNumbers.h */; };
                7CDD7FF8186D291E007433CD /* IteratorAdaptors.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CDD7FF7186D291E007433CD /* IteratorAdaptors.h */; };
                7CDD7FFA186D2A54007433CD /* IteratorRange.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CDD7FF9186D2A54007433CD /* IteratorRange.h */; };
+               7CEAE5AD1EA6E10F00DB6890 /* NotFound.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CEAE5AC1EA6E10F00DB6890 /* NotFound.h */; };
                7E29C33E15FFD79B00516D61 /* ObjcRuntimeExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E29C33D15FFD79B00516D61 /* ObjcRuntimeExtras.h */; };
                8134013815B092FD001FF0B8 /* Base64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8134013615B092FD001FF0B8 /* Base64.cpp */; };
                8134013915B092FD001FF0B8 /* Base64.h in Headers */ = {isa = PBXBuildFile; fileRef = 8134013715B092FD001FF0B8 /* Base64.h */; };
                7CD4C26F1E2C82B900929470 /* StringConcatenateNumbers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringConcatenateNumbers.h; sourceTree = "<group>"; };
                7CDD7FF7186D291E007433CD /* IteratorAdaptors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IteratorAdaptors.h; sourceTree = "<group>"; };
                7CDD7FF9186D2A54007433CD /* IteratorRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IteratorRange.h; sourceTree = "<group>"; };
+               7CEAE5AC1EA6E10F00DB6890 /* NotFound.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotFound.h; sourceTree = "<group>"; };
                7E29C33D15FFD79B00516D61 /* ObjcRuntimeExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjcRuntimeExtras.h; sourceTree = "<group>"; };
                8134013615B092FD001FF0B8 /* Base64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Base64.cpp; sourceTree = "<group>"; };
                8134013715B092FD001FF0B8 /* Base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Base64.h; sourceTree = "<group>"; };
                                1A3F6BE6174ADA2100B2EEA7 /* NeverDestroyed.h */,
                                0F0D85B317234CB100338210 /* NoLock.h */,
                                A8A472D0151A825B004123FF /* Noncopyable.h */,
+                               7CEAE5AC1EA6E10F00DB6890 /* NotFound.h */,
                                A8A472D5151A825B004123FF /* NumberOfCores.cpp */,
                                A8A472D6151A825B004123FF /* NumberOfCores.h */,
                                7E29C33D15FFD79B00516D61 /* ObjcRuntimeExtras.h */,
                                0F2AC5611E89F70C0001EE3F /* Range.h in Headers */,
                                A8A4742C151A825B004123FF /* StringExtras.h in Headers */,
                                A8A4743F151A825B004123FF /* StringHash.h in Headers */,
+                               7CEAE5AD1EA6E10F00DB6890 /* NotFound.h in Headers */,
                                A748745417A0BDAE00FA04CB /* StringHashDumpContext.h in Headers */,
                                A8A47441151A825B004123FF /* StringImpl.h in Headers */,
                                A8A47442151A825B004123FF /* StringOperators.h in Headers */,
diff --git a/Source/WTF/wtf/NotFound.h b/Source/WTF/wtf/NotFound.h
new file mode 100644 (file)
index 0000000..904bcba
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+namespace WTF {
+
+constexpr size_t notFound = static_cast<size_t>(-1);
+
+}
+
+using WTF::notFound;
index df13da6..9333121 100644 (file)
@@ -30,6 +30,7 @@
 #include <wtf/FastMalloc.h>
 #include <wtf/MallocPtr.h>
 #include <wtf/Noncopyable.h>
+#include <wtf/NotFound.h>
 #include <wtf/StdLibExtras.h>
 #include <wtf/ValueCheck.h>
 #include <wtf/VectorTraits.h>
@@ -40,8 +41,6 @@ extern "C" void __sanitizer_annotate_contiguous_container(const void* begin, con
 
 namespace WTF {
 
-const size_t notFound = static_cast<size_t>(-1);
-
 template <bool needsDestruction, typename T>
 struct VectorDestructor;
 
@@ -1532,7 +1531,6 @@ size_t removeRepeatedElements(Vector<T, inlineCapacity, OverflowHandler, minCapa
 
 using WTF::Vector;
 using WTF::UnsafeVectorOverflow;
-using WTF::notFound;
 using WTF::removeRepeatedElements;
 
 #endif // WTF_Vector_h
index d35d890..bb664ae 100644 (file)
@@ -28,6 +28,7 @@
 
 #include <unicode/uchar.h>
 #include <wtf/ASCIICType.h>
+#include <wtf/NotFound.h>
 
 namespace WTF {