$darkmode
Elektra 0.11.0
keyIsBelow

Problem

There are multiple very similar functions to check the "is below" relation between to keys:

  • Replacement keyIsBelow
  • Replacement keyIsBelowOrSame
  • Replacement keyIsDirectlyBelow

Constraints

Keep (at least) the same functionality

Assumptions

Considered Alternatives

Decision

Merge keyIsBelow with keyIsBelowOrSame and keyIsDirectlyBelow to create this new API:

int keyIsBelow (const Key * base, const Key * other);
int keyIsBelow(const Key *key, const Key *check)
Check if the Key check is below the Key key or not.
Definition: keytest.c:138

The replacements for the old functions are:

  • old keyIsBelow: keyIsBelow > 0
  • keyIsBelowOrSame: keyIsBelow >= 0
  • keyIsDirectlyBelow: keyIsBelow == 1

Rationale

Implications

Related Decisions

Notes