Back to index

lightning-sunbird  0.9+nobinonly
Functions
strlen.c File Reference
#include "plstr.h"
#include "prtypes.h"
#include "prlog.h"
#include <string.h>

Go to the source code of this file.

Functions

 PL_strlen (const char *str)
 PL_strnlen (const char *str, PRUint32 max)

Function Documentation

PL_strlen ( const char *  str)

Definition at line 44 of file strlen.c.

{
    size_t l;

    if( (const char *)0 == str ) return 0;

    l = strlen(str);

    /* error checking in case we have a 64-bit platform -- make sure
     * we don't have ultra long strings that overflow an int32
     */ 
    if( sizeof(PRUint32) < sizeof(size_t) )
        PR_ASSERT(l < 2147483647);

    return (PRUint32)l;
}
PL_strnlen ( const char *  str,
PRUint32  max 
)

Definition at line 62 of file strlen.c.

{
    register const char *s;

    if( (const char *)0 == str ) return 0;
    for( s = str; max && *s; s++, max-- )
        ;

    return (PRUint32)(s - str);
}

Here is the caller graph for this function: