src/cx/hash_key.h

changeset 985
68754c7de906
parent 890
54565fd74e74
equal deleted inserted replaced
984:e8f354a25ac8 985:68754c7de906
68 * 68 *
69 * \note If \c data is \c NULL, the hash is defined as 1574210520. 69 * \note If \c data is \c NULL, the hash is defined as 1574210520.
70 * 70 *
71 * @param key the key, the hash shall be computed for 71 * @param key the key, the hash shall be computed for
72 */ 72 */
73 cx_attr_nonnull
73 void cx_hash_murmur(CxHashKey *key); 74 void cx_hash_murmur(CxHashKey *key);
74 75
75 /** 76 /**
76 * Computes a hash key from a string. 77 * Computes a hash key from a string.
77 * 78 *
78 * The string needs to be zero-terminated. 79 * The string needs to be zero-terminated.
79 * 80 *
80 * @param str the string 81 * @param str the string
81 * @return the hash key 82 * @return the hash key
82 */ 83 */
83 __attribute__((__warn_unused_result__)) 84 cx_attr_nodiscard
85 cx_attr_cstr_arg(1)
84 CxHashKey cx_hash_key_str(const char *str); 86 CxHashKey cx_hash_key_str(const char *str);
85 87
86 /** 88 /**
87 * Computes a hash key from a byte array. 89 * Computes a hash key from a byte array.
88 * 90 *
89 * @param bytes the array 91 * @param bytes the array
90 * @param len the length 92 * @param len the length
91 * @return the hash key 93 * @return the hash key
92 */ 94 */
93 __attribute__((__warn_unused_result__)) 95 cx_attr_nodiscard
96 cx_attr_access_r(1, 2)
94 CxHashKey cx_hash_key_bytes( 97 CxHashKey cx_hash_key_bytes(
95 const unsigned char *bytes, 98 const unsigned char *bytes,
96 size_t len 99 size_t len
97 ); 100 );
98 101
105 * 108 *
106 * @param obj a pointer to an arbitrary object 109 * @param obj a pointer to an arbitrary object
107 * @param len the length of object in memory 110 * @param len the length of object in memory
108 * @return the hash key 111 * @return the hash key
109 */ 112 */
113 cx_attr_nodiscard
114 cx_attr_access_r(1, 2)
110 __attribute__((__warn_unused_result__)) 115 __attribute__((__warn_unused_result__))
111 CxHashKey cx_hash_key( 116 CxHashKey cx_hash_key(
112 const void *obj, 117 const void *obj,
113 size_t len 118 size_t len
114 ); 119 );

mercurial