add new keyDup, fix keyDupOld and keyCopyOld
@@ -194,16 +194,26 @@ ssize_t keySetBinary(Key *key, const void *newBinary, size_t dataSize);
int keyLock (Key * key, elektraLockFlags what);
int keyIsLocked (const Key * key, elektraLockFlags what);
+static inline Key *keyDup (const Key *source)
+{
+ return keyCopy (keyNew ("/", 0), source, ~0);
+}
+
// FIXME: remove once migrated
static inline Key *keyDupOld (const Key *source)
{
+ if (source == 0)
+ {
+ return 0;
+ }
return keyCopy (keyNew ("/", 0), source, ~0);
}
// FIXME: remove once migrated
static inline int keyCopyOld (Key *dest, const Key *source)
{
- return keyCopy (dest, source, ~0) != 0;
+ Key * ret = keyCopy (dest, source, ~0);
+ return source == 0 ? 0 : ret == 0 ? -1 : 1;
}
/**************************************
