Skip to content

Commit

Permalink
remove folly hash from codebase (#41148)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #41148

changelog: [internal]

RN moved away from using folly::hash. These are a few places missed during the migration.

Reviewed By: cipolleschi

Differential Revision: D50540176

fbshipit-source-id: 497c13032c23c5b2dfab9e3d6f226f596b90761e
  • Loading branch information
sammy-SC authored and facebook-github-bot committed Oct 24, 2023
1 parent 2c90024 commit 70acd3f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <limits>
#include <optional>

#include <folly/Hash.h>
#include <react/renderer/attributedstring/primitives.h>
#include <react/renderer/components/view/AccessibilityPrimitives.h>
#include <react/renderer/core/LayoutPrimitives.h>
Expand All @@ -20,6 +19,7 @@
#include <react/renderer/graphics/Color.h>
#include <react/renderer/graphics/Float.h>
#include <react/renderer/graphics/Size.h>
#include <react/utils/hash_combine.h>

namespace facebook::react {

Expand Down Expand Up @@ -108,8 +108,7 @@ template <>
struct hash<facebook::react::TextAttributes> {
size_t operator()(
const facebook::react::TextAttributes& textAttributes) const {
return folly::hash::hash_combine(
0,
return facebook::react::hash_combine(
textAttributes.foregroundColor,
textAttributes.backgroundColor,
textAttributes.opacity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#include "RawPropsParser.h"

#include <folly/Hash.h>
#include <folly/Likely.h>
#include <react/debug/react_native_assert.h>
#include <react/renderer/core/RawProps.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#pragma once

#include <folly/Hash.h>
#include <limits>

namespace facebook::react {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,7 @@ inline size_t textAttributedStringHashLayoutWise(
auto seed = size_t{0};

for (const auto& fragment : attributedString.getFragments()) {
seed =
folly::hash::hash_combine(seed, textAttributesHashLayoutWise(fragment));
facebook::react::hash_combine(seed, textAttributesHashLayoutWise(fragment));
}

return seed;
Expand Down Expand Up @@ -208,8 +207,7 @@ namespace std {
template <>
struct hash<facebook::react::TextMeasureCacheKey> {
size_t operator()(const facebook::react::TextMeasureCacheKey& key) const {
return folly::hash::hash_combine(
0,
return facebook::react::hash_combine(
textAttributedStringHashLayoutWise(key.attributedString),
key.paragraphAttributes,
key.layoutConstraints.maximumSize.width);
Expand Down

0 comments on commit 70acd3f

Please sign in to comment.