Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
strccmp.c File Reference
#include "plstr.h"

Go to the source code of this file.

Functions

 PL_strcasecmp (const char *a, const char *b)
 PL_strncasecmp (const char *a, const char *b, PRUint32 max)

Variables

static const unsigned char uc []

Function Documentation

PL_strcasecmp ( const char *  a,
const char *  b 
)

Definition at line 77 of file strccmp.c.

{
    const unsigned char *ua = (const unsigned char *)a;
    const unsigned char *ub = (const unsigned char *)b;

    if( ((const char *)0 == a) || (const char *)0 == b ) 
        return (PRIntn)(a-b);

    while( (uc[*ua] == uc[*ub]) && ('\0' != *a) )
    {
        a++;
        ua++;
        ub++;
    }

    return (PRIntn)(uc[*ua] - uc[*ub]);
}
PL_strncasecmp ( const char *  a,
const char *  b,
PRUint32  max 
)

Definition at line 96 of file strccmp.c.

{
    const unsigned char *ua = (const unsigned char *)a;
    const unsigned char *ub = (const unsigned char *)b;

    if( ((const char *)0 == a) || (const char *)0 == b ) 
        return (PRIntn)(a-b);

    while( max && (uc[*ua] == uc[*ub]) && ('\0' != *a) )
    {
        a++;
        ua++;
        ub++;
        max--;
    }

    if( 0 == max ) return (PRIntn)0;

    return (PRIntn)(uc[*ua] - uc[*ub]);
}

Variable Documentation

const unsigned char uc[] [static]

Definition at line 40 of file strccmp.c.