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

Function buffer_create

util/cbfstool/common.c:28–44  ·  view source on GitHub ↗

Buffer and file I/O */

Source from the content-addressed store, hash-verified

26
27/* Buffer and file I/O */
28int buffer_create(struct buffer *buffer, size_t size, const char *name)
29{
30 buffer->name = strdup(name);
31 buffer->offset = 0;
32 buffer->size = size;
33 buffer->data = (char *)malloc(buffer->size);
34 if (!buffer->data) {
35 fprintf(stderr, "buffer_create: Insufficient memory (0x%zx).\n",
36 size);
37 if (buffer->name) {
38 free(buffer->name);
39 buffer->name = NULL;
40 }
41 return -1;
42 }
43 return 0;
44}
45
46int buffer_from_file_aligned_size(struct buffer *buffer, const char *filename,
47 size_t size_granularity)

Callers 15

bzp_init_outputFunction · 0.85
parse_elf_to_payloadFunction · 0.85
parse_fv_to_payloadFunction · 0.85
parse_fit_to_payloadFunction · 0.85
write_elfFunction · 0.85
parse_elf_to_xip_ramFunction · 0.85
cbfs_add_master_headerFunction · 0.85
add_topswap_bootblockFunction · 0.85
cbfstool_convert_fspFunction · 0.85
cbfs_createFunction · 0.85

Calls 4

fprintfFunction · 0.85
strdupFunction · 0.50
mallocFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected