NeoMutt  2024-04-16-36-g75b6fb
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
Hash Table Compare API

Prototype for a function to compare two Hash keys. More...

Functions

static int cmp_key_string (union HashKey a, union HashKey b)
 Compare two string keys - Implements hash_cmp_key_t -.
 
static int cmp_key_case_string (union HashKey a, union HashKey b)
 Compare two string keys (ignore case) - Implements hash_cmp_key_t -.
 
static int cmp_key_int (union HashKey a, union HashKey b)
 Compare two integer keys - Implements hash_cmp_key_t -.
 

Detailed Description

Prototype for a function to compare two Hash keys.

Parameters
aFirst key to compare
bSecond key to compare
Return values
-1a precedes b
0a and b are identical
1b precedes a

This works like strcmp().

Function Documentation

◆ cmp_key_string()

static int cmp_key_string ( union HashKey  a,
union HashKey  b 
)
static

Compare two string keys - Implements hash_cmp_key_t -.

Definition at line 61 of file hash.c.

62{
63 return mutt_str_cmp(a.strkey, b.strkey);
64}
int mutt_str_cmp(const char *a, const char *b)
Compare two strings, safely.
Definition: string.c:393
const char * strkey
String key.
Definition: hash.h:35
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cmp_key_case_string()

static int cmp_key_case_string ( union HashKey  a,
union HashKey  b 
)
static

Compare two string keys (ignore case) - Implements hash_cmp_key_t -.

Definition at line 88 of file hash.c.

89{
90 return mutt_istr_cmp(a.strkey, b.strkey);
91}
int mutt_istr_cmp(const char *a, const char *b)
Compare two strings ignoring case, safely.
Definition: string.c:406
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cmp_key_int()

static int cmp_key_int ( union HashKey  a,
union HashKey  b 
)
static

Compare two integer keys - Implements hash_cmp_key_t -.

Definition at line 104 of file hash.c.

105{
106 if (a.intkey == b.intkey)
107 return 0;
108 if (a.intkey < b.intkey)
109 return -1;
110 return 1;
111}
unsigned int intkey
Integer key.
Definition: hash.h:36
+ Here is the caller graph for this function: