Remove fxcrt::Subspan().

It is only used in one place apart from tests. It was probably an
evolutionary mistake as it isn't as useful as hoped since it has
trouble deducing types, and the explicit calls to make_span() are
clearer, anyways.

-- Allow removing dependence on <vector>.

Change-Id: Idf102e4b55687214091c5e9c19ed05557560ab3d
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/85570
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfapi/edit/cpdf_creator.cpp b/core/fpdfapi/edit/cpdf_creator.cpp
index cc7a444..af0ecb3 100644
--- a/core/fpdfapi/edit/cpdf_creator.cpp
+++ b/core/fpdfapi/edit/cpdf_creator.cpp
@@ -79,7 +79,7 @@
   size_t temp_size = size;
   while (temp_size) {
     size_t buf_size = std::min(kArchiveBufferSize - current_length_, temp_size);
-    fxcrt::spancpy(fxcrt::Subspan(buffer_, current_length_),
+    fxcrt::spancpy(pdfium::make_span(buffer_).subspan(current_length_),
                    pdfium::make_span(buffer, buf_size));
 
     current_length_ += buf_size;
diff --git a/core/fxcrt/span_util.h b/core/fxcrt/span_util.h
index 6d23497..b4bdabd 100644
--- a/core/fxcrt/span_util.h
+++ b/core/fxcrt/span_util.h
@@ -7,8 +7,6 @@
 
 #include <string.h>
 
-#include <vector>
-
 #include "third_party/base/check_op.h"
 #include "third_party/base/span.h"
 
@@ -44,14 +42,6 @@
   memset(dst.data(), 0, dst.size_bytes());
 }
 
-// Extracting subspans from arrays.
-template <typename T, typename A>
-pdfium::span<T> Subspan(std::vector<T, A>& vec,
-                        size_t start,
-                        size_t count = -1) {
-  return pdfium::make_span(vec).subspan(start, count);
-}
-
 }  // namespace fxcrt
 
 #endif  // CORE_FXCRT_SPAN_UTIL_H_
diff --git a/core/fxcrt/span_util_unittest.cpp b/core/fxcrt/span_util_unittest.cpp
index aae4f43..e304e91 100644
--- a/core/fxcrt/span_util_unittest.cpp
+++ b/core/fxcrt/span_util_unittest.cpp
@@ -19,7 +19,7 @@
 
 TEST(Spanset, Empty) {
   std::vector<char> dst(4, 'B');
-  fxcrt::spanset(fxcrt::Subspan(dst, 4), 'A');
+  fxcrt::spanset(pdfium::make_span(dst).subspan(4), 'A');
   EXPECT_EQ(dst[0], 'B');
   EXPECT_EQ(dst[1], 'B');
   EXPECT_EQ(dst[2], 'B');
@@ -40,7 +40,8 @@
   std::vector<char> src(2, 'A');
   std::vector<char> dst(4, 'B');
   // Also show that a const src argument is acceptable.
-  fxcrt::spancpy(fxcrt::Subspan(dst, 1), pdfium::span<const char>(src));
+  fxcrt::spancpy(pdfium::make_span(dst).subspan(1),
+                 pdfium::span<const char>(src));
   EXPECT_EQ(dst[0], 'B');
   EXPECT_EQ(dst[1], 'A');
   EXPECT_EQ(dst[2], 'A');
@@ -50,7 +51,8 @@
 TEST(Spancpy, EmptyCopyWithin) {
   std::vector<char> src(2, 'A');
   std::vector<char> dst(4, 'B');
-  fxcrt::spancpy(fxcrt::Subspan(dst, 1), fxcrt::Subspan(src, 2));
+  fxcrt::spancpy(pdfium::make_span(dst).subspan(1),
+                 pdfium::make_span(src).subspan(2));
   EXPECT_EQ(dst[0], 'B');
   EXPECT_EQ(dst[1], 'B');
   EXPECT_EQ(dst[2], 'B');
@@ -60,7 +62,8 @@
 TEST(Spancpy, EmptyCopyToEmpty) {
   std::vector<char> src(2, 'A');
   std::vector<char> dst(4, 'B');
-  fxcrt::spancpy(fxcrt::Subspan(dst, 4), fxcrt::Subspan(src, 2));
+  fxcrt::spancpy(pdfium::make_span(dst).subspan(4),
+                 pdfium::make_span(src).subspan(2));
   EXPECT_EQ(dst[0], 'B');
   EXPECT_EQ(dst[1], 'B');
   EXPECT_EQ(dst[2], 'B');
@@ -71,7 +74,8 @@
   std::vector<char> src(2, 'A');
   std::vector<char> dst(4, 'B');
   // Also show that a const src argument is acceptable.
-  fxcrt::spanmove(fxcrt::Subspan(dst, 1), pdfium::span<const char>(src));
+  fxcrt::spanmove(pdfium::make_span(dst).subspan(1),
+                  pdfium::span<const char>(src));
   EXPECT_EQ(dst[0], 'B');
   EXPECT_EQ(dst[1], 'A');
   EXPECT_EQ(dst[2], 'A');