$darkmode
Elektra 0.11.0
Functions with buffers

Problem

Currently the way functions like keyGetName() work is by passing a buffer with a maxSize and if the buffer is large enough, the value gets copied into the buffer. This leads to the user having to write a lot of surrounding boilerplate code, checking for the size of every value / name they want to copy into a buffer.

Constraints

Assumptions

Considered Alternatives

Decision

// str values
strncpy(..., keyName (k), ...)
// binary values
memcpy(..., keyValue (k), ...)
const char * keyName(const Key *key)
Returns a pointer to the abbreviated real internal key name.
Definition: elektra/keyname.c:429
const void * keyValue(const Key *key)
Return a pointer to the real internal key value.
Definition: keyvalue.c:163

Rationale

The functions clutter the API and try to replace existing builtin functionality for little to no gain. This makes the API leaner while also retaining its functionality.

Implications

Related Decisions

Notes