MCPcopy Create free account
hub / github.com/F-Stack/f-stack / strndup

Function strndup

freebsd/libkern/strndup.c:40–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38#include <sys/malloc.h>
39
40char *
41strndup(const char *string, size_t maxlen, struct malloc_type *type)
42{
43 size_t len;
44 char *copy;
45
46 len = strnlen(string, maxlen) + 1;
47 copy = malloc(len, type, M_WAITOK);
48 bcopy(string, copy, len);
49 copy[len - 1] = '\0';
50 return (copy);
51}

Callers 7

find_redact_bookFunction · 0.85
mainFunction · 0.85
fs_parse_device_paramFunction · 0.85
parse_pci_addr_formatFunction · 0.85
parse_lcore_dmaFunction · 0.85
open_dmaFunction · 0.85

Calls 2

strnlenFunction · 0.85
mallocFunction · 0.85

Tested by 1

mainFunction · 0.68