libcfe  0.12.1
some useful C-functions
xstrcoll.c File Reference
#include "config.h"
#include "xstrcoll.h"
#include <string.h>
#include "len.h"
Include dependency graph for xstrcoll.c:

Go to the source code of this file.

Macros

#define MIN(a, b)   (((a) < (b)) ? (a) : (b))
 
#define NONZERO(x)   ((x) != 0)
 

Functions

int str_compare (void *a, void *b)
 
int xstrcoll (const char *a, size_t alen, const char *b, size_t blen)
 

Macro Definition Documentation

◆ MIN

#define MIN (   a,
 
)    (((a) < (b)) ? (a) : (b))

Definition at line 9 of file xstrcoll.c.

◆ NONZERO

#define NONZERO (   x)    ((x) != 0)

Definition at line 13 of file xstrcoll.c.

Function Documentation

◆ str_compare()

int str_compare ( void *  a,
void *  b 
)

xstrcoll Compares two '\0' terminated string, returning negative, zero, or positive depending on whether A compares less than, equal to, or greater than B.

Note
This function can be used to compare elements of a string table.
Parameters
[in]aVoid pointer to string A.
[in]bVoid pointer to string B.
Returns
return value
  • negative A is less than B
  • positive A is greater than B
  • zero A is equal to B

Definition at line 22 of file xstrcoll.c.

Here is the call graph for this function:

◆ xstrcoll()

int xstrcoll ( const char *  a,
size_t  alen,
const char *  b,
size_t  blen 
)

Compare two strings A and B, returning negative, zero, or positive depending on whether A compares less than, equal to, or greater than B.

Parameters
[in]aPointer to string A.
[in]alenLength of string A (without terminating character).
[in]bPointer to string B.
[in]blenLength of string B (without terminating character).
Returns
return value
  • negative A is less than B
  • positive A is greater than B
  • zero A is equal to B

Definition at line 27 of file xstrcoll.c.