Logo Search packages:      
Sourcecode: pulseaudio version File versions

char* pa_xstrndup ( const char *  s,
size_t  l 
)

Duplicate the specified string, but truncate after l characters

Definition at line 109 of file xmalloc.c.

                                           {
    char *e, *r;

    if (!s)
        return NULL;

    if ((e = memchr(s, 0, l)))
        return pa_xmemdup(s, (size_t) (e-s+1));

    r = pa_xmalloc(l+1);
    memcpy(r, s, l);
    r[l] = 0;
    return r;
}


Generated by  Doxygen 1.6.0   Back to index