| 1 |
/* |
| 2 |
* Copyright (C) 2015 Red Hat, Inc. |
| 3 |
* SPDX-License-Identifier: LGPL-2.1-or-later |
| 4 |
*/ |
| 5 |
|
| 6 |
#include "config.h" |
| 7 |
|
| 8 |
/* This gets logged as part of the (more verbose) protocol logging */ |
| 9 |
#ifdef G_LOG_DOMAIN |
| 10 |
#undef G_LOG_DOMAIN |
| 11 |
#endif |
| 12 |
#define G_LOG_DOMAIN "cockpit-protocol" |
| 13 |
|
| 14 |
#include "cockpithash.h" |
| 15 |
|
| 16 |
guint |
| 17 |
cockpit_str_case_hash (gconstpointer v) |
| 18 |
{ |
| 19 |
/* A case agnostic version of g_str_hash */ |
| 20 |
const signed char *p; |
| 21 |
guint32 h = 5381; |
| 22 |
for (p = v; *p != '\0'; p++) |
| 23 |
h = (h << 5) + h + g_ascii_tolower (*p); |
| 24 |
return h; |
| 25 |
} |
| 26 |
|
| 27 |
gboolean |
| 28 |
cockpit_str_case_equal (gconstpointer v1, |
| 29 |
gconstpointer v2) |
| 30 |
{ |
| 31 |
/* A case agnostic version of g_str_equal */ |
| 32 |
return g_ascii_strcasecmp (v1, v2) == 0; |
| 33 |
} |