Elektra: kdbmacros.h File Reference

Elektra 0.8.24

Macros
kdbmacros.h File Reference

Macros by Elektra. More...

## Macros
#define | ELEKTRA_QUOTE(x) #x
| Surround a value with double quotes.
#define | ELEKTRA_STRINGIFY(x) ELEKTRA_QUOTE (x)
| Surround a macro value with double quotes.
#define | ELEKTRA_SET_ERROR_READ_ONLY(info, returned, error)
| Sets error 84 if info != returned. More...

## Detailed Description

Macros by Elektra.

Macros start with ELEKTRA_ and are uppercase.

Copyright
  BSD License (see LICENSE.md or https://www.libelektra.org)

## Macro Definition Documentation

## ◆ ELEKTRA_SET_ERROR_READ_ONLY

#define ELEKTRA_SET_ERROR_READ_ONLY | ( |  | info,
|  |  | returned,
|  |  | error
| ) |  |

Value:
do \
{ \
Key * k; \
ksRewind (info); \
ksRewind (returned); \
while ((k = ksNext (returned))) \
{ \
Key * c = ksNext (info); \
if (!c) \
{ \
ELEKTRA_SET_ERRORF (84, error, "the key %s (value %s) was added", keyName (k), keyString (k)); \
ksDel (info); \
return -1; \
} \
if (strcmp (keyName (k), keyName (c)) || strcmp (keyString (k), keyString (c))) \
{ \
ELEKTRA_SET_ERRORF (84, error, "the key %s (expected %s) was modified to %s (expected %s)", keyName (k), \
keyName (c), keyString (k), keyString (c)); \
ksDel (info); \
return -1; \
} \
} \
if ((k = ksNext (info)) != 0) \
{ \
ELEKTRA_SET_ERRORF (84, error, "the key %s (value %s) was removed", keyName (k), keyString (k)); \
ksDel (info); \
return -1; \
} \
ksDel (info); \
} while (0)
keyString
const char * keyString(const Key *key)
Get the c-string representing the value.
Definition: keyvalue.c:193
ksNext
Key * ksNext(KeySet *ks)
Returns the next Key in a KeySet.
Definition: keyset.c:1332
keyName
const char * keyName(const Key *key)
Returns a pointer to the abbreviated real internal key name.
Definition: elektra/keyname.c:213

Sets error 84 if info != returned.

Parameters

  info | how the info is now (freshly received)
  returned | how the info passed from user is
  error | key to set error to

Returns
  with -1 on error