LCOV - code coverage report
Current view: top level - src - key_hash.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 75.0 % 24 18
Test Date: 2025-10-15 21:43:52 Functions: 100.0 % 6 6

            Line data    Source code
       1              : #include "key_hash.h"
       2              : #include <stdint.h>
       3              : 
       4              : #define XXH_STATIC_LINKING_ONLY
       5              : #include "xxhash.h"
       6              : 
       7              : /* --- Correct apr_off_t (64-bit) Callbacks --- */
       8              : 
       9          224 : apr_size_t ft_fsize_get_key_len(const void *data)
      10              : {
      11          224 :     return sizeof(apr_off_t);
      12              : }
      13              : 
      14          256 : apr_uint32_t apr_off_t_key_hash(const void *key, apr_size_t klen)
      15              : {
      16              :     /* Use XXH32 to hash the 64-bit file size key */
      17          256 :     return XXH32(key, sizeof(apr_off_t), 0);
      18              : }
      19              : 
      20          220 : int apr_off_t_key_cmp(const void *key1, const void *key2, apr_size_t len)
      21              : {
      22          220 :     apr_off_t i1 = *(apr_off_t *) key1;
      23          220 :     apr_off_t i2 = *(apr_off_t *) key2;
      24          220 :     if (i1 == i2)
      25          220 :         return 0;
      26            0 :     if (i1 < i2)
      27            0 :         return -1;
      28            0 :     return 1;
      29              : }
      30              : 
      31              : /* --- Correct gid_t Callbacks --- */
      32              : 
      33           17 : apr_size_t ft_gid_get_key_len(const void *data)
      34              : {
      35           17 :     return sizeof(gid_t);
      36              : }
      37              : 
      38          102 : apr_uint32_t gid_t_key_hash(const void *key, apr_size_t klen)
      39              : {
      40              :     /* Use XXH32 to hash the gid_t key */
      41          102 :     return XXH32(key, sizeof(gid_t), 0);
      42              : }
      43              : 
      44           17 : int gid_t_key_cmp(const void *key1, const void *key2, apr_size_t len)
      45              : {
      46           17 :     gid_t i1 = *(gid_t *) key1;
      47           17 :     gid_t i2 = *(gid_t *) key2;
      48           17 :     if (i1 == i2)
      49           17 :         return 0;
      50            0 :     if (i1 < i2)
      51            0 :         return -1;
      52            0 :     return 1;
      53              : }
        

Generated by: LCOV version 2.0-1