Back to index

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

Go to the source code of this file.

Functions

 PL_strcasestr (const char *big, const char *little)
 PL_strcaserstr (const char *big, const char *little)
 PL_strncasestr (const char *big, const char *little, PRUint32 max)
 PL_strncaserstr (const char *big, const char *little, PRUint32 max)

Function Documentation

PL_strcaserstr ( const char *  big,
const char *  little 
)

Definition at line 59 of file strcstr.c.

{
    const char *p;
    PRUint32 ll;

    if( ((const char *)0 == big) || ((const char *)0 == little) ) return (char *)0;
    if( ((char)0 == *big) || ((char)0 == *little) ) return (char *)0;

    ll = PL_strlen(little);
    p = &big[ PL_strlen(big) - ll ];
    if( p < big ) return (char *)0;

    for( ; p >= big; p-- )
        /* obvious improvement available here */
            if( 0 == PL_strncasecmp(p, little, ll) )
                return (char *)p;

    return (char *)0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PL_strcasestr ( const char *  big,
const char *  little 
)

Definition at line 41 of file strcstr.c.

{
    PRUint32 ll;

    if( ((const char *)0 == big) || ((const char *)0 == little) ) return (char *)0;
    if( ((char)0 == *big) || ((char)0 == *little) ) return (char *)0;

    ll = PL_strlen(little);

    for( ; *big; big++ )
        /* obvious improvement available here */
            if( 0 == PL_strncasecmp(big, little, ll) )
                return (char *)big;

    return (char *)0;
}

Here is the call graph for this function:

PL_strncaserstr ( const char *  big,
const char *  little,
PRUint32  max 
)

Definition at line 101 of file strcstr.c.

{
    const char *p;
    PRUint32 ll;

    if( ((const char *)0 == big) || ((const char *)0 == little) ) return (char *)0;
    if( ((char)0 == *big) || ((char)0 == *little) ) return (char *)0;

    ll = PL_strlen(little);

    for( p = big; max && *p; p++, max-- )
        ;

    p -= ll;
    if( p < big ) return (char *)0;

    for( ; p >= big; p-- )
        /* obvious improvement available here */
            if( 0 == PL_strncasecmp(p, little, ll) )
                return (char *)p;

    return (char *)0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PL_strncasestr ( const char *  big,
const char *  little,
PRUint32  max 
)

Definition at line 80 of file strcstr.c.

{
    PRUint32 ll;

    if( ((const char *)0 == big) || ((const char *)0 == little) ) return (char *)0;
    if( ((char)0 == *big) || ((char)0 == *little) ) return (char *)0;

    ll = PL_strlen(little);
    if( ll > max ) return (char *)0;
    max -= ll;
    max++;

    for( ; max && *big; big++, max-- )
        /* obvious improvement available here */
            if( 0 == PL_strncasecmp(big, little, ll) )
                return (char *)big;

    return (char *)0;
}

Here is the call graph for this function:

Here is the caller graph for this function: