MCPcopy Create free account
hub / github.com/coreboot/coreboot / strdup

Function strdup

src/lib/string.c:9–19  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7#include <stdlib.h>
8
9char *strdup(const char *s)
10{
11 if (!ENV_RAMSTAGE)
12 dead_code(); /* This can't be used without malloc(). */
13
14 size_t sz = strlen(s) + 1;
15 char *d = malloc(sz);
16 if (d)
17 memcpy(d, s, sz);
18 return d;
19}
20
21char *strconcat(const char *s1, const char *s2)
22{

Callers 15

fit_add_compat_stringFunction · 0.70
update_pll_ssc_valuesFunction · 0.50
add_device_refFunction · 0.50
set_valueFunction · 0.50
fw_cfg_smbios_initFunction · 0.50
camera_fill_cio2Function · 0.50
_dt_find_nodeFunction · 0.50
dt_find_node_by_pathFunction · 0.50
dt_set_bin_prop_by_pathFunction · 0.50
dt_fix_symbolsFunction · 0.50
usb4_pcie_acpi_fill_ssdtFunction · 0.50
test_strdupFunction · 0.50

Calls 3

strlenFunction · 0.85
mallocFunction · 0.70
memcpyFunction · 0.70

Tested by 1

test_strdupFunction · 0.40