dmi_entity_create
Synopsis
#include <opendmi/entity.h>
dmi_entity_t *dmi_entity_create(
dmi_context_t *context,
const dmi_buffer_t *buffer,
size_t offset);
Description
The dmi_entity_create function allocates a new entity descriptor and
initializes it from the data of the structure, which begins at offset
within buffer and runs to the end of the data the buffer holds. It parses
the structure header, computes the total length (formatted area plus string
set), and decodes the string table.
The structure refers to the data of the buffer in place rather than holding a copy of it, so the buffer is required to hold that data for as long as the entity lives. The structures read from a table all refer to the buffer of the table, which the context holds until it is closed.
The caller is responsible for destroying the returned entity descriptor with
dmi_entity_destroy when it is no longer needed.
Return value
On success, returns a pointer to a newly allocated entity descriptor. On
failure, returns nullptr (e.g. if context or buffer is nullptr, the
structure length is invalid, or a memory allocation fails).