Fix: pass private data to context callbacks
[lttng-ust.git] / liblttng-ust / lttng-hash-helper.h
index bddc7c46729228d39e75d22cc578b67cd6ea1f64..36c3ae4274906ea96c26886bb81293fa405e9844 100644 (file)
@@ -1,29 +1,16 @@
-#ifndef _LTTNG_HASH_HELPER_H
-#define _LTTNG_HASH_HELPER_H
-
 /*
- * lttng-hash-helper.h
- *
- * LTTng hash table helpers.
+ * SPDX-License-Identifier: LGPL-2.1-only
  *
  * Copyright (C) 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; only
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * LTTng hash table helpers.
  */
 
+#ifndef _LTTNG_HASH_HELPER_H
+#define _LTTNG_HASH_HELPER_H
+
 #include <assert.h>
+#include <stddef.h>
 #include <stdint.h>
 #include <urcu/compiler.h>
 
@@ -56,7 +43,10 @@ do { \
        c ^= b; c -= rot(b, 24); \
 }
 
-static inline __attribute__((unused))
+static inline
+uint32_t lttng_hash_u32(const uint32_t *k, size_t length, uint32_t initval)
+       __attribute__((unused));
+static inline
 uint32_t lttng_hash_u32(
        const uint32_t *k,      /* the key, an array of uint32_t values */
        size_t length,          /* the length of the key, in uint32_ts */
@@ -115,10 +105,10 @@ void lttng_hashword2(
 
        /*----------------------------------- handle the last 3 uint32_t's */
        switch (length) {       /* all the case statements fall through */
-       case 3: c += k[2];
-       case 2: b += k[1];
+       case 3: c += k[2];      /* fall through */
+       case 2: b += k[1];      /* fall through */
        case 1: a += k[0];
-               final(a, b, c);
+               final(a, b, c); /* fall through */
        case 0:                 /* case 0: nothing left to add */
                break;
        }
This page took 0.023367 seconds and 4 git commands to generate.