Clean up Conv.cpp / Conv.h
authorMarcus Holland-Moritz <mhx@fb.com>
Thu, 23 Jun 2016 03:28:37 +0000 (20:28 -0700)
committerFacebook Github Bot 3 <facebook-github-bot-3-bot@fb.com>
Thu, 23 Jun 2016 03:38:33 +0000 (20:38 -0700)
Summary:
A bit of tidying up:

- Remove unused digit1 / digit2 arrays
- Remove unused MaxString<bool>
- Move MaxString<> entirely to Conv.cpp, as it's not used in Conv.h
- Extend anonymous namespace in Conv.cpp
- Sort headers in Conv.h

Reviewed By: yfeldblum

Differential Revision: D3433767

fbshipit-source-id: 224a68f22505c0f2014ac376154d004eca1658a9

folly/Conv.cpp
folly/Conv.h

index 7c6afcff1ffee1c7c2211ba0a2fdfec146d1c2e3..c78ed498d53e482410f9fd70cb86678e459e0cb6 100644 (file)
 namespace folly {
 namespace detail {
 
-extern const char digit1[101] =
-  "00000000001111111111222222222233333333334444444444"
-  "55555555556666666666777777777788888888889999999999";
-extern const char digit2[101] =
-  "01234567890123456789012345678901234567890123456789"
-  "01234567890123456789012345678901234567890123456789";
-
-template <> const char *const MaxString<bool>::value = "true";
+namespace {
+
+// Maximum value of number when represented as a string
+template <class T>
+struct MaxString {
+  static const char* const value;
+};
+
 template <> const char *const MaxString<uint8_t>::value = "255";
 template <> const char *const MaxString<uint16_t>::value = "65535";
 template <> const char *const MaxString<uint32_t>::value = "4294967295";
@@ -51,7 +51,6 @@ template <> const char *const MaxString<__uint128_t>::value =
   "340282366920938463463374607431768211455";
 #endif
 
-namespace {
 /*
  * Lookup tables that converts from a decimal character value to an integral
  * binary value, shifted by a decimal "shift" multiplier.
index 450896a65062f9e09cce0055e0b89dfdcea004ff..c0a350fe7c99bd2faf6c05b4067541a979423893 100644 (file)
 
 #pragma once
 
-#include <folly/FBString.h>
-#include <folly/Likely.h>
-#include <folly/Preprocessor.h>
-#include <folly/Range.h>
-
-#include <boost/implicit_cast.hpp>
 #include <algorithm>
-#include <type_traits>
+#include <climits>
+#include <cstddef>
 #include <limits>
+#include <stdexcept>
 #include <string>
 #include <tuple>
-#include <stdexcept>
+#include <type_traits>
 #include <typeinfo>
+#include <utility>
 
-#include <limits.h>
+#include <boost/implicit_cast.hpp>
+#include <double-conversion/double-conversion.h> // V8 JavaScript implementation
 
-// V8 JavaScript implementation
-#include <double-conversion/double-conversion.h>
+#include <folly/FBString.h>
+#include <folly/Likely.h>
+#include <folly/Preprocessor.h>
+#include <folly/Range.h>
 
 #define FOLLY_RANGE_CHECK_STRINGIZE(x) #x
 #define FOLLY_RANGE_CHECK_STRINGIZE2(x) FOLLY_RANGE_CHECK_STRINGIZE(x)
@@ -981,10 +981,6 @@ namespace detail {
     return b;
   }
 
-  // Maximum value of number when represented as a string
-  template <class T> struct MaxString {
-    static const char*const value;
-  };
 
   bool str_to_bool(StringPiece* src);
   float str_to_float(StringPiece* src);