Elektra 0.11.0
keyUnescapedName

Signature

const void *keyUnescapedName(const Key *key)

Checklist

Doxygen

(bullet points are in order of appearance)

  • First line explains briefly what the function does
    • Merge first and second sentence
      'Returns a key's name where the key name parts are separated by null bytes and does not use backslash for escaping'
  • Simple example or snippet how to use the function
    • add example
  • Longer description of function containing common use cases
  • Description of functions reads nicely
  • @pre
    • add
  • @post
    • add
    • key stays unchanged
    • returns pointer to unescaped Name
  • @invariant
    • add
    • key stays unchanged
  • @param for every parameter
    • 'optional pointer to Key object'
  • @return / @retval
    • swap order
    • 'if Key has no name'
    • 'the Key's name'
  • @since
    • add
  • @ingroup
    • add

Naming

  • Abbreviations used in function names must be defined in the Glossary
  • Function names should neither be too long, nor too short
  • Function name should be clear and unambiguous
  • Abbreviations used in parameter names must be defined in the Glossary
  • Parameter names should neither be too long, nor too short
  • Parameter names should be clear and unambiguous

Compatibility

(only in PRs)

  • Symbol versioning is correct for breaking changes
  • ABI/API changes are forward-compatible (breaking backwards-compatibility to add additional symbols is fine)

Parameter & Return Types

  • Function parameters should use enum types instead of boolean types wherever sensible
  • Wherever possible, function parameters should be const
  • Wherever possible, return types should be const
  • Functions should have the least amount of parameters feasible

Structural Clarity

  • Functions should do exactly one thing
  • Function name has the appropriate prefix
  • Order of signatures in kdb.h.in is the same as Doxygen
    • mismatch, move up in docs to match place in header file
  • No functions with similar purpose exist

Memory Management

  • Memory Management should be handled by the function wherever possible

Extensibility

  • Function is easily extensible, e.g., with flags
  • Documentation does not impose limits, that would hinder further extensions

Tests

  • Function code is fully covered by tests
    • no tests for this function
  • All possible error states are covered by tests
    • no tests for this function
  • All possible enum values are covered by tests
    • no tests for this function
  • No inconsistencies between tests and documentation
    • no tests for this function

Summary

  • Why is return type void* exactly?
  • include optional in key @param - define schema for key param
  • Add explicit tests for this function

Other Issues discovered (unrelated to function)

  • Convention for keyX / keyGetX (pointer vs copy) intended?
  • Remove elektra-internal functions
  • Functions are sorted alphabetically - can we change this easily?