Elektra  0.8.23
Macros
kdbmacros.h File Reference

Macros by Elektra. More...

This graph shows which files directly or indirectly include this file:

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.

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)
const char * keyString(const Key *key)
Get the c-string representing the value.
Definition: keyvalue.c:193
Key * ksNext(KeySet *ks)
Returns the next Key in a KeySet.
Definition: keyset.c:1326
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
infohow the info is now (freshly received)
returnedhow the info passed from user is
errorkey to set error to
Returns
with -1 on error