libubox
C utility functions for OpenWrt.
avl-cmp.c File Reference
#include <string.h>
#include "avl-cmp.h"
#include "blob.h"

Go to the source code of this file.

Functions

static int _min (int v1, int v2)
 
int avl_strcmp (const void *k1, const void *k2, void *ptr)
 
int avl_blobcmp (const void *k1, const void *k2, void *ptr)
 

Function Documentation

◆ _min()

static int _min ( int  v1,
int  v2 
)
inlinestatic

Definition at line 20 of file avl-cmp.c.

21 {
22  return v1 < v2 ? v1 : v2;
23 }
Here is the caller graph for this function:

◆ avl_blobcmp()

int avl_blobcmp ( const void *  k1,
const void *  k2,
void *  ptr 
)

Definition at line 32 of file avl-cmp.c.

33 {
34  int len = _min(blob_raw_len(k1), blob_raw_len(k2));
35 
36  return memcmp(k1, k2, len);
37 }
static int _min(int v1, int v2)
Definition: avl-cmp.c:20
static size_t blob_raw_len(const struct blob_attr *attr)
Definition: blob.h:109
Here is the call graph for this function:

◆ avl_strcmp()

int avl_strcmp ( const void *  k1,
const void *  k2,
void *  ptr 
)

Definition at line 26 of file avl-cmp.c.

27 {
28  return strcmp(k1, k2);
29 }
Here is the caller graph for this function: