Commit c495dd26 authored by Lucian Grijincu's avatar Lucian Grijincu Committed by Facebook Github Bot

folly: deprecate StringPiece::hash

Summary: It's bad mkey. Says so on the tin can. Alert/annoy its users.

Reviewed By: yfeldblum, ot

Differential Revision: D3973625

fbshipit-source-id: 23f4e16182749d016084fcb378a1170ff402c259
parent 6e765416
...@@ -442,6 +442,19 @@ public: ...@@ -442,6 +442,19 @@ public:
// (The above advice does not apply if you are targeting a 32-bit system.) // (The above advice does not apply if you are targeting a 32-bit system.)
// //
// Works only for Range<const char*> and Range<char*> // Works only for Range<const char*> and Range<char*>
//
//
// ** WANT TO GET RID OF THIS LINT? **
//
// A) Use a better hash function (*cough*folly::Hash*cough*), but
// only if you don't serialize data in a format that depends on
// this formula (ie the writer and reader assume this exact hash
// function is used).
//
// B) If you have to use this exact function then make your own hasher
// object and copy the body over (see thrift example: D3972362).
// https://github.com/facebook/fbthrift/commit/f8ed502e24ab4a32a9d5f266580
FOLLY_DEPRECATED("Replace with folly::Hash if the hash is not serialized")
uint32_t hash() const { uint32_t hash() const {
// Taken from fbi/nstring.h: // Taken from fbi/nstring.h:
// Quick and dirty bernstein hash...fine for short ascii strings // Quick and dirty bernstein hash...fine for short ascii strings
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment