Fix copyright lines
[folly.git] / folly / test / AtomicHashArrayTest.cpp
index 531732c4b63bcbbfba7429d9e591ce08f0cef519..7f34beb575ba896e0464649ab4e559e34a6d8e1c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 Facebook, Inc.
+ * Copyright 2012-present Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
 
 #include <cstddef>
 #include <map>
+#include <memory>
 #include <stdexcept>
 
 #include <folly/AtomicHashArray.h>
@@ -74,7 +75,9 @@ class MmapAllocator {
   T *allocate(size_t n) {
     void *p = mmap(nullptr, n * sizeof(T), PROT_READ | PROT_WRITE,
         MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-    if (p == MAP_FAILED) throw std::bad_alloc();
+    if (p == MAP_FAILED) {
+      throw std::bad_alloc();
+    }
     return (T *)p;
   }
 
@@ -152,7 +155,7 @@ void testNoncopyableMap() {
 
   auto arr = MyArr::create(250);
   for (int i = 0; i < 100; i++) {
-    arr->insert(make_pair(i,std::unique_ptr<ValueT>(new ValueT(i))));
+    arr->insert(make_pair(i, std::make_unique<ValueT>(i)));
   }
   for (int i = 100; i < 150; i++) {
     arr->emplace(i,new ValueT(i));
@@ -264,7 +267,9 @@ struct EqTraits {
 struct HashTraits {
   size_t operator()(char* a) {
     size_t result = 0;
-    while (a[0] != 0) result += static_cast<size_t>(*(a++));
+    while (a[0] != 0) {
+      result += static_cast<size_t>(*(a++));
+    }
     return result;
   }
   size_t operator()(const char& a) {
@@ -272,7 +277,9 @@ struct HashTraits {
   }
   size_t operator()(const StringPiece a) {
     size_t result = 0;
-    for (const auto& ch : a) result += static_cast<size_t>(ch);
+    for (const auto& ch : a) {
+      result += static_cast<size_t>(ch);
+    }
     return result;
   }
 };