MCPcopy Create free account
hub / github.com/apache/trafficserver / id_from_name

Method id_from_name

src/proxy/logging/LogFormat.cc:111–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109 -------------------------------------------------------------------------*/
110
111int32_t
112LogFormat::id_from_name(const char *name)
113{
114 int32_t id = 0;
115 if (name) {
116 CryptoHash hash;
117 CryptoContext().hash_immediate(hash, name, static_cast<int>(strlen(name)));
118#if defined(__linux__)
119 /* Mask most significant bit so that return value of this function
120 * is not sign extended to be a negative number.
121 * This problem is only known to occur on Linux which
122 * is a 32-bit OS.
123 */
124 id = static_cast<int32_t>(hash.fold()) & 0x7fffffff;
125#else
126 id = (int32_t)hash.fold();
127#endif
128 }
129 return id;
130}
131
132/*-------------------------------------------------------------------------
133 LogFormat::init_variables

Callers

nothing calls this directly

Calls 2

CryptoContextClass · 0.85
hash_immediateMethod · 0.45

Tested by

no test coverage detected