Logo Search packages:      
Sourcecode: avahi version File versions  Download package

char* avahi_strndup ( const char *  s,
size_t  l 

Just like libc's strndup()

Definition at line 175 of file malloc.c.

    char *r;
    size_t size;
    const char *p;

    if (!s)
        return NULL;

    for (p = s, size = 0;
         size < max && *p;
         p++, size++);

    if (!(r = avahi_new(char, size+1)))
        return NULL;

    memcpy(r, s, size);
    r[size] = 0;
    return r;

Generated by  Doxygen 1.6.0   Back to index