diff --git a/benchmarks/benchmarks.c b/benchmarks/benchmarks.c index 8fadc2ac8f7..ea4454142c8 100644 --- a/benchmarks/benchmarks.c +++ b/benchmarks/benchmarks.c @@ -455,7 +455,7 @@ static void recGenerateKeySet (KeySet * ks, Key * key, KsTreeVertex * vertex) // add if Key if (vertex->isKey) { - Key * dupKey = keyDup (key); + Key * dupKey = keyDupOld (key); if (!dupKey) { printExit ("recGenerateKeySet: Can not dup Key"); @@ -473,7 +473,7 @@ static void recGenerateKeySet (KeySet * ks, Key * key, KsTreeVertex * vertex) // go to children for (size_t i = 0; i < vertex->numberofChildren; ++i) { - Key * dupKey = keyDup (key); + Key * dupKey = keyDupOld (key); if (!dupKey) { printExit ("recGenerateKeySet: Can not dup Key"); diff --git a/examples/functional.c b/examples/functional.c index dd878a86647..7275f9dbd29 100644 --- a/examples/functional.c +++ b/examples/functional.c @@ -81,7 +81,7 @@ int ksFilter (KeySet * result, KeySet * input, int (*filter) (Key * k)) else if (rc != 0) { ++ret; - ksAppendKey (result, keyDup (current)); + ksAppendKey (result, keyDupOld (current)); } } ksSetCursor (input, cursor); diff --git a/examples/keyCopy.c b/examples/keyCopy.c index 1cf1ef7d099..1b2fb099ec8 100644 --- a/examples/keyCopy.c +++ b/examples/keyCopy.c @@ -16,7 +16,7 @@ Key * copy; void h (Key * k) { // receive key c - keyCopy (k, copy); + keyCopyOld (k, copy); // the caller will see the changed key k } //! [Basic Usage] @@ -24,7 +24,7 @@ void h (Key * k) //! [Clear] void g (Key * k) { - keyCopy (k, 0); + keyCopyOld (k, 0); // k is now an empty and fresh key } //! [Clear] @@ -38,7 +38,7 @@ void j (Key * k) // receive key c memcpy (value, keyValue (k), size); - keyCopy (k, copy); + keyCopyOld (k, copy); if (bstring) keySetString (k, value); else diff --git a/examples/keyset.c b/examples/keyset.c index 1aeb63e593e..b64ebeacca7 100644 --- a/examples/keyset.c +++ b/examples/keyset.c @@ -12,7 +12,7 @@ void f (const Key * source) { - Key * dup = keyDup (source); + Key * dup = keyDupOld (source); printf ("\tin f\n"); keyDel (dup); @@ -20,7 +20,7 @@ void f (const Key * source) void g (const Key * source, KeySet * ks) { - Key * dup = keyDup (source); + Key * dup = keyDupOld (source); printf ("\tin g\n"); ksAppendKey (ks, dup); @@ -31,7 +31,7 @@ void h (Key * k) Key * c = keyNew ("user:/from/h", KEY_END); printf ("\tin h\n"); - keyCopy (k, c); + keyCopyOld (k, c); keyDel (c); /* the caller will see the changed key k */ } @@ -68,7 +68,7 @@ void dupAppend (void) //! [dup append] KeySet * ks = ksNew (1, KS_END); Key * k = keyNew ("user:/ref/key", KEY_END); -ksAppendKey (ks, keyDup (k)); +ksAppendKey (ks, keyDupOld (k)); ksDel (ks); // now we still can work with the key k! keyDel (k); @@ -101,7 +101,7 @@ int main (void) ksRewind (ks); origKey = ksNext (ks); - key = keyDup (origKey); + key = keyDupOld (origKey); printf ("A duplication of the key %s with value %s\n", keyName (key), keyString (key)); keyDel (key); diff --git a/src/bindings/cpp/include/key.hpp b/src/bindings/cpp/include/key.hpp index 6679423f0d7..1997a750859 100644 --- a/src/bindings/cpp/include/key.hpp +++ b/src/bindings/cpp/include/key.hpp @@ -114,7 +114,7 @@ class Key inline Key & operator= (ckdb::Key * k); inline Key & operator= (const Key & k); - inline void copy (const Key & other); + inline void copy (const Key & other, int flags = 0); inline void clear (); inline ckdb::Key * operator-> () const; @@ -732,9 +732,9 @@ inline Key & Key::operator= (const Key & k) /** * @copydoc keyCopy */ -inline void Key::copy (const Key & other) +inline void Key::copy (const Key & other, int flags) { - ckdb::keyCopy (key, other.key); + ckdb::keyCopy (key, other.key, flags); } /** @@ -815,7 +815,7 @@ ckdb::Key * Key::release () */ ckdb::Key * Key::dup () const { - return ckdb::keyDup (getKey ()); + return ckdb::keyDupOld (getKey ()); } /** diff --git a/src/bindings/glib/gelektra-key.c b/src/bindings/glib/gelektra-key.c index dbbde4f8b9b..271dc0d2ff8 100644 --- a/src/bindings/glib/gelektra-key.c +++ b/src/bindings/glib/gelektra-key.c @@ -195,7 +195,7 @@ gssize gelektra_key_getref (const GElektraKey * key) */ GElektraKey * gelektra_key_dup (const GElektraKey * key) { - return gelektra_key_make (keyDup (key->key)); + return gelektra_key_make (keyDupOld (key->key)); } /** @@ -204,7 +204,8 @@ GElektraKey * gelektra_key_dup (const GElektraKey * key) */ gint gelektra_key_copy (const GElektraKey * key, GElektraKey * dest) { - return keyCopy (dest->key, key->key); + // TODO (kodebach): binding + return keyCopyOld (dest->key, key->key); } gint gelektra_key_clear (GElektraKey * key) diff --git a/src/bindings/intercept/fs/intercept.c b/src/bindings/intercept/fs/intercept.c index 9e9a609b3fd..5a48e43219f 100644 --- a/src/bindings/intercept/fs/intercept.c +++ b/src/bindings/intercept/fs/intercept.c @@ -134,7 +134,7 @@ void init (void) else tmp->value = createAbsolutePath (keyString (key), cwd); tmp->oflags = (unsigned short) -1; - Key * lookupKey = keyDup (key); + Key * lookupKey = keyDupOld (key); keyAddBaseName (lookupKey, "readonly"); Key * found = ksLookup (ks, lookupKey, 0); if (found) diff --git a/src/bindings/jna/libelektra5j/src/main/java/org/libelektra/Elektra.java b/src/bindings/jna/libelektra5j/src/main/java/org/libelektra/Elektra.java index 7a9c90ceb98..d8e20217834 100644 --- a/src/bindings/jna/libelektra5j/src/main/java/org/libelektra/Elektra.java +++ b/src/bindings/jna/libelektra5j/src/main/java/org/libelektra/Elektra.java @@ -37,7 +37,7 @@ public interface Elektra extends Library { Pointer keyNew (String name, Object... args); - Pointer keyDup (Pointer source); + Pointer keyDupOld (Pointer source); int keyCopy (Pointer dest, Pointer source); diff --git a/src/bindings/jna/libelektra5j/src/main/java/org/libelektra/Key.java b/src/bindings/jna/libelektra5j/src/main/java/org/libelektra/Key.java index 965affd6e3b..842db6aa2d1 100644 --- a/src/bindings/jna/libelektra5j/src/main/java/org/libelektra/Key.java +++ b/src/bindings/jna/libelektra5j/src/main/java/org/libelektra/Key.java @@ -412,7 +412,7 @@ public void addWarning (final String text, final Object... args) */ public Key dup () { - return new Key (Elektra.INSTANCE.keyDup (get ())); + return new Key (Elektra.INSTANCE.keyDupOld (get ())); } /** diff --git a/src/bindings/rust/elektra/src/key.rs b/src/bindings/rust/elektra/src/key.rs index c59f571aa99..d21f1d36024 100644 --- a/src/bindings/rust/elektra/src/key.rs +++ b/src/bindings/rust/elektra/src/key.rs @@ -180,7 +180,12 @@ impl<'a> StringKey<'a> { /// Returns a deep copy of the key. pub fn duplicate<'b>(&'a self) -> StringKey<'b> { - let dup_ptr = unsafe { elektra_sys::keyDup(self.as_ref()) }; + // TODO: binding + let dup_ptr = unsafe { + let dup = elektra_sys::keyDup(self.as_ref(), 0); + elektra_sys::keyCopyAllMeta(dup, self.as_ref()); + dup + }; unsafe { StringKey::from_ptr(dup_ptr) } } @@ -245,7 +250,12 @@ impl<'a> BinaryKey<'a> { /// Returns a deep copy of the key. pub fn duplicate<'b>(&'a self) -> BinaryKey<'b> { - let dup_ptr = unsafe { elektra_sys::keyDup(self.as_ref()) }; + // TODO: binding + let dup_ptr = unsafe { + let dup = elektra_sys::keyDup(self.as_ref(), 0); + elektra_sys::keyCopyAllMeta(dup, self.as_ref()); + dup + }; unsafe { BinaryKey::from_ptr(dup_ptr) } } diff --git a/src/include/kdb.h.in b/src/include/kdb.h.in index b29d08a1e0d..5f3a8321f4b 100644 --- a/src/include/kdb.h.in +++ b/src/include/kdb.h.in @@ -125,8 +125,8 @@ int kdbEnsure (KDB * handle, KeySet * contract, Key * parentKey); Key *keyNew(const char *keyname, ...); Key *keyVNew(const char *keyname, va_list ap); -Key *keyDup(const Key *source); -int keyCopy(Key *dest, const Key *source); +Key *keyDup(const Key *source, elektraKeyFlags flags); +int keyCopy(Key *dest, const Key *source, elektraKeyFlags flags); int keyClear(Key *key); int keyDel(Key *key); @@ -195,6 +195,25 @@ ssize_t keySetBinary(Key *key, const void *newBinary, size_t dataSize); int keyLock (Key * key, elektraLockFlags what); int keyIsLocked (const Key * key, elektraLockFlags what); +// FIXME: remove once migrated +static inline Key *keyDupOld (const Key *source) +{ + Key * dup = keyDup (source, 0); + keyCopyAllMeta (dup, source); + return dup; +} + +// FIXME: remove once migrated +static inline int keyCopyOld (Key *dest, const Key *source) +{ + int ret = keyCopy (dest, source, 0); + if (ret > 0) + { + keyCopyAllMeta (dest, source); + } + return ret; +} + /************************************** * * KeySet methods diff --git a/src/libs/ease/array.c b/src/libs/ease/array.c index fcdb334371e..9b65accf1bb 100644 --- a/src/libs/ease/array.c +++ b/src/libs/ease/array.c @@ -272,7 +272,7 @@ Key * elektraArrayGetNextKey (KeySet * arrayKeys) if (!last) return 0; ksAppendKey (arrayKeys, last); - Key * newKey = keyDup (last); + Key * newKey = keyDupOld (last); keySetBinary (newKey, 0, 0); int ret = elektraArrayIncName (newKey); diff --git a/src/libs/elektra/backend.c b/src/libs/elektra/backend.c index 055adf7edf8..e732a35cd4a 100644 --- a/src/libs/elektra/backend.c +++ b/src/libs/elektra/backend.c @@ -72,7 +72,7 @@ static Backend * elektraBackendAllocate (void) int elektraBackendSetMountpoint (Backend * backend, KeySet * elektraConfig, Key * errorKey) { Key * root = ksCurrent (elektraConfig); - Key * searchMountpoint = keyDup (root); + Key * searchMountpoint = keyDupOld (root); keyAddBaseName (searchMountpoint, "mountpoint"); Key * foundMountpoint = ksLookup (elektraConfig, searchMountpoint, 0); keyDel (searchMountpoint); diff --git a/src/libs/elektra/kdb.c b/src/libs/elektra/kdb.c index abe35100c89..6d8dea14f2e 100644 --- a/src/libs/elektra/kdb.c +++ b/src/libs/elektra/kdb.c @@ -171,7 +171,7 @@ KeySet * ksRenameKeys (KeySet * config, const char * name) while ((cur = ksPop (config)) != 0) { - Key * dupKey = keyDup (cur); + Key * dupKey = keyDupOld (cur); keySetName (dupKey, name); keyAddName (dupKey, keyName (cur) + rootSize - 1); ksAppendKey (newConfig, dupKey); @@ -260,7 +260,7 @@ KDB * kdbOpen (Key * errorKey) int errnosave = errno; KDB * handle = elektraCalloc (sizeof (struct _KDB)); - Key * initialParent = keyDup (errorKey); + Key * initialParent = keyDupOld (errorKey); handle->global = ksNew (0, KS_END); handle->modules = ksNew (0, KS_END); @@ -404,7 +404,7 @@ int kdbClose (KDB * handle, Key * errorKey) return -1; } - Key * initialParent = keyDup (errorKey); + Key * initialParent = keyDupOld (errorKey); int errnosave = errno; splitDel (handle->split); @@ -1006,7 +1006,7 @@ int kdbGet (KDB * handle, KeySet * ks, Key * parentKey) } int errnosave = errno; - Key * initialParent = keyDup (parentKey); + Key * initialParent = keyDupOld (parentKey); ELEKTRA_LOG ("now in new kdbGet (%s)", keyName (parentKey)); @@ -1038,7 +1038,7 @@ int kdbGet (KDB * handle, KeySet * ks, Key * parentKey) } cache = ksNew (0, KS_END); - cacheParent = keyDup (mountGetMountpoint (handle, keyName (initialParent))); + cacheParent = keyDupOld (mountGetMountpoint (handle, keyName (initialParent))); if (cacheParent == NULL) { cacheParent = keyNew ("default:/", KEY_VALUE, "default", KEY_END); @@ -1588,7 +1588,7 @@ int kdbSet (KDB * handle, KeySet * ks, Key * parentKey) } int errnosave = errno; - Key * initialParent = keyDup (parentKey); + Key * initialParent = keyDupOld (parentKey); ELEKTRA_LOG ("now in new kdbSet (%s) %p %zd", keyName (parentKey), (void *) handle, ksGetSize (ks)); diff --git a/src/libs/elektra/key.c b/src/libs/elektra/key.c index f7322827911..a58eefa3236 100644 --- a/src/libs/elektra/key.c +++ b/src/libs/elektra/key.c @@ -256,7 +256,7 @@ Key * keyVNew (const char * name, va_list va) * @code int f (const Key * source) { - Key * dup = keyDup (source); + Key * dup = keyDup (source, 0); // work with duplicate keyDel (dup); // everything related to dup is freed @@ -270,7 +270,7 @@ int f (const Key * source) * @code int g (const Key * source, KeySet * ks) { - Key * dup = keyDup (source); + Key * dup = keyDup (source, 0); // work with duplicate ksAppendKey (ks, dup); // ksDel(ks) will also free the duplicate @@ -278,24 +278,46 @@ int g (const Key * source, KeySet * ks) } * @endcode * - * Duplication of keys should be preferred to keyNew(), - * because data like owner can be filled with a copy - * of the key instead of asking the environment. - * It can also be optimized in the checks, because the keyname - * is known to be valid. + * Depending on what @p flags are given, only parts of the key will be copied. + * The supported #elektraKeyFlags values are: + * - #KEY_NAME - copies the name + * - #KEY_VALUE - copies the value + * - #KEY_META - copies all meta keys + * - #KEY_BINARY - creates a binary key, even if @p source is not binary + * + * If #KEY_NAME is set, the returned Key will have the same name as @p source. + * Otherwise, the name will be `"/"`. + * + * If #KEY_VALUE is set, the returned Key will have the same value as @p source.* + * If #KEY_BINARY is set as well, the returned Key will be a binary key independent of the type of @p source. + * + * Without #KEY_VALUE, the returned Key will have an empty value. If #KEY_BINARY is set, + * the empty value is `NULL`, otherwise it is an emtpy string `""`. + * + * If #KEY_META is set, meta keys will be copied from @p source to the returned key. + * This function creates a deep copy of meta keys, i.e. all meta keys on @p source will be `keyDup`ed before + * adding them to the returned Key. + * If you do not need this, you should prefer: + * @code +Key * dup = keyDup (source, 0); +keyCopyAllMeta (dup, source); + * @endcode + * + * Calling `keyDup (source, 0)` is equivalent to `keyDup (source, KEY_NAME | KEY_VALUE)`. * * @param source has to be an initialized source Key - * @retval 0 failure or on NULL pointer + * @param flags which parts of the key should be copied + * @retval NULL failure or on NULL pointer * @return a fully copy of source on success * @see ksAppendKey(), keyDel(), keyNew() * @ingroup key */ -Key * keyDup (const Key * source) +Key * keyDup (const Key * source, elektraKeyFlags flags) { - if (!source) return 0; + if (!source) return NULL; Key * dest = elektraCalloc (sizeof (Key)); - if (!dest) return 0; + if (!dest) return NULL; /* Copy the struct data */ *dest = *source; @@ -308,10 +330,10 @@ Key * keyDup (const Key * source) dest->key = dest->ukey = dest->data.v = dest->meta = 0; /* copy dynamic properties */ - if (keyCopy (dest, source) == -1) + if (keyCopy (dest, source, flags) == -1) { keyDel (dest); - return 0; + return NULL; } return dest; @@ -359,6 +381,7 @@ Key * keyDup (const Key * source) * @param dest the key which will be written to * @param source the key which should be copied * or NULL to clean the destination key + * @param flags same behaviour as keyDup() * @ingroup key * @retval -1 on failure when a NULL pointer * was passed for dest or a dynamic property could not @@ -367,7 +390,7 @@ Key * keyDup (const Key * source) * @retval 1 when source was successfully copied * @see keyDup() to get a duplication of a key */ -int keyCopy (Key * dest, const Key * source) +int keyCopy (Key * dest, const Key * source, elektraKeyFlags flags) { if (!dest) return -1; @@ -383,47 +406,58 @@ int keyCopy (Key * dest, const Key * source) return 0; } - // remember dynamic memory to be removed - char * destKey = dest->key; - char * destUKey = dest->ukey; - void * destData = dest->data.c; - KeySet * destMeta = dest->meta; + if (flags == 0) + { + flags = KEY_NAME | KEY_VALUE; + } + + // remember original data of dest + Key orig = *dest; // duplicate dynamic properties - if (source->key) + if (source->key && test_bit (flags, KEY_NAME)) { dest->key = elektraStrNDup (source->key, source->keySize); if (!dest->key) goto memerror; + dest->keySize = source->keySize; } else { - dest->key = 0; + dest->key = elektraStrDup ("/"); + dest->keySize = 2; } - if (source->ukey) + if (source->ukey && test_bit (flags, KEY_NAME)) { dest->ukey = elektraStrNDup (source->ukey, source->keyUSize); if (!dest->ukey) goto memerror; + dest->keyUSize = source->keyUSize; } else { - dest->ukey = 0; + dest->ukey = elektraMalloc (3); + dest->ukey[0] = KEY_NS_CASCADING; + dest->ukey[1] = '\0'; + dest->ukey[2] = '\0'; + dest->keyUSize = 3; } - if (source->data.v) + if (source->data.v && test_bit (flags, KEY_VALUE)) { dest->data.v = elektraStrNDup (source->data.v, source->dataSize); if (!dest->data.v) goto memerror; + dest->dataSize = source->dataSize; } else { dest->data.v = 0; + dest->dataSize = 0; } if (source->meta) { - dest->meta = ksDup (source->meta); + dest->meta = ksDeepDup (source->meta); if (!dest->meta) goto memerror; } else @@ -431,19 +465,20 @@ int keyCopy (Key * dest, const Key * source) dest->meta = 0; } + if (keyGetMeta (source, "binary") != NULL || test_bit (flags, KEY_BINARY)) + { + keySetMeta (dest, "binary", ""); + } + + // successful, now do the irreversible stuff: we obviously modified dest set_bit (dest->flags, KEY_FLAG_SYNC); - // copy sizes accordingly - dest->keySize = source->keySize; - dest->keyUSize = source->keyUSize; - dest->dataSize = source->dataSize; - // free old resources of destination - if (!test_bit (dest->flags, KEY_FLAG_MMAP_KEY)) elektraFree (destKey); - if (!test_bit (dest->flags, KEY_FLAG_MMAP_KEY)) elektraFree (destUKey); - if (!test_bit (dest->flags, KEY_FLAG_MMAP_DATA)) elektraFree (destData); - ksDel (destMeta); + if (!test_bit (dest->flags, KEY_FLAG_MMAP_KEY)) elektraFree (orig.key); + if (!test_bit (dest->flags, KEY_FLAG_MMAP_KEY)) elektraFree (orig.ukey); + if (!test_bit (dest->flags, KEY_FLAG_MMAP_DATA)) elektraFree (orig.data.c); + ksDel (orig.meta); return 1; @@ -452,9 +487,7 @@ int keyCopy (Key * dest, const Key * source) elektraFree (dest->data.v); ksDel (dest->meta); - dest->key = destKey; - dest->data.v = destData; - dest->meta = destMeta; + *dest = orig; return -1; } diff --git a/src/libs/elektra/keyset.c b/src/libs/elektra/keyset.c index 1e1f846dafc..3acca8a6319 100644 --- a/src/libs/elektra/keyset.c +++ b/src/libs/elektra/keyset.c @@ -348,7 +348,7 @@ KeySet * ksDeepDup (const KeySet * source) for (i = 0; i < s; ++i) { Key * k = source->array[i]; - Key * d = keyDup (k); + Key * d = keyDupOld (k); if (!test_bit (k->flags, KEY_FLAG_SYNC)) { keyClearSync (d); @@ -1785,7 +1785,7 @@ static Key * elektraLookupByCascading (KeySet * ks, Key * key, elektraLookupFlag } // we found a spec key, so we know what to do - specKey = keyDup (specKey); + specKey = keyDupOld (specKey); keySetBinary (specKey, keyValue (key), keyGetValueSize (key)); elektraCopyCallbackMeta (specKey, key); found = elektraLookupBySpec (ks, specKey, options); @@ -2119,7 +2119,7 @@ static Key * elektraLookupSearch (KeySet * ks, Key * key, elektraLookupFlags opt static Key * elektraLookupCreateKey (KeySet * ks, Key * key, ELEKTRA_UNUSED elektraLookupFlags options) { - Key * ret = keyDup (key); + Key * ret = keyDupOld (key); ksAppendKey (ks, ret); return ret; } @@ -2228,7 +2228,7 @@ Key * ksLookup (KeySet * ks, Key * key, elektraLookupFlags options) if (options & KDB_O_SPEC) { Key * lookupKey = key; - if (test_bit (key->flags, KEY_FLAG_RO_NAME)) lookupKey = keyDup (key); + if (test_bit (key->flags, KEY_FLAG_RO_NAME)) lookupKey = keyDupOld (key); ret = elektraLookupBySpec (ks, lookupKey, options & mask); if (test_bit (key->flags, KEY_FLAG_RO_NAME)) { @@ -2239,7 +2239,7 @@ Key * ksLookup (KeySet * ks, Key * key, elektraLookupFlags options) else if (!(options & KDB_O_NOCASCADING) && strcmp (name, "") && name[0] == '/') { Key * lookupKey = key; - if (test_bit (key->flags, KEY_FLAG_RO_NAME)) lookupKey = keyDup (key); + if (test_bit (key->flags, KEY_FLAG_RO_NAME)) lookupKey = keyDupOld (key); ret = elektraLookupByCascading (ks, lookupKey, options & mask); if (test_bit (key->flags, KEY_FLAG_RO_NAME)) { diff --git a/src/libs/elektra/mount.c b/src/libs/elektra/mount.c index c3b3c6df759..9f2ecb1e9e7 100644 --- a/src/libs/elektra/mount.c +++ b/src/libs/elektra/mount.c @@ -235,9 +235,9 @@ int mountDefault (KDB * kdb, KeySet * modules, int inFallback, Key * errorKey) KeySet * elektraMountGlobalsGetConfig (Key * cur, KeySet * global) { // putting together the plugins configuration KeySet. - Key * sysConfigCutKey = keyDup (cur); + Key * sysConfigCutKey = keyDupOld (cur); keyAddBaseName (sysConfigCutKey, "system"); - Key * usrConfigCutKey = keyDup (cur); + Key * usrConfigCutKey = keyDupOld (cur); keyAddBaseName (usrConfigCutKey, "user"); KeySet * sysConfigKS = ksCut (global, sysConfigCutKey); KeySet * usrConfigKS = ksCut (global, usrConfigCutKey); @@ -277,7 +277,7 @@ int elektraMountGlobalsLoadPlugin (Plugin ** plugin, KeySet * referencePlugins, KeySet * modules, Key * errorKey) { Key * refKey = elektraMountGlobalsFindPlugin (referencePlugins, cur); - Key * openKey = keyDup (errorKey); + Key * openKey = keyDupOld (errorKey); if (refKey) { @@ -651,7 +651,7 @@ int mountBackend (KDB * kdb, Backend * backend, Key * errorKey ELEKTRA_UNUSED) mountpoint[nameSize] = '\0'; } kdb->trie = trieInsert (kdb->trie, mountpoint, backend); - splitAppend (kdb->split, backend, keyDup (backend->mountpoint), 0); + splitAppend (kdb->split, backend, keyDupOld (backend->mountpoint), 0); backend->refcounter = 1; } diff --git a/src/libs/elektra/plugin.c b/src/libs/elektra/plugin.c index 3660d146956..c0b3da886af 100644 --- a/src/libs/elektra/plugin.c +++ b/src/libs/elektra/plugin.c @@ -171,7 +171,7 @@ int elektraProcessPlugins (Plugin ** plugins, KeySet * modules, KeySet * referen if (pluginName) { - Key * key = keyDup (cur); + Key * key = keyDupOld (cur); keyAddBaseName (key, "config"); KeySet * cutConfig = ksCut (config, key); keyDel (key); diff --git a/src/libs/elektra/split.c b/src/libs/elektra/split.c index 9b2615bb6b9..0b0f812085a 100644 --- a/src/libs/elektra/split.c +++ b/src/libs/elektra/split.c @@ -327,7 +327,7 @@ int splitBuildup (Split * split, KDB * kdb, Key * parentKey) printf (" def add %s\n", keyName (kdb->split->parents[i])); #endif /* Catch all: add all mountpoints */ - splitAppend (split, kdb->split->handles[i], keyDup (kdb->split->parents[i]), kdb->split->syncbits[i]); + splitAppend (split, kdb->split->handles[i], keyDupOld (kdb->split->parents[i]), kdb->split->syncbits[i]); } else if (backend == kdb->split->handles[i] && (keyCmp (kdb->split->parents[i], parentKey) == 0 || keyIsBelow (kdb->split->parents[i], parentKey) == 1)) @@ -336,7 +336,7 @@ int splitBuildup (Split * split, KDB * kdb, Key * parentKey) printf (" exa add %s\n", keyName (kdb->split->parents[i])); #endif /* parentKey is exactly in this backend, so add it! */ - splitAppend (split, kdb->split->handles[i], keyDup (kdb->split->parents[i]), kdb->split->syncbits[i]); + splitAppend (split, kdb->split->handles[i], keyDupOld (kdb->split->parents[i]), kdb->split->syncbits[i]); } else if (keyCmp (parentKey, kdb->split->parents[i]) == 0 || keyIsBelow (parentKey, kdb->split->parents[i]) == 1) { @@ -344,7 +344,7 @@ int splitBuildup (Split * split, KDB * kdb, Key * parentKey) printf (" rel add %s\n", keyName (kdb->split->parents[i])); #endif /* this backend is completely below the parentKey, so lets add it. */ - splitAppend (split, kdb->split->handles[i], keyDup (kdb->split->parents[i]), kdb->split->syncbits[i]); + splitAppend (split, kdb->split->handles[i], keyDupOld (kdb->split->parents[i]), kdb->split->syncbits[i]); } } diff --git a/src/libs/globbing/globbing.c b/src/libs/globbing/globbing.c index 6754c316488..fc347541e28 100644 --- a/src/libs/globbing/globbing.c +++ b/src/libs/globbing/globbing.c @@ -216,7 +216,7 @@ int elektraKsGlob (KeySet * result, KeySet * input, const char * pattern) if (rc == 0) { ++ret; - ksAppendKey (result, keyDup (current)); + ksAppendKey (result, keyDupOld (current)); } } ksSetCursor (input, cursor); diff --git a/src/libs/highlevel/elektra.c b/src/libs/highlevel/elektra.c index d8b892712eb..3099bc348f8 100644 --- a/src/libs/highlevel/elektra.c +++ b/src/libs/highlevel/elektra.c @@ -151,7 +151,7 @@ Elektra * elektraOpen (const char * application, KeySet * defaults, KeySet * con // BUT: anything other than helpKey may be incorrect // and only helpKey should be used anyway // so create a new config KeySet - Key * helpKeyDup = keyDup (helpKey); + Key * helpKeyDup = keyDupOld (helpKey); ksClear (config); ksAppendKey (config, helpKeyDup); } @@ -316,7 +316,7 @@ void elektraSaveKey (Elektra * elektra, Key * key, ElektraError ** error) ELEKTRA_LOG_DEBUG ("problemKey: %s\n", keyName (problemKey)); } - key = keyDup (key); + key = keyDupOld (key); kdbGet (elektra->kdb, elektra->config, elektra->parentKey); } } while (ret == -1); @@ -327,7 +327,7 @@ void insertDefaults (KeySet * config, const Key * parentKey, KeySet * defaults) ksRewind (defaults); for (Key * key = ksNext (defaults); key != NULL; key = ksNext (defaults)) { - Key * const dup = keyDup (key); + Key * const dup = keyDupOld (key); const char * name = keyName (key); keySetName (dup, keyName (parentKey)); keyAddName (dup, name); diff --git a/src/libs/highlevel/elektra_array_value.c b/src/libs/highlevel/elektra_array_value.c index b19ce7a0b38..d2a25d47733 100644 --- a/src/libs/highlevel/elektra_array_value.c +++ b/src/libs/highlevel/elektra_array_value.c @@ -36,7 +36,7 @@ extern "C" { static void elektraArraySetSize (Elektra * elektra, const char * name, kdb_long_long_t size, ElektraError ** error) { elektraSetLookupKey (elektra, name); - Key * arrayParent = keyDup (elektra->lookupKey); + Key * arrayParent = keyDupOld (elektra->lookupKey); char sizeString[ELEKTRA_MAX_ARRAY_SIZE]; elektraWriteArrayNumber (sizeString, size - 1); @@ -236,7 +236,7 @@ void elektraSetRawStringArrayElement (Elektra * elektra, const char * name, kdb_ Key * key = ksLookup (elektra->config, elektra->lookupKey, 0); if (key == NULL) { - key = keyDup (elektra->lookupKey); + key = keyDupOld (elektra->lookupKey); } keySetMeta (key, "type", type); keySetString (key, value); diff --git a/src/libs/highlevel/elektra_value.c b/src/libs/highlevel/elektra_value.c index db7c650a146..c0e87e44dfe 100644 --- a/src/libs/highlevel/elektra_value.c +++ b/src/libs/highlevel/elektra_value.c @@ -161,7 +161,7 @@ void elektraSetRawString (Elektra * elektra, const char * name, const char * val { CHECK_ERROR (elektra, error); elektraSetLookupKey (elektra, name); - Key * const key = keyDup (elektra->lookupKey); + Key * const key = keyDupOld (elektra->lookupKey); keySetMeta (key, "type", type); keySetString (key, value); elektraSaveKey (elektra, key, error); diff --git a/src/libs/merge/kdbmerge.c b/src/libs/merge/kdbmerge.c index 7c6cba19738..29a54edb7f7 100644 --- a/src/libs/merge/kdbmerge.c +++ b/src/libs/merge/kdbmerge.c @@ -261,7 +261,7 @@ static int prependStringToAllKeyNames (KeySet * result, KeySet * input, const ch { strcat (newName, keyName (key)); } - Key * duplicateKey = keyDup (key); // keySetName returns -1 if key was inserted to a keyset before + Key * duplicateKey = keyDupOld (key); // keySetName returns -1 if key was inserted to a keyset before int status = keySetName (duplicateKey, newName); elektraFree (newName); if (status < 0) @@ -305,7 +305,7 @@ static KeySet * removeRoot (KeySet * original, Key * root, Key * informationKey) }; if (keyIsBelow (root, currentKey) || keyCmp (currentKey, root) == 0) { - Key * duplicateKey = keyDup (currentKey); + Key * duplicateKey = keyDupOld (currentKey); int retVal; if (keyIsBelow (root, currentKey)) { @@ -687,7 +687,7 @@ static char * getValuesAsArray (KeySet * ks, const Key * arrayStart, Key * infor * The elektraArrayIncName would then change the name of the real key. * We don't want that as we only increase the name to loop over all keys. */ - Key * iterator = keyDup (arrayStart); + Key * iterator = keyDupOld (arrayStart); if (iterator == NULL) { ELEKTRA_SET_INTERNAL_ERROR (informationKey, "Could not duplicate key to iterate."); diff --git a/src/libs/meta/meta.c b/src/libs/meta/meta.c index 198fb21193d..f0aa156bfe6 100644 --- a/src/libs/meta/meta.c +++ b/src/libs/meta/meta.c @@ -298,13 +298,13 @@ void elektraMetaArrayAdd (Key * key, const char * metaName, const char * value) if (!meta) { keySetMeta (key, metaName, "#0"); - arrayKey = keyDup (keyGetMeta (key, metaName)); + arrayKey = keyDupOld (keyGetMeta (key, metaName)); keySetString (arrayKey, 0); keyAddBaseName (arrayKey, "#"); } else { - arrayKey = keyDup (meta); + arrayKey = keyDupOld (meta); keyAddBaseName (arrayKey, keyString (meta)); } elektraArrayIncName (arrayKey); @@ -500,7 +500,7 @@ static int resolveDeps (unsigned int j, _adjMatrix * adjMatrix, size_t size, Key resolveDep (j, adjMatrix, size); keySetMeta (adjMatrix[j].key, "order", keyBaseName (orderCounter)); elektraArrayIncName (orderCounter); - ksAppendKey (done, keyDup (adjMatrix[j].key)); + ksAppendKey (done, keyDupOld (adjMatrix[j].key)); return 1; } unsigned int max_loops = todo; @@ -522,7 +522,7 @@ static int resolveDeps (unsigned int j, _adjMatrix * adjMatrix, size_t size, Key resolveDep (i, adjMatrix, size); keySetMeta (adjMatrix[i].key, "order", keyBaseName (orderCounter)); elektraArrayIncName (orderCounter); - ksAppendKey (done, keyDup (adjMatrix[i].key)); + ksAppendKey (done, keyDupOld (adjMatrix[i].key)); } } return 1; @@ -606,7 +606,7 @@ int elektraSortTopology (KeySet * ks, Key ** array) // key has no dependencies, give it an order number and add it to list of resolved dependencies keySetMeta (cur, "order", keyBaseName (orderCounter)); elektraArrayIncName (orderCounter); - ksAppendKey (done, keyDup (cur)); + ksAppendKey (done, keyDupOld (cur)); adjMatrix[j].isResolved = 1; ksDel (deps); break; @@ -619,7 +619,7 @@ int elektraSortTopology (KeySet * ks, Key ** array) { keySetMeta (cur, "order", keyBaseName (orderCounter)); elektraArrayIncName (orderCounter); - ksAppendKey (done, keyDup (cur)); + ksAppendKey (done, keyDupOld (cur)); adjMatrix[j].isResolved = 1; ksDel (deps); break; @@ -736,7 +736,7 @@ int elektraSortTopology (KeySet * ks, Key ** array) resolveDep (j, adjMatrix, size); keySetMeta (localArray[j], "order", keyBaseName (orderCounter)); elektraArrayIncName (orderCounter); - ksAppendKey (done, keyDup (localArray[j])); + ksAppendKey (done, keyDupOld (localArray[j])); found = 1; } } @@ -780,7 +780,7 @@ int elektraSortTopology (KeySet * ks, Key ** array) char * elektraMetaArrayToString (const Key * key, const char * metaName, const char * delim) { char * result = NULL; - Key * lookupElem = keyDup (keyGetMeta (key, metaName)); + Key * lookupElem = keyDupOld (keyGetMeta (key, metaName)); keyAddBaseName (lookupElem, "#0"); Key * elem = (Key *) keyGetMeta (key, keyName (lookupElem)); if (elem != NULL) diff --git a/src/libs/opts/opts.c b/src/libs/opts/opts.c index deb63097749..ab23a7c1056 100644 --- a/src/libs/opts/opts.c +++ b/src/libs/opts/opts.c @@ -134,7 +134,7 @@ int elektraGetOpts (KeySet * ks, int argc, const char ** argv, const char ** env { elektraCursor initial = ksGetCursor (ks); - Key * specParent = keyDup (parentKey); + Key * specParent = keyDupOld (parentKey); if (keyGetNamespace (parentKey) != KEY_NS_SPEC) { keySetName (specParent, "spec"); @@ -1088,7 +1088,7 @@ bool processArgs (Key * command, Key * specKey, KeySet * argIndices, Key ** keyW } keySetMeta (*keyWithOpt, "args", "remaining"); - Key * dup = keyDup (specKey); + Key * dup = keyDupOld (specKey); keySetBaseName (dup, NULL); // remove # const char * existing = keyGetMetaString (command, "remainingargskey"); @@ -1328,7 +1328,7 @@ int writeArgsValues (KeySet * ks, Key * keyWithOpt, Key * command, KeySet * argI Key * procKey = keyNew ("proc:/", KEY_END); keyAddName (procKey, strchr (keyName (keyWithOpt), '/')); - Key * insertKey = keyDup (procKey); + Key * insertKey = keyDupOld (procKey); ksRewind (args); for (elektraCursor i = firstRemainingArg; i < ksGetSize (args); ++i) @@ -1336,7 +1336,7 @@ int writeArgsValues (KeySet * ks, Key * keyWithOpt, Key * command, KeySet * argI Key * arg = ksAtCursor (args, i); elektraArrayIncName (insertKey); - Key * k = keyDup (insertKey); + Key * k = keyDupOld (insertKey); keySetString (k, keyString (arg)); ksAppendKey (ks, k); } @@ -1455,7 +1455,7 @@ int addProcKey (KeySet * ks, const Key * key, Key * valueKey) if (isArrayKey) { - Key * insertKey = keyDup (procKey); + Key * insertKey = keyDupOld (procKey); keyAddBaseName (insertKey, "#"); KeySet * values = elektraMetaArrayToKS (valueKey, "values"); if (values == NULL) @@ -1472,7 +1472,7 @@ int addProcKey (KeySet * ks, const Key * key, Key * valueKey) { elektraArrayIncName (insertKey); - Key * k = keyDup (insertKey); + Key * k = keyDupOld (insertKey); keySetString (k, keyString (cur)); ksAppendKey (ks, k); } @@ -1578,7 +1578,7 @@ KeySet * parseArgs (Key * command, KeySet * optionsSpec, bool useSubcommands, in } elektraArrayIncName (argKey); - Key * newArgKey = keyDup (argKey); + Key * newArgKey = keyDupOld (argKey); keySetString (newArgKey, cur); ksAppendKey (options, newArgKey); } @@ -1588,7 +1588,7 @@ KeySet * parseArgs (Key * command, KeySet * optionsSpec, bool useSubcommands, in for (; i < argc; ++i) { elektraArrayIncName (argKey); - Key * newArgKey = keyDup (argKey); + Key * newArgKey = keyDupOld (argKey); keySetString (newArgKey, argv[i]); ksAppendKey (options, newArgKey); } @@ -1857,7 +1857,7 @@ int writeOptions (Key * command, Key * commandKey, Key * commandArgs, bool write { if (spec->useSubcommands) { - Key * checkKey = keyDup (keyWithOpt); + Key * checkKey = keyDupOld (keyWithOpt); if (strcmp (keyBaseName (keyWithOpt), "#") == 0) { keySetBaseName (checkKey, NULL); // remove # @@ -1940,7 +1940,7 @@ KeySet * ksMetaGetSingleOrArray (Key * key, const char * metaName) return ksNew (2, keyNew ("meta:/#", KEY_END), k, KS_END); } - Key * testKey = keyDup (k); + Key * testKey = keyDupOld (k); keyAddBaseName (testKey, keyString (k)); const Key * test = keyGetMeta (key, keyName (testKey)); @@ -2086,7 +2086,7 @@ char * generateOptionsList (KeySet * keysWithOpts, Key * commandKey) ksRewind (keysWithOpts); while ((cur = ksNext (keysWithOpts)) != NULL) { - Key * checkKey = keyDup (cur); + Key * checkKey = keyDupOld (cur); if (strcmp (keyBaseName (cur), "#") == 0) { keySetBaseName (checkKey, NULL); // remove # @@ -2136,7 +2136,7 @@ char * generateCommandsList (KeySet * keysWithOpts, Key * commandKey) ksRewind (keysWithOpts); while ((cur = ksNext (keysWithOpts)) != NULL) { - Key * checkKey = keyDup (cur); + Key * checkKey = keyDupOld (cur); if (strcmp (keyBaseName (cur), "#") == 0) { keySetBaseName (checkKey, NULL); // remove # @@ -2187,7 +2187,7 @@ char * generateArgsList (KeySet * keysWithOpts, Key * commandKey) ksRewind (keysWithOpts); while ((cur = ksNext (keysWithOpts)) != NULL) { - Key * checkKey = keyDup (cur); + Key * checkKey = keyDupOld (cur); if (strcmp (keyBaseName (cur), "#") == 0) { keySetBaseName (checkKey, NULL); // remove # diff --git a/src/libs/pluginprocess/pluginprocess.c b/src/libs/pluginprocess/pluginprocess.c index 451f6ed621d..9696d381d78 100644 --- a/src/libs/pluginprocess/pluginprocess.c +++ b/src/libs/pluginprocess/pluginprocess.c @@ -160,7 +160,7 @@ void elektraPluginProcessStart (Plugin * handle, ElektraPluginProcess * pp) Key * commandKey = ksLookupByName (commandKeySet, "/pluginprocess/command", KDB_O_NONE); Key * parentNameKey = ksLookupByName (commandKeySet, "/pluginprocess/parent/name", KDB_O_NONE); Key * parentKey = ksLookupByName (commandKeySet, "/pluginprocess/parent", KDB_O_POP); - Key * key = keyDup (parentKey); + Key * key = keyDupOld (parentKey); keySetName (key, keyString (parentNameKey)); int result = ELEKTRA_PLUGIN_STATUS_ERROR; @@ -273,7 +273,7 @@ int elektraPluginProcessSend (const ElektraPluginProcess * pp, pluginprocess_t c // Construct the command set that controls the pluginprocess communication KeySet * commandKeySet = ksNew (6, KS_END); ksAppendKey (commandKeySet, keyNew ("/pluginprocess/parent/name", KEY_VALUE, keyName (key), KEY_END)); - Key * parentKey = keyDup (key); + Key * parentKey = keyDupOld (key); keySetName (parentKey, "/pluginprocess/parent"); ksAppendKey (commandKeySet, parentKey); char * commandStr = longToStr (command); diff --git a/src/plugins/augeas/augeas.c b/src/plugins/augeas/augeas.c index f4b38b90e28..96b33e691f7 100644 --- a/src/plugins/augeas/augeas.c +++ b/src/plugins/augeas/augeas.c @@ -77,11 +77,11 @@ int elektraAugeasGenConf (KeySet * ks, Key * errorKey ELEKTRA_UNUSED) p[l - 4] = '\0'; Key * k = keyNew ("system:/", KEY_END); keyAddBaseName (k, p); - ksAppendKey (ks, keyDup (k)); + ksAppendKey (ks, keyDupOld (k)); - Key * b = keyDup (k); + Key * b = keyDupOld (k); keyAddBaseName (b, "infos"); - ksAppendKey (ks, keyDup (b)); + ksAppendKey (ks, keyDupOld (b)); keyAddBaseName (b, "provides"); char * s = elektraFormat ("storage/%s", p); keySetString (b, s); @@ -89,7 +89,7 @@ int elektraAugeasGenConf (KeySet * ks, Key * errorKey ELEKTRA_UNUSED) ksAppendKey (ks, b); keyAddBaseName (k, "config"); - ksAppendKey (ks, keyDup (k)); + ksAppendKey (ks, keyDupOld (k)); keyAddBaseName (k, "lens"); p[0] = (char) toupper (p[0]); p[l - 1] = 's'; @@ -165,7 +165,7 @@ static const char * getAugeasError (augeas * augeasHandle, const char * lensPath static Key * createKeyFromPath (Key * parentKey, const char * treePath) { - Key * key = keyDup (parentKey); + Key * key = keyDupOld (parentKey); char * baseName = elektraStrDup (treePath + strlen (AUGEAS_TREE_ROOT) + 1); char * lastSlash = strrchr (baseName, '/'); const char * lastPart = lastSlash != NULL ? lastSlash + 1 : baseName; @@ -549,7 +549,7 @@ int elektraAugeasGet (Plugin * handle, KeySet * returned, Key * parentKey) ksClear (returned); KeySet * append = ksNew ((size_t) ksGetSize (returned) * 2, KS_END); - Key * key = keyDup (parentKey); + Key * key = keyDupOld (parentKey); ksAppendKey (append, key); struct KeyConversion * conversionData = elektraMalloc (sizeof (struct KeyConversion)); @@ -562,7 +562,7 @@ int elektraAugeasGet (Plugin * handle, KeySet * returned, Key * parentKey) } conversionData->currentOrder = 0; - conversionData->parentKey = keyDup (key); + conversionData->parentKey = keyDupOld (key); conversionData->ks = append; ret = foreachAugeasNode (augeasHandle, AUGEAS_TREE_ROOT, &convertToKey, conversionData); diff --git a/src/plugins/c/c.c b/src/plugins/c/c.c index 9cd1787d175..89116622da1 100644 --- a/src/plugins/c/c.c +++ b/src/plugins/c/c.c @@ -130,7 +130,7 @@ int keyGenerate (const Key * key, FILE * stream) } const Key * meta; - Key * dup = keyDup (key); + Key * dup = keyDupOld (key); keyRewindMeta (dup); while ((meta = keyNextMeta (dup))) { diff --git a/src/plugins/cache/cache.c b/src/plugins/cache/cache.c index 15006032ec2..3d3150414a1 100644 --- a/src/plugins/cache/cache.c +++ b/src/plugins/cache/cache.c @@ -311,7 +311,7 @@ int elektraCacheGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key * pa if (!elektraStrCmp (keyString (keyGetMeta (parentKey, "cache/clear")), "1")) { // clear all caches - Key * cacheFile = keyDup (parentKey); + Key * cacheFile = keyDupOld (parentKey); char * cacheFileName = kdbCacheFileName (ch, cacheFile, modeDirectory); ELEKTRA_LOG_DEBUG ("CLEAR CACHES path: %s", cacheFileName); @@ -323,7 +323,7 @@ int elektraCacheGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key * pa } // construct cache file name from parentKey (which stores the mountpoint from mountGetMountpoint) - Key * cacheFile = keyDup (parentKey); + Key * cacheFile = keyDupOld (parentKey); char * cacheFileName = kdbCacheFileName (ch, cacheFile, modeFile); ELEKTRA_ASSERT (cacheFileName != 0, "Could not construct cache file name."); ELEKTRA_LOG_DEBUG ("CACHE get cacheFileName: %s, parentKey: %s, %s", cacheFileName, keyName (parentKey), keyString (parentKey)); @@ -357,7 +357,7 @@ int elektraCacheSet (Plugin * handle, KeySet * returned, Key * parentKey) } // construct cache file name from parentKey (which stores the mountpoint from mountGetMountpoint) - Key * cacheFile = keyDup (parentKey); + Key * cacheFile = keyDupOld (parentKey); char * cacheFileName = kdbCacheFileName (ch, cacheFile, modeFile); ELEKTRA_ASSERT (cacheFileName != 0, "Could not construct cache file name."); ELEKTRA_LOG_DEBUG ("CACHE set cacheFileName: %s, parentKey: %s, %s", cacheFileName, keyName (parentKey), keyString (parentKey)); diff --git a/src/plugins/conditionals/conditionals.c b/src/plugins/conditionals/conditionals.c index b1d2dff4256..69bee613f6d 100644 --- a/src/plugins/conditionals/conditionals.c +++ b/src/plugins/conditionals/conditionals.c @@ -506,13 +506,13 @@ static const char * isAssign (Key * key, char * expr, Key * parentKey, KeySet * Key * lookupKey; if (*firstPtr == '@') { - lookupKey = keyDup (parentKey); + lookupKey = keyDupOld (parentKey); ++firstPtr; keyAddName (lookupKey, firstPtr); } else if (!strncmp (firstPtr, "..", 2) || !strncmp (firstPtr, ".", 1)) { - lookupKey = keyDup (key); + lookupKey = keyDupOld (key); keyAddName (lookupKey, firstPtr); } else diff --git a/src/plugins/constants/constants.c.in b/src/plugins/constants/constants.c.in index 02deb7470bc..452e9052388 100644 --- a/src/plugins/constants/constants.c.in +++ b/src/plugins/constants/constants.c.in @@ -20,7 +20,7 @@ int elektraConstantsSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELEKT static void elektraAddKeyValue (KeySet * ks, Key * parentKey, const char * key, const char * value) { - Key * k = keyDup (parentKey); + Key * k = keyDupOld (parentKey); keyAddName (k, key); keySetString (k, value); ksAppendKey (ks, k); @@ -28,33 +28,33 @@ static void elektraAddKeyValue (KeySet * ks, Key * parentKey, const char * key, static void elektraAddConstants (KeySet * ks, Key * parentKey) { - Key * key = keyDup (parentKey); + Key * key = keyDupOld (parentKey); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "version"); keySetString (key, "Duplicate of version info also found below system:/elektra/version"); ksAppendKey (ks, key); - key = keyDup (key); + key = keyDupOld (key); keyAddName (key, "version/KDB_VERSION"); keySetString (key, "@KDB_VERSION@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "version/KDB_VERSION_MAJOR"); keySetString (key, "@KDB_VERSION_MAJOR@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "version/KDB_VERSION_MINOR"); keySetString (key, "@KDB_VERSION_MINOR@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "version/KDB_VERSION_PATCH"); keySetString (key, "@KDB_VERSION_PATCH@"); ksAppendKey (ks, key); @@ -65,31 +65,31 @@ static void elektraAddConstants (KeySet * ks, Key * parentKey) elektraAddKeyValue (ks, parentKey, "version/SO_VERSION_GETENV", "@SO_VERSION_GETENV@"); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "cmake"); keySetString (key, "All cmake variables as defined in the file cmake/ElektraCache.cmake"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "cmake/PLUGINS"); keySetString (key, "@ADDED_PLUGINS@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "cmake/TOOLS"); keySetString (key, "@TOOLS@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "cmake/KDB_DB_SYSTEM"); keySetString (key, "@KDB_DB_SYSTEM@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "cmake/KDB_DB_HOME"); keySetString (key, "@KDB_DB_HOME@"); ksAppendKey (ks, key); @@ -101,55 +101,55 @@ static void elektraAddConstants (KeySet * ks, Key * parentKey) elektraAddKeyValue (ks, parentKey, "cmake/KDB_DEFAULT_RESOLVER", "@KDB_DEFAULT_RESOLVER@"); elektraAddKeyValue (ks, parentKey, "cmake/KDB_DEFAULT_STORAGE", "@KDB_DEFAULT_STORAGE@"); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "cmake/KDB_DB_USER"); keySetString (key, "@KDB_DB_USER@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "cmake/GTEST_ROOT"); keySetString (key, "@GTEST_ROOT@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "cmake/BUILD_SHARED"); keySetString (key, "@BUILD_SHARED@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "cmake/BUILD_FULL"); keySetString (key, "@BUILD_FULL@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "cmake/BUILD_STATIC"); keySetString (key, "@BUILD_STATIC@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "cmake/BINDINGS"); keySetString (key, "@ADDED_BINDINGS@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "cmake/TARGET_INCLUDE_FOLDER"); keySetString (key, "@TARGET_INCLUDE_FOLDER@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "cmake/TARGET_CMAKE_FOLDER"); keySetString (key, "@TARGET_CMAKE_FOLDER@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "cmake/TARGET_PLUGIN_FOLDER"); keySetString (key, "@TARGET_PLUGIN_FOLDER@"); ksAppendKey (ks, key); @@ -162,7 +162,7 @@ static void elektraAddConstants (KeySet * ks, Key * parentKey) elektraAddKeyValue (ks, parentKey, "cmake/BUILTIN_DATA_FOLDER", BUILTIN_DATA_FOLDER); elektraAddKeyValue (ks, parentKey, "cmake/BUILTIN_EXEC_FOLDER", BUILTIN_EXEC_FOLDER); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "cmake/TARGET_PKGCONFIG_FOLDER"); keySetString (key, "@TARGET_PKGCONFIG_FOLDER@"); ksAppendKey (ks, key); @@ -172,168 +172,168 @@ static void elektraAddConstants (KeySet * ks, Key * parentKey) elektraAddKeyValue (ks, parentKey, "cmake/TARGET_DOCUMENTATION_MAN_FOLDER", "@TARGET_DOCUMENTATION_MAN_FOLDER@"); elektraAddKeyValue (ks, parentKey, "cmake/TARGET_DOCUMENTATION_LATEX_FOLDER", "@TARGET_DOCUMENTATION_LATEX_FOLDER@"); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "cmake/TARGET_TOOL_EXEC_FOLDER"); keySetString (key, "@TARGET_TOOL_EXEC_FOLDER@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "cmake/TARGET_TOOL_DATA_FOLDER"); keySetString (key, "@TARGET_TOOL_DATA_FOLDER@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "cmake/TARGET_TEST_DATA_FOLDER"); keySetString (key, "@TARGET_TEST_DATA_FOLDER@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "cmake/TARGET_TEMPLATE_FOLDER"); keySetString (key, "@TARGET_TEMPLATE_FOLDER@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "cmake/LIB_SUFFIX"); keySetString (key, "@LIB_SUFFIX@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "cmake/CMAKE_INSTALL_PREFIX"); keySetString (key, "@CMAKE_INSTALL_PREFIX@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "compiler"); keySetString (key, "Flags defined for compilers as defined in ElektraCompiling.cmake"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "compiler/c_flags"); keySetString (key, "@C_FLAGS_ESCAPED@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "compiler/id"); keySetString (key, "@CMAKE_CXX_COMPILER_ID@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "compiler/coverage"); keySetString (key, "@ENABLE_COVERAGE@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "compiler/cxx_flags"); keySetString (key, "@CXX_FLAGS_ESCAPED@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "compiler/pic_flags"); keySetString (key, "@CMAKE_PIC_FLAGS@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "compiler/static_flags"); keySetString (key, "@CMAKE_STATIC_FLAGS@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "macros"); keySetString (key, "Define the macros from kdbos.h and kdbconfig.h"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "macros/KDB_MAX_PATH_LENGTH"); keySetString (key, ELEKTRA_STRINGIFY (KDB_MAX_PATH_LENGTH)); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "macros/KDB_FILE_MODE"); keySetString (key, ELEKTRA_STRINGIFY (KDB_FILE_MODE)); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "macros/KDB_DIR_MODE"); keySetString (key, ELEKTRA_STRINGIFY (KDB_DIR_MODE)); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "macros/KDB_PATH_SEPARATOR"); keySetString (key, ELEKTRA_STRINGIFY (KDB_PATH_SEPARATOR)); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "macros/KDB_PATH_ESCAPE"); keySetString (key, ELEKTRA_STRINGIFY (KDB_PATH_ESCAPE)); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "package"); keySetString (key, "Infos about the package as it is installed"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "package/prefix"); keySetString (key, "@CMAKE_INSTALL_PREFIX@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "package/libdir"); keySetString (key, "@CMAKE_INSTALL_PREFIX@/lib@LIB_SUFFIX@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "package/includedir"); keySetString (key, "@CMAKE_INSTALL_PREFIX@/include/@TARGET_INCLUDE_FOLDER@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "package/plugindir"); keySetString (key, "@CMAKE_INSTALL_PREFIX@/lib@LIB_SUFFIX@/@TARGET_PLUGIN_FOLDER@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "package/tool_execdir"); keySetString (key, "@CMAKE_INSTALL_PREFIX@/@TARGET_TOOL_EXEC_FOLDER@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "package/templatedir"); keySetString (key, "@CMAKE_INSTALL_PREFIX@/@TARGET_TEMPLATE_FOLDER@"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "package/libs"); keySetString (key, "-L@CMAKE_INSTALL_PREFIX@/lib@LIB_SUFFIX@ -lelektra"); ksAppendKey (ks, key); - key = keyDup (parentKey); + key = keyDupOld (parentKey); keyAddName (key, "package/cflags"); keySetString (key, "-I@CMAKE_INSTALL_PREFIX@/include/@TARGET_INCLUDE_FOLDER@"); ksAppendKey (ks, key); diff --git a/src/plugins/crypto/crypto.c b/src/plugins/crypto/crypto.c index 7e8e09260b9..931b41ee1ae 100644 --- a/src/plugins/crypto/crypto.c +++ b/src/plugins/crypto/crypto.c @@ -422,7 +422,7 @@ int ELEKTRA_PLUGIN_FUNCTION (checkconf) (Key * errorKey, KeySet * conf) if (k) { // call gpg module to verify that we own the required key - Key * msg = keyDup (k); + Key * msg = keyDupOld (k); if (ELEKTRA_PLUGIN_FUNCTION (gpgDecryptMasterPassword) (conf, errorKey, msg) != 1) { keyDel (msg); diff --git a/src/plugins/crypto/helper.c b/src/plugins/crypto/helper.c index b3c38816587..818a8304714 100644 --- a/src/plugins/crypto/helper.c +++ b/src/plugins/crypto/helper.c @@ -198,7 +198,7 @@ Key * ELEKTRA_PLUGIN_FUNCTION (getMasterPassword) (Key * errorKey, KeySet * conf ELEKTRA_SET_INSTALLATION_ERRORF (errorKey, "Missing %s in plugin configuration", ELEKTRA_CRYPTO_PARAM_MASTER_PASSWORD); return NULL; } - Key * msg = keyDup (master); + Key * msg = keyDupOld (master); if (ELEKTRA_PLUGIN_FUNCTION (gpgDecryptMasterPassword) (config, errorKey, msg) != 1) { keyDel (msg); diff --git a/src/plugins/csvstorage/csvstorage.c b/src/plugins/csvstorage/csvstorage.c index 9fe80c7b75b..f09e5ead713 100644 --- a/src/plugins/csvstorage/csvstorage.c +++ b/src/plugins/csvstorage/csvstorage.c @@ -269,7 +269,7 @@ static KeySet * createHeaders (Key * parentKey, int columns, const char ** colNa KeySet * header = ksNew (0, KS_END); int colCounter = 0; // if no headerline exists name the columns 0..N where N is the number of columns - Key * orderKey = keyDup (parentKey); + Key * orderKey = keyDupOld (parentKey); keyAddName (orderKey, "#"); while (colCounter < columns) { @@ -279,7 +279,7 @@ static KeySet * createHeaders (Key * parentKey, int columns, const char ** colNa ksDel (header); return NULL; } - Key * key = keyDup (orderKey); + Key * key = keyDupOld (orderKey); if (colNames && (colNames + colCounter)) keySetString (key, colNames[colCounter]); else @@ -298,7 +298,7 @@ static KeySet * readHeaders (Key * parentKey, char * lineBuffer, char delim, int unsigned long offset = 0; char * col; offset = 0; - Key * orderKey = keyDup (parentKey); + Key * orderKey = keyDupOld (parentKey); keyAddName (orderKey, "#"); KeySet * header = ksNew (0, KS_END); while ((col = parseLine (lineBuffer, delim, offset, parentKey, lineCounter, lastLine)) != NULL) @@ -311,7 +311,7 @@ static KeySet * readHeaders (Key * parentKey, char * lineBuffer, char delim, int ksDel (header); return NULL; } - Key * key = keyDup (orderKey); + Key * key = keyDupOld (orderKey); if (colNames && (colNames + colCounter)) { keySetString (key, colNames[colCounter]); @@ -394,7 +394,7 @@ static int csvRead (KeySet * returned, Key * parentKey, char delim, Key * colAsP } Key * dirKey; Key * cur; - dirKey = keyDup (parentKey); + dirKey = keyDupOld (parentKey); keyAddName (dirKey, "#"); elektraFree (lineBuffer); ksRewind (header); @@ -428,7 +428,7 @@ static int csvRead (KeySet * returned, Key * parentKey, char delim, Key * colAsP { cur = ksNext (header); offset += elektraStrLen (col); - key = keyDup (dirKey); + key = keyDupOld (dirKey); if (col[0] == '"') { if (col[elektraStrLen (col) - 2] == '"') @@ -450,7 +450,7 @@ static int csvRead (KeySet * returned, Key * parentKey, char delim, Key * colAsP if (!(lineCounter <= 1 && useHeader)) { keySetString (dirKey, lastIndex); - ksAppendKey (tmpKs, keyDup (dirKey)); + ksAppendKey (tmpKs, keyDupOld (dirKey)); Key * lookupKey = keyNew (keyName (dirKey), KEY_END); keyAddName (lookupKey, keyString (colAsParent)); Key * indexKey = ksLookupByName (tmpKs, keyName (lookupKey), 0); @@ -458,7 +458,7 @@ static int csvRead (KeySet * returned, Key * parentKey, char delim, Key * colAsP keySetBaseName (renameKey, keyString (indexKey)); ksRewind (tmpKs); KeySet * renamedKs = ksRenameKeys (tmpKs, keyName (renameKey)); - ksAppendKey (renamedKs, keyDup (renameKey)); + ksAppendKey (renamedKs, keyDupOld (renameKey)); ksRewind (renamedKs); keyDel (lookupKey); keyDel (renameKey); @@ -472,7 +472,7 @@ static int csvRead (KeySet * returned, Key * parentKey, char delim, Key * colAsP { keySetString (dirKey, lastIndex); ksAppend (returned, tmpKs); - ksAppendKey (returned, keyDup (dirKey)); + ksAppendKey (returned, keyDupOld (dirKey)); } ksDel (tmpKs); tmpKs = NULL; @@ -495,7 +495,7 @@ static int csvRead (KeySet * returned, Key * parentKey, char delim, Key * colAsP elektraFree (lineBuffer); ksDel (tmpKs); } - key = keyDup (parentKey); + key = keyDupOld (parentKey); keySetString (key, keyBaseName (dirKey)); ksAppendKey (returned, key); keyDel (dirKey); diff --git a/src/plugins/dbus/testmod_dbus.c b/src/plugins/dbus/testmod_dbus.c index 084c03c7cd5..c00e9f75b24 100644 --- a/src/plugins/dbus/testmod_dbus.c +++ b/src/plugins/dbus/testmod_dbus.c @@ -181,7 +181,7 @@ static void test_keyAdded (void) keyAddName (parentKey, "tests/foo"); // (namespace)/tests/foo/bar - Key * toAdd = keyDup (parentKey); + Key * toAdd = keyDupOld (parentKey); keyAddName (toAdd, "bar"); keySetString (toAdd, "test"); @@ -226,7 +226,7 @@ static void test_keyChanged (void) keyAddName (parentKey, "tests/foo"); // (namespace)/tests/foo/bar - Key * toChange = keyDup (parentKey); + Key * toChange = keyDupOld (parentKey); keyAddName (toChange, "bar"); keySetString (toChange, "test"); @@ -267,11 +267,11 @@ static void test_keyDeleted (void) keyAddName (parentKey, "tests/foo"); // (namespace)/tests/foo/bar - Key * toDelete = keyDup (parentKey); + Key * toDelete = keyDupOld (parentKey); keyAddName (toDelete, "bar"); keySetString (toDelete, "test"); - KeySet * ks = ksNew (1, keyDup (toDelete), KS_END); + KeySet * ks = ksNew (1, keyDupOld (toDelete), KS_END); KeySet * conf = ksNew (0, KS_END); PLUGIN_OPEN ("dbus"); @@ -310,16 +310,16 @@ static void test_announceOnce (void) keyAddName (parentKey, "tests/foo"); // (namespace)/tests/foo/bar/#0 - Key * toAdd1 = keyDup (parentKey); + Key * toAdd1 = keyDupOld (parentKey); keyAddName (toAdd1, "bar/#0"); keySetString (toAdd1, "test"); // (namespace)/tests/foo/bar/#1 - Key * toAdd2 = keyDup (toAdd1); + Key * toAdd2 = keyDupOld (toAdd1); keySetBaseName (toAdd2, "#1"); // (namespace)/tests/foo/bar - Key * toChange = keyDup (parentKey); + Key * toChange = keyDupOld (parentKey); keyAddName (toChange, "bar"); keySetString (toChange, "test"); @@ -364,7 +364,7 @@ static void test_cascadedChangeNotification (void) keyAddName (completeParentKey, "tests/foo"); // (namespace)/tests/foo/bar - Key * toAdd = keyDup (completeParentKey); + Key * toAdd = keyDupOld (completeParentKey); keyAddName (toAdd, "bar"); keySetString (toAdd, "test"); @@ -407,7 +407,7 @@ static void test_cascadedAnnounceOnce (void) keyAddName (completeParentKey, "tests/foo"); // (namespace)/tests/foo/bar - Key * toAdd = keyDup (completeParentKey); + Key * toAdd = keyDupOld (completeParentKey); keyAddName (toAdd, "bar"); keySetString (toAdd, "test"); diff --git a/src/plugins/dpkg/dpkg.c b/src/plugins/dpkg/dpkg.c index 31a03ac5dee..a8fbe7593d7 100644 --- a/src/plugins/dpkg/dpkg.c +++ b/src/plugins/dpkg/dpkg.c @@ -59,14 +59,14 @@ static KeySet * nextPackage (FILE * fp, Key * parentKey) strtok (data, "\n"); // remove newline if (!strcmp (section, "Package")) { - baseKey = keyDup (parentKey); + baseKey = keyDupOld (parentKey); keyAddBaseName (baseKey, data); lastKey = baseKey; ksAppendKey (package, baseKey); } else { - Key * key = keyDup (baseKey); + Key * key = keyDupOld (baseKey); keyAddBaseName (key, section); keySetString (key, data); lastKey = key; diff --git a/src/plugins/fstab/fstab.c b/src/plugins/fstab/fstab.c index 923daae2667..5eb3c1b8cb8 100644 --- a/src/plugins/fstab/fstab.c +++ b/src/plugins/fstab/fstab.c @@ -110,7 +110,7 @@ int elektraFstabGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key * pa return 1; } - key = keyDup (parentKey); + key = keyDupOld (parentKey); ksAppendKey (returned, key); nr_keys++; @@ -132,45 +132,45 @@ int elektraFstabGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key * pa elektraFstabFsName (fsname, fstabEntry, &swapIndex); /* Include only the filesystem pseudo-names */ - dir = keyDup (parentKey); + dir = keyDupOld (parentKey); keyAddBaseName (dir, fsname); keySetString (dir, ""); keySetComment (dir, ""); keySetComment (dir, "Filesystem pseudo-name"); ksAppendKey (returned, dir); - key = keyDup (dir); + key = keyDupOld (dir); keyAddBaseName (key, "device"); keySetString (key, fstabEntry->mnt_fsname); keySetComment (key, "Device or Label"); ksAppendKey (returned, key); - key = keyDup (dir); + key = keyDupOld (dir); keyAddBaseName (key, "mpoint"); keySetString (key, fstabEntry->mnt_dir); keySetComment (key, "Mount point"); ksAppendKey (returned, key); - key = keyDup (dir); + key = keyDupOld (dir); keyAddBaseName (key, "type"); keySetString (key, fstabEntry->mnt_type); keySetComment (key, "Filesystem type."); ksAppendKey (returned, key); - key = keyDup (dir); + key = keyDupOld (dir); keyAddBaseName (key, "options"); keySetString (key, fstabEntry->mnt_opts); keySetComment (key, "Filesystem specific options"); ksAppendKey (returned, key); - key = keyDup (dir); + key = keyDupOld (dir); keyAddBaseName (key, "dumpfreq"); snprintf (buffer, MAX_NUMBER_SIZE, "%d", fstabEntry->mnt_freq); keySetString (key, buffer); keySetComment (key, "Dump frequency in days"); ksAppendKey (returned, key); - key = keyDup (dir); + key = keyDupOld (dir); keyAddBaseName (key, "passno"); snprintf (buffer, MAX_NUMBER_SIZE, "%d", fstabEntry->mnt_passno); keySetString (key, buffer); diff --git a/src/plugins/glob/glob.c b/src/plugins/glob/glob.c index 68714a8304b..bd3000de1f6 100644 --- a/src/plugins/glob/glob.c +++ b/src/plugins/glob/glob.c @@ -62,7 +62,7 @@ enum GlobDirection static const char * getGlobFlags (KeySet * keys, Key * globKey) { - Key * flagKey = keyDup (globKey); + Key * flagKey = keyDupOld (globKey); keyAddBaseName (flagKey, "flags"); Key * flagResult = ksLookup (keys, flagKey, KDB_O_NONE); keyDel (flagKey); @@ -114,7 +114,7 @@ static KeySet * getGlobKeys (Key * parentKey, KeySet * keys, enum GlobDirection /* We now know we want that key. Dup it to not change the configuration. */ - Key * ins = keyDup (k); + Key * ins = keyDupOld (k); /* Now look if we want cascading for the key */ if (keyString (k)[0] == '/') { diff --git a/src/plugins/hexcode/testmod_hexcode.c b/src/plugins/hexcode/testmod_hexcode.c index d5cc0c7f0c0..79e878e6d8c 100644 --- a/src/plugins/hexcode/testmod_hexcode.c +++ b/src/plugins/hexcode/testmod_hexcode.c @@ -85,7 +85,7 @@ void check_reversibility (const char * msg) char buf[1000]; hd->buf = buf; - Key * encode = keyDup (decode); + Key * encode = keyDupOld (decode); elektraHexcodeEncode (encode, hd); elektraHexcodeDecode (encode, hd); diff --git a/src/plugins/hosts/hosts-get.c b/src/plugins/hosts/hosts-get.c index 60731dea4cf..94f40dd30de 100644 --- a/src/plugins/hosts/hosts-get.c +++ b/src/plugins/hosts/hosts-get.c @@ -165,7 +165,7 @@ static char * parseAlias (KeySet * append, const Key * hostParent, char * tokenP sret = elektraParseToken (&fieldBuffer, tokenPointer); if (sret == 0) return 0; - Key * alias = keyDup (hostParent); + Key * alias = keyDupOld (hostParent); keyAddBaseName (alias, fieldBuffer); elektraFree (fieldBuffer); @@ -226,7 +226,7 @@ int elektraHostsGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key * pa ksClear (returned); KeySet * append = ksNew (ksGetSize (returned) * 2, KS_END); - Key * key = keyDup (parentKey); + Key * key = keyDupOld (parentKey); ksAppendKey (append, key); Key * currentKey = 0; @@ -241,7 +241,7 @@ int elektraHostsGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key * pa if (!currentKey) { - currentKey = keyDup (parentKey); + currentKey = keyDupOld (parentKey); } if (parseComment (comments, readBuffer, "#", &elektraAddLineComment)) continue; diff --git a/src/plugins/hosts/hosts-set.c b/src/plugins/hosts/hosts-set.c index 117215a6807..bb1821c445e 100644 --- a/src/plugins/hosts/hosts-set.c +++ b/src/plugins/hosts/hosts-set.c @@ -69,9 +69,9 @@ static void writeLineComments (Key * key, FILE * fp) { if (strcmp (keyName (current), "meta:/comment/#0") != 0) { - Key * spaceKey = keyDup (current); + Key * spaceKey = keyDupOld (current); keyAddBaseName (spaceKey, "space"); - Key * startKey = keyDup (current); + Key * startKey = keyDupOld (current); keyAddBaseName (startKey, "start"); const char * spaces = getMetaValue (key, keyName (spaceKey)); const char * start = getMetaValue (key, keyName (startKey)); @@ -143,9 +143,9 @@ int elektraHostsSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key * pa qsort (keyArray, arraySize, sizeof (Key *), keyCmpOrderWrapper); - Key * ipv4Base = keyDup (parentKey); + Key * ipv4Base = keyDupOld (parentKey); keyAddBaseName (ipv4Base, "ipv4"); - Key * ipv6Base = keyDup (parentKey); + Key * ipv6Base = keyDupOld (parentKey); keyAddBaseName (ipv6Base, "ipv6"); /* now write the hosts file */ diff --git a/src/plugins/hosts/keymetaformatting.c b/src/plugins/hosts/keymetaformatting.c index 7335c1efd2c..05f3bc5ac24 100644 --- a/src/plugins/hosts/keymetaformatting.c +++ b/src/plugins/hosts/keymetaformatting.c @@ -58,7 +58,7 @@ static void elektraAddCommentInfo (KeySet * comments, Key * commentBase, size_t if (commentStart) { /* this comment contains actual comment data */ - Key * commentStartKey = keyDup (commentBase); + Key * commentStartKey = keyDupOld (commentBase); keyAddBaseName (commentStartKey, "start"); keySetString (commentStartKey, commentStart); ksAppendKey (comments, commentStartKey); @@ -71,7 +71,7 @@ static void elektraAddCommentInfo (KeySet * comments, Key * commentBase, size_t */ if (commentStart || spaces > 0) { - Key * commentSpaceKey = keyDup (commentBase); + Key * commentSpaceKey = keyDupOld (commentBase); keyAddBaseName (commentSpaceKey, "space"); keySetStringF (commentSpaceKey, "%d", spaces); ksAppendKey (comments, commentSpaceKey); diff --git a/src/plugins/keytometa/keytometa.c b/src/plugins/keytometa/keytometa.c index 5265e169e58..1a173ab3d94 100644 --- a/src/plugins/keytometa/keytometa.c +++ b/src/plugins/keytometa/keytometa.c @@ -136,8 +136,8 @@ static void flushConvertedKeys (Key * target, KeySet * converted, KeySet * orig) Key * appendTarget = target; const char * metaName = keyString (keyGetMeta (current, CONVERT_METANAME)); - Key * currentDup = keyDup (current); - Key * targetDup = keyDup (appendTarget); + Key * currentDup = keyDupOld (current); + Key * targetDup = keyDupOld (appendTarget); keySetBaseName (currentDup, 0); keySetBaseName (targetDup, 0); diff --git a/src/plugins/line/line.c b/src/plugins/line/line.c index 30b2fb2a7ac..26d105fe282 100644 --- a/src/plugins/line/line.c +++ b/src/plugins/line/line.c @@ -48,7 +48,7 @@ int elektraLineRead (FILE * fp, KeySet * returned) { value[n - 1] = '\0'; } - read = keyDup (ksTail (returned)); + read = keyDupOld (ksTail (returned)); if (elektraArrayIncName (read) == -1) { elektraFree (value); @@ -88,8 +88,8 @@ int elektraLineGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key * par } Key * b = keyNew (keyName (parentKey), KEY_END); - ksAppendKey (returned, keyDup (b)); // start with parentKey - keyAddName (b, "#"); // start point for our array + ksAppendKey (returned, keyDupOld (b)); // start with parentKey + keyAddName (b, "#"); // start point for our array ksAppendKey (returned, b); int ret = elektraLineRead (fp, returned); diff --git a/src/plugins/list/list.c b/src/plugins/list/list.c index dae7e8274ff..0d26b01984f 100644 --- a/src/plugins/list/list.c +++ b/src/plugins/list/list.c @@ -113,7 +113,7 @@ static int listParseConfiguration (Placements * placements, KeySet * config) } } Key * sub; - Key * lookup = keyDup (cur); + Key * lookup = keyDupOld (cur); keyAddBaseName (lookup, "placements"); keyAddBaseName (lookup, "set"); sub = ksLookup (cutKS, lookup, 0); @@ -126,7 +126,7 @@ static int listParseConfiguration (Placements * placements, KeySet * config) if (strstr (setString, setStrings[setPlacement])) { rc = 1; - ksAppendKey (placements->setKS[setPlacement], keyDup (cur)); + ksAppendKey (placements->setKS[setPlacement], keyDupOld (cur)); } ++setPlacement; } @@ -142,7 +142,7 @@ static int listParseConfiguration (Placements * placements, KeySet * config) if (strstr (getString, getStrings[getPlacement])) { rc = 1; - ksAppendKey (placements->getKS[getPlacement], keyDup (cur)); + ksAppendKey (placements->getKS[getPlacement], keyDupOld (cur)); } ++getPlacement; } @@ -158,7 +158,7 @@ static int listParseConfiguration (Placements * placements, KeySet * config) if (strstr (errString, errStrings[errPlacement])) { rc = 1; - ksAppendKey (placements->errKS[errPlacement], keyDup (cur)); + ksAppendKey (placements->errKS[errPlacement], keyDupOld (cur)); } ++errPlacement; } @@ -305,7 +305,7 @@ static int runPlugins (KeySet * pluginKS, KeySet * modules, KeySet * plugins, Ke { const char * name = keyString (current); - Key * handleKey = keyDup (current); + Key * handleKey = keyDupOld (current); keyAddName (handleKey, "handle"); Key * handleLookup = ksLookup (configOrig, handleKey, 0); keyDel (handleKey); @@ -361,7 +361,7 @@ static int runPlugins (KeySet * pluginKS, KeySet * modules, KeySet * plugins, Ke slave->global = global; Key * slaveKey = keyNew ("/", KEY_BINARY, KEY_SIZE, sizeof (Plugin *), KEY_VALUE, &slave, KEY_END); keyAddBaseName (slaveKey, name); - ksAppendKey (plugins, keyDup (slaveKey)); + ksAppendKey (plugins, keyDupOld (slaveKey)); keyDel (slaveKey); } } @@ -497,7 +497,7 @@ static char * getPluginPlacementList (Plugin * plugin) KeySet * ksResult = ksNew (0, KS_END); plugin->kdbGet (plugin, ksResult, pluginInfo); - Key * placementsKey = keyDup (pluginInfo); + Key * placementsKey = keyDupOld (pluginInfo); keyAddBaseName (placementsKey, "infos"); keyAddBaseName (placementsKey, "placements"); Key * placements = ksLookup (ksResult, placementsKey, 0); @@ -644,7 +644,7 @@ static Key * findPluginInConfig (KeySet * config, const char * pluginName) if (strcmp (keyString (cur), pluginName) == 0) { // found plugin - Key * result = keyDup (cur); + Key * result = keyDupOld (cur); keyDel (configBase); ksDel (array); return result; @@ -743,7 +743,7 @@ int elektraListMountPlugin (Plugin * handle, const char * pluginName, KeySet * p // Find plugin placements char * placementList = getPluginPlacementList (plugin); - Key * pluginPlacements = keyDup (pluginItem); + Key * pluginPlacements = keyDupOld (pluginItem); keyAddBaseName (pluginPlacements, "placements"); // Append keys to list plugin configuration @@ -754,7 +754,7 @@ int elektraListMountPlugin (Plugin * handle, const char * pluginName, KeySet * p char * getPlacementsString = extractGetPlacements (placementList); if (getPlacementsString != NULL) { - Key * getPlacements = keyDup (pluginPlacements); + Key * getPlacements = keyDupOld (pluginPlacements); keyAddBaseName (getPlacements, "get"); keySetString (getPlacements, getPlacementsString); ksAppendKey (config, getPlacements); @@ -766,7 +766,7 @@ int elektraListMountPlugin (Plugin * handle, const char * pluginName, KeySet * p char * setPlacementsString = extractSetPlacements (placementList); if (setPlacementsString != NULL) { - Key * setPlacements = keyDup (pluginPlacements); + Key * setPlacements = keyDupOld (pluginPlacements); keyAddBaseName (setPlacements, "set"); keySetString (setPlacements, setPlacementsString); ksAppendKey (config, setPlacements); @@ -777,7 +777,7 @@ int elektraListMountPlugin (Plugin * handle, const char * pluginName, KeySet * p char * errorPlacementsString = extractErrorPlacements (placementList); if (errorPlacementsString != NULL) { - Key * errorPlacements = keyDup (pluginPlacements); + Key * errorPlacements = keyDupOld (pluginPlacements); keyAddBaseName (errorPlacements, "error"); keySetString (errorPlacements, errorPlacementsString); ksAppendKey (config, errorPlacements); @@ -823,7 +823,7 @@ int elektraListUnmountPlugin (Plugin * handle, const char * pluginName, Key * er } // Look for plugin via handle - Key * pluginHandle = keyDup (pluginItem); + Key * pluginHandle = keyDupOld (pluginItem); keyAddName (pluginHandle, "handle"); pluginHandle = ksLookup (config, pluginHandle, KDB_O_DEL); @@ -895,7 +895,7 @@ Plugin * elektraListFindPlugin (Plugin * handle, const char * pluginName) { while ((current = ksNext (placements->getKS[i])) != NULL) { - Key * handleKey = keyDup (current); + Key * handleKey = keyDupOld (current); keyAddName (handleKey, "handle"); Key * handleLookup = ksLookup (config, handleKey, KDB_O_DEL); if (handleLookup) @@ -909,7 +909,7 @@ Plugin * elektraListFindPlugin (Plugin * handle, const char * pluginName) { while ((current = ksNext (placements->setKS[i])) != NULL) { - Key * handleKey = keyDup (current); + Key * handleKey = keyDupOld (current); keyAddName (handleKey, "handle"); Key * handleLookup = ksLookup (config, handleKey, KDB_O_DEL); if (handleLookup) @@ -923,7 +923,7 @@ Plugin * elektraListFindPlugin (Plugin * handle, const char * pluginName) { while ((current = ksNext (placements->errKS[i])) != NULL) { - Key * handleKey = keyDup (current); + Key * handleKey = keyDupOld (current); keyAddName (handleKey, "handle"); Key * handleLookup = ksLookup (config, handleKey, KDB_O_DEL); if (handleLookup) diff --git a/src/plugins/logchange/logchange.c b/src/plugins/logchange/logchange.c index 03bd45d0f7f..a76dc28bb1f 100644 --- a/src/plugins/logchange/logchange.c +++ b/src/plugins/logchange/logchange.c @@ -52,7 +52,7 @@ int elektraLogchangeGet (Plugin * handle, KeySet * returned, Key * parentKey ELE if (strncmp (keyString (ksLookupByName (elektraPluginGetConfig (handle), "/log/get", 0)), "1", 1) == 0) { - KeySet * logset = ksNew (1, keyDup (parentKey), KS_END); + KeySet * logset = ksNew (1, keyDupOld (parentKey), KS_END); logKeys (logset, "loading configuration"); ksDel (logset); } diff --git a/src/plugins/mmapstorage/mmapstorage.c b/src/plugins/mmapstorage/mmapstorage.c index 6078f31a8fa..85a68ff67ab 100644 --- a/src/plugins/mmapstorage/mmapstorage.c +++ b/src/plugins/mmapstorage/mmapstorage.c @@ -1327,7 +1327,7 @@ int ELEKTRA_PLUGIN_FUNCTION (get) (Plugin * handle ELEKTRA_UNUSED, KeySet * ks, int fd = -1; char * mappedRegion = MAP_FAILED; - Key * initialParent = keyDup (parentKey); + Key * initialParent = keyDupOld (parentKey); if (elektraStrCmp (keyString (parentKey), STDIN_FILENAME) == 0) { @@ -1504,7 +1504,7 @@ int ELEKTRA_PLUGIN_FUNCTION (set) (Plugin * handle ELEKTRA_UNUSED, KeySet * ks, int fd = -1; char * mappedRegion = MAP_FAILED; DynArray * dynArray = 0; - Key * initialParent = keyDup (parentKey); + Key * initialParent = keyDupOld (parentKey); if (elektraStrCmp (keyString (parentKey), STDOUT_FILENAME) == 0) { diff --git a/src/plugins/multifile/multifile.c b/src/plugins/multifile/multifile.c index 3a48dbfc039..5e33fb85743 100644 --- a/src/plugins/multifile/multifile.c +++ b/src/plugins/multifile/multifile.c @@ -407,7 +407,7 @@ static Codes updateFiles (Plugin * handle, MultiConfig * mc, KeySet * returned, { Codes rc = NOUPDATE; KeySet * found = ksNew (0, KS_END); - Key * initialParent = keyDup (parentKey); + Key * initialParent = keyDupOld (parentKey); rc = updateFilesGlob (handle, mc, found, parentKey); if (rc == ERROR) @@ -488,7 +488,7 @@ static Codes updateFiles (Plugin * handle, MultiConfig * mc, KeySet * returned, static Codes doGetStorage (MultiConfig * mc, Key * parentKey) { ksRewind (mc->childBackends); - Key * initialParent = keyDup (parentKey); + Key * initialParent = keyDupOld (parentKey); Codes rc = NOUPDATE; Key * k; while ((k = ksNext (mc->childBackends)) != NULL) @@ -609,7 +609,7 @@ int elektraMultifileGet (Plugin * handle, KeySet * returned, Key * parentKey ELE static Codes resolverSet (MultiConfig * mc, Key * parentKey) { ksRewind (mc->childBackends); - Key * initialParent = keyDup (parentKey); + Key * initialParent = keyDupOld (parentKey); Key * k; Codes rc = NOUPDATE; while ((k = ksNext (mc->childBackends)) != NULL) @@ -650,7 +650,7 @@ static Codes resolverSet (MultiConfig * mc, Key * parentKey) static Codes doSetStorage (MultiConfig * mc, Key * parentKey) { ksRewind (mc->childBackends); - Key * initialParent = keyDup (parentKey); + Key * initialParent = keyDupOld (parentKey); Codes rc = NOUPDATE; Key * k; while ((k = ksNext (mc->childBackends)) != NULL) @@ -686,7 +686,7 @@ static Codes doSetStorage (MultiConfig * mc, Key * parentKey) static Codes doCommit (MultiConfig * mc, Key * parentKey) { ksRewind (mc->childBackends); - Key * initialParent = keyDup (parentKey); + Key * initialParent = keyDupOld (parentKey); Codes rc = NOUPDATE; Key * k; while ((k = ksNext (mc->childBackends)) != NULL) @@ -828,7 +828,7 @@ int elektraMultifileError (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELE if (!mc) return 0; ksRewind (mc->childBackends); Key * key; - Key * initialParent = keyDup (parentKey); + Key * initialParent = keyDupOld (parentKey); while ((key = ksNext (mc->childBackends)) != NULL) { SingleConfig * s = *(SingleConfig **) keyValue (key); diff --git a/src/plugins/passwd/passwd.c b/src/plugins/passwd/passwd.c index 40057b0591f..cdd89b51461 100644 --- a/src/plugins/passwd/passwd.c +++ b/src/plugins/passwd/passwd.c @@ -128,7 +128,7 @@ static KeySet * pwentToKS (struct passwd * pwd, Key * parentKey, SortBy index) snprintf (id, sizeof (id), "%u", pwd->pw_uid); keyAddBaseName (append, id); keySetBinary (append, 0, 0); - ksAppendKey (ks, keyDup (append)); + ksAppendKey (ks, keyDupOld (append)); keyAddBaseName (append, "name"); keySetString (append, pwd->pw_name); } @@ -136,33 +136,33 @@ static KeySet * pwentToKS (struct passwd * pwd, Key * parentKey, SortBy index) { keyAddBaseName (append, pwd->pw_name); keySetBinary (append, 0, 0); - ksAppendKey (ks, keyDup (append)); + ksAppendKey (ks, keyDupOld (append)); snprintf (id, sizeof (id), "%u", pwd->pw_uid); keyAddBaseName (append, "uid"); keySetString (append, id); } - ksAppendKey (ks, keyDup (append)); + ksAppendKey (ks, keyDupOld (append)); keySetString (append, 0); keySetBaseName (append, "shell"); keySetString (append, pwd->pw_shell); - ksAppendKey (ks, keyDup (append)); + ksAppendKey (ks, keyDupOld (append)); keySetString (append, 0); keySetBaseName (append, "home"); keySetString (append, pwd->pw_dir); - ksAppendKey (ks, keyDup (append)); + ksAppendKey (ks, keyDupOld (append)); keySetString (append, 0); keySetBaseName (append, "gid"); snprintf (id, sizeof (id), "%u", pwd->pw_gid); keySetString (append, id); - ksAppendKey (ks, keyDup (append)); + ksAppendKey (ks, keyDupOld (append)); keySetString (append, 0); keySetBaseName (append, "passwd"); keySetString (append, pwd->pw_passwd); - ksAppendKey (ks, keyDup (append)); + ksAppendKey (ks, keyDupOld (append)); keySetString (append, 0); keySetBaseName (append, "gecos"); keySetString (append, pwd->pw_gecos); - ksAppendKey (ks, keyDup (append)); + ksAppendKey (ks, keyDupOld (append)); keyDel (append); return ks; } @@ -227,7 +227,7 @@ static struct passwd * KStoPasswd (KeySet * ks, SortBy index) struct passwd * pwd = elektraMalloc (sizeof (struct passwd)); ksRewind (ks); Key * parent = ksNext (ks); - Key * lookup = keyDup (parent); + Key * lookup = keyDupOld (parent); Key * found = NULL; if (index == UID) { diff --git a/src/plugins/process/process.c b/src/plugins/process/process.c index ba05baf8b35..f2bda22cbb7 100644 --- a/src/plugins/process/process.c +++ b/src/plugins/process/process.c @@ -151,7 +151,7 @@ static void adjustContract (KeySet * pluginContract, KeySet * contract) Key * cur; while ((cur = ksNext (pluginContract)) != NULL) { - Key * cpy = keyDup (cur); + Key * cpy = keyDupOld (cur); keySetBaseName (cpy, NULL); if (!elektraStrCmp ("infos", keyBaseName (cpy))) { @@ -196,7 +196,7 @@ int elektraProcessGet (Plugin * handle, KeySet * returned, Key * parentKey) if (!validPluginName (pluginName, parentKey) || !process->plugin) return ELEKTRA_PLUGIN_STATUS_SUCCESS; - Key * pluginParentKey = keyDup (parentKey); + Key * pluginParentKey = keyDupOld (parentKey); keySetBaseName (pluginParentKey, keyString (pluginName)); KeySet * pluginContract = ksNew (30, KS_END); diff --git a/src/plugins/profile/profile.c b/src/plugins/profile/profile.c index 804ea4c38e7..3c447f366e2 100644 --- a/src/plugins/profile/profile.c +++ b/src/plugins/profile/profile.c @@ -90,9 +90,9 @@ static void linkProfileKeys (KeySet * swKS, KeySet * profileKeys, KeySet * appen profileString = keyString (profileKey); if (profileString) { - profileCutKey = keyDup (profileKey); + profileCutKey = keyDupOld (profileKey); keyAddName (profileCutKey, ".."); - Key * currentProfileKey = keyDup (profileCutKey); + Key * currentProfileKey = keyDupOld (profileCutKey); keyAddBaseName (currentProfileKey, "current"); keyAddBaseName (profileCutKey, profileString); KeySet * profileKS = ksCut (swKS, profileCutKey); @@ -113,8 +113,8 @@ static void linkProfileKeys (KeySet * swKS, KeySet * profileKeys, KeySet * appen } keyDel (lookupKey); keySetMeta (overrideKey, "override/#0", keyName (cur)); - ksAppendKey (swKS, keyDup (overrideKey)); - ksAppendKey (appendedKeys, keyDup (overrideKey)); + ksAppendKey (swKS, keyDupOld (overrideKey)); + ksAppendKey (appendedKeys, keyDupOld (overrideKey)); keyDel (overrideKey); } keyDel (currentProfileKey); @@ -131,12 +131,12 @@ static void linkDefaultKeys (KeySet * swKS, KeySet * profileParents, KeySet * ap Key * profileParent = NULL; while ((profileParent = ksNext (profileParents)) != NULL) { - Key * defaultCutKey = keyDup (profileParent); + Key * defaultCutKey = keyDupOld (profileParent); keyAddName (defaultCutKey, "%"); KeySet * defaultKS = ksCut (swKS, defaultCutKey); ksRewind (defaultKS); Key * cur; - Key * currentProfileKey = keyDup (profileParent); + Key * currentProfileKey = keyDupOld (profileParent); keyAddName (currentProfileKey, "current"); while ((cur = ksNext (defaultKS)) != NULL) { @@ -153,8 +153,8 @@ static void linkDefaultKeys (KeySet * swKS, KeySet * profileParents, KeySet * ap } keyDel (existingKey); keySetMeta (overrideKey, "override/#0", keyName (cur)); - ksAppendKey (swKS, keyDup (overrideKey)); - ksAppendKey (appendedKeys, keyDup (overrideKey)); + ksAppendKey (swKS, keyDupOld (overrideKey)); + ksAppendKey (appendedKeys, keyDupOld (overrideKey)); keyDel (overrideKey); } keyDel (currentProfileKey); @@ -209,9 +209,9 @@ int elektraProfileGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELEKTRA { if (!fnmatch (CURRENTPATH, keyName (cur), FNM_PATHNAME)) { - Key * profileParent = keyDup (cur); + Key * profileParent = keyDupOld (cur); keyAddName (profileParent, ".."); - ksAppendKey (profileParents, keyDup (profileParent)); + ksAppendKey (profileParents, keyDupOld (profileParent)); keyDel (profileParent); } } diff --git a/src/plugins/reference/reference.c b/src/plugins/reference/reference.c index 529aea77e7c..2de6e74bcd0 100644 --- a/src/plugins/reference/reference.c +++ b/src/plugins/reference/reference.c @@ -116,7 +116,7 @@ static int checkSingleReference (const Key * key, KeySet * allKeys, Key * parent } else { - refArray = ksNew (1, keyDup (key), KS_END); + refArray = ksNew (1, keyDupOld (key), KS_END); } ksRewind (refArray); @@ -249,7 +249,7 @@ static int checkRecursiveReference (const Key * rootKey, KeySet * allKeys, Key * KeySet * keysToCheck = ksNew (0, KS_END); const char * refname = keyBaseName (curRoot); - Key * rootParent = keyDup (curRoot); + Key * rootParent = keyDupOld (curRoot); keySetBaseName (rootParent, NULL); ksAppendKey (keysToCheck, rootParent); @@ -311,7 +311,7 @@ static int checkRecursiveReference (const Key * rootKey, KeySet * allKeys, Key * } else { - Key * element = keyDup (baseKey); + Key * element = keyDupOld (baseKey); keyAddBaseName (element, "#0"); refArray = ksNew (1, element, KS_END); } @@ -387,7 +387,7 @@ static int checkRecursiveReference (const Key * rootKey, KeySet * allKeys, Key * if (!rgContains (referenceGraph, refKeyName)) { - ksAppendKey (keysToCheck, keyDup (refKey)); + ksAppendKey (keysToCheck, keyDupOld (refKey)); rgAddNode (referenceGraph, refKeyName); } rgAddEdge (referenceGraph, curName, refKeyName); diff --git a/src/plugins/reference/referencegraph.c b/src/plugins/reference/referencegraph.c index c96d9fa4e26..fb5794ef759 100644 --- a/src/plugins/reference/referencegraph.c +++ b/src/plugins/reference/referencegraph.c @@ -59,7 +59,7 @@ bool rgAddEdge (RefGraph * graph, const char * fromNode, const char * toNode) return false; } - Key * lastKey = keyDup (keyGetMeta (node, "last")); + Key * lastKey = keyDupOld (keyGetMeta (node, "last")); if (elektraArrayIncName (lastKey) < 0) { keyDel (lastKey); diff --git a/src/plugins/rename/rename.c b/src/plugins/rename/rename.c index 3c90a712a20..482e01757d2 100644 --- a/src/plugins/rename/rename.c +++ b/src/plugins/rename/rename.c @@ -146,7 +146,7 @@ Key * elektraKeyCreateNewName (const Key * key, const Key * parentKey, const cha elektraFree (curKeyName); if (replace) { - Key * result = keyDup (key); + Key * result = keyDupOld (key); keySetName (result, keyName (parentKey)); keyAddName (result, newName); elektraFree (newName); @@ -214,7 +214,7 @@ static Key * restoreKeyName (Key * key, const Key * parentKey, const Key * confi if (strcmp (keyString (origNameKey), keyName (key))) { int hasSync = keyNeedSync (key); // test_bit(key->flags, KEY_FLAG_SYNC); - Key * result = keyDup (key); + Key * result = keyDupOld (key); keySetName (result, keyString (origNameKey)); keySetMeta (result, ELEKTRA_ORIGINAL_NAME_META, 0); @@ -230,7 +230,7 @@ static Key * restoreKeyName (Key * key, const Key * parentKey, const Key * confi if (configKey) { int hasSync = keyNeedSync (key); // test_bit(key->flags, KEY_FLAG_SYNC); - Key * result = keyDup (key); + Key * result = keyDupOld (key); keySetName (result, keyName (parentKey)); keyAddName (result, keyString (configKey)); @@ -363,7 +363,7 @@ int elektraRenameSet (Plugin * handle, KeySet * returned, Key * parentKey) { renamedKey = restoreKeyName (key, parentKey, cutConfig); - if (!renamedKey) renamedKey = keyDup (key); + if (!renamedKey) renamedKey = keyDupOld (key); if (writeConversion == TOUPPER || writeConversion == TOLOWER) { char * curKeyName = elektraMalloc (keyGetNameSize (renamedKey)); diff --git a/src/plugins/rename/testmod_rename.c b/src/plugins/rename/testmod_rename.c index c3c5d63098e..236a372526d 100644 --- a/src/plugins/rename/testmod_rename.c +++ b/src/plugins/rename/testmod_rename.c @@ -129,7 +129,7 @@ static void test_metaCutOnGet (void) static void test_simpleCutRestoreOnSet (void) { Key * parentKey = keyNew ("user:/tests/rename", KEY_END); - Key * parentKeyCopy = keyDup (parentKey); + Key * parentKeyCopy = keyDupOld (parentKey); KeySet * conf = ksNew (20, keyNew ("system:/cut", KEY_VALUE, "will/be/stripped", KEY_END), KS_END); PLUGIN_OPEN ("rename"); @@ -168,7 +168,7 @@ static void test_simpleCutRestoreOnSet (void) static void test_withoutConfig (void) { Key * parentKey = keyNew ("user:/tests/rename", KEY_END); - Key * parentKeyCopy = keyDup (parentKey); + Key * parentKeyCopy = keyDupOld (parentKey); KeySet * conf = ksNew (0, KS_END); PLUGIN_OPEN ("rename"); diff --git a/src/plugins/spec/spec.c b/src/plugins/spec/spec.c index 85c2879126d..6d774b81843 100644 --- a/src/plugins/spec/spec.c +++ b/src/plugins/spec/spec.c @@ -322,7 +322,7 @@ static int handleErrors (Key * key, Key * parentKey, KeySet * ks, Key * specKey, parseLocalConfig (specKey, &localCh, isKdbGet); - Key * parentLookup = keyDup (key); + Key * parentLookup = keyDupOld (key); keySetBaseName (parentLookup, NULL); elektraCursor cursor = ksGetCursor (ks); @@ -612,7 +612,7 @@ static KeySet * instantiateArraySpec (KeySet * ks, Key * arraySpec, Key * parent while (strcmp (elem, arraySize) <= 0) { - Key * new = keyDup (k); + Key * new = keyDupOld (k); keyAddBaseName (new, elem); ksAppendKey (curNew, new); @@ -631,7 +631,7 @@ static KeySet * instantiateArraySpec (KeySet * ks, Key * arraySpec, Key * parent ksRewind (newKeys); while ((k = ksNext (newKeys)) != NULL) { - Key * new = keyDup (k); + Key * new = keyDupOld (k); keyAddBaseName (new, cur); ksAppendKey (curNew, new); } @@ -704,7 +704,7 @@ static bool isWildcardSpec (const Key * key) */ static void validateWildcardSubs (KeySet * ks, Key * key) { - Key * parent = keyDup (key); + Key * parent = keyDupOld (key); keySetBaseName (parent, NULL); // TODO: [improvement] ksExtract?, like ksCut, but doesn't remove -> no need for ksDup diff --git a/src/plugins/specload/specload.c b/src/plugins/specload/specload.c index bc52326b3ee..038d8062ced 100644 --- a/src/plugins/specload/specload.c +++ b/src/plugins/specload/specload.c @@ -595,7 +595,7 @@ int isChangeAllowed (Key * oldKey, Key * newKey) } else { - oldKey = keyDup (oldKey); + oldKey = keyDupOld (oldKey); } if (newKey == NULL) @@ -610,7 +610,7 @@ int isChangeAllowed (Key * oldKey, Key * newKey) } else { - newKey = keyDup (newKey); + newKey = keyDupOld (newKey); } KeySet * metaDiff = calculateMetaDiff (oldKey, newKey); diff --git a/src/plugins/toml/driver.c b/src/plugins/toml/driver.c index 2c30aa197a5..1b8c6da939b 100644 --- a/src/plugins/toml/driver.c +++ b/src/plugins/toml/driver.c @@ -83,7 +83,7 @@ static Driver * createDriver (Key * parent, KeySet * keys) } driver->root = parent; driver->keys = keys; - driver->parentStack = pushParent (NULL, keyDup (parent)); + driver->parentStack = pushParent (NULL, keyDupOld (parent)); driver->filename = elektraStrDup (keyString (parent)); driver->simpleTableActive = false; driver->drainCommentsOnKeyExit = true; @@ -461,7 +461,7 @@ void driverExitTableArray (Driver * driver) driver->order--; // Undo order increment Key * key = buildTableArrayKeyName (driver->tableArrayStack); - Key * rootNameKey = keyDup (key); + Key * rootNameKey = keyDupOld (key); keyAddName (rootNameKey, ".."); Key * existingRoot = ksLookup (driver->keys, rootNameKey, 0); diff --git a/src/plugins/toml/prepare.c b/src/plugins/toml/prepare.c index 3ec59897db7..65405c73abe 100644 --- a/src/plugins/toml/prepare.c +++ b/src/plugins/toml/prepare.c @@ -226,7 +226,7 @@ static ArrayInfo * updateArrayInfo (ArrayInfo * root, Key * name, size_t index) { return NULL; } - element->name = keyDup (name); + element->name = keyDupOld (name); element->maxIndex = index; element->next = root; return element; diff --git a/src/plugins/toml/table_array.c b/src/plugins/toml/table_array.c index 0286ea604a2..a380d33f7ee 100644 --- a/src/plugins/toml/table_array.c +++ b/src/plugins/toml/table_array.c @@ -74,7 +74,7 @@ static char * getChildFraction (const Key * parent, const Key * child) } else { - Key * childDup = keyDup (child); + Key * childDup = keyDupOld (child); size_t fracSize = 256; char * fraction = elektraCalloc (sizeof (char) * fracSize); if (fraction == NULL) diff --git a/src/plugins/toml/testmod_toml.c b/src/plugins/toml/testmod_toml.c index e98400c6bf5..9aa12152c55 100644 --- a/src/plugins/toml/testmod_toml.c +++ b/src/plugins/toml/testmod_toml.c @@ -55,7 +55,7 @@ { \ if (lastKey != NULL) \ { \ - lastKey = keyDup (lastKey); \ + lastKey = keyDupOld (lastKey); \ ksAppendKey (expectedKs, lastKey); \ } \ } diff --git a/src/plugins/uname/uname.c b/src/plugins/uname/uname.c index eb797dc2728..5141ace6c4d 100644 --- a/src/plugins/uname/uname.c +++ b/src/plugins/uname/uname.c @@ -23,34 +23,34 @@ static void elektraAddUname (KeySet * returned, Key * parentKey) { Key * dir; - Key * key = keyDup (parentKey); + Key * key = keyDupOld (parentKey); ksAppendKey (returned, key); struct utsname buf; uname (&buf); // TODO: handle error - dir = keyDup (parentKey); + dir = keyDupOld (parentKey); keyAddBaseName (dir, "sysname"); keySetString (dir, buf.sysname); ksAppendKey (returned, dir); - dir = keyDup (parentKey); + dir = keyDupOld (parentKey); keyAddBaseName (dir, "nodename"); keySetString (dir, buf.nodename); ksAppendKey (returned, dir); - dir = keyDup (parentKey); + dir = keyDupOld (parentKey); keyAddBaseName (dir, "release"); keySetString (dir, buf.release); ksAppendKey (returned, dir); - dir = keyDup (parentKey); + dir = keyDupOld (parentKey); keyAddBaseName (dir, "version"); keySetString (dir, buf.version); ksAppendKey (returned, dir); - dir = keyDup (parentKey); + dir = keyDupOld (parentKey); keyAddBaseName (dir, "machine"); keySetString (dir, buf.machine); ksAppendKey (returned, dir); diff --git a/src/plugins/yajl/yajl_gen.c b/src/plugins/yajl/yajl_gen.c index 1a714209d8b..bf77d2a0ec2 100644 --- a/src/plugins/yajl/yajl_gen.c +++ b/src/plugins/yajl/yajl_gen.c @@ -197,7 +197,7 @@ int elektraGenEmpty (yajl_gen g, KeySet * returned, Key * parentKey) } else if (ksGetSize (returned) == 2) // maybe just parent+specialkey { - Key * toCheck = keyDup (parentKey); + Key * toCheck = keyDupOld (parentKey); keyAddBaseName (toCheck, "###empty_array"); if (!strcmp (keyName (ksTail (returned)), keyName (toCheck))) diff --git a/src/plugins/yajl/yajl_parse.c b/src/plugins/yajl/yajl_parse.c index bc0eeae2bc9..e566e22177e 100644 --- a/src/plugins/yajl/yajl_parse.c +++ b/src/plugins/yajl/yajl_parse.c @@ -265,7 +265,7 @@ static void elektraYajlParseSuppressNonLeafKeys (KeySet * returned) if (ksNext (returned) == NULL) break; - Key * peekDup = keyDup (ksCurrent (returned)); + Key * peekDup = keyDupOld (ksCurrent (returned)); keySetBaseName (peekDup, 0); if (!strcmp (keyName (peekDup), keyName (cur))) @@ -301,7 +301,7 @@ static void elektraYajlParseSuppressEmptyMap (KeySet * returned, Key * parentKey if (ksGetSize (returned) == 2) { - Key * lookupKey = keyDup (parentKey); + Key * lookupKey = keyDupOld (parentKey); keyAddBaseName (lookupKey, "___empty_map"); Key * toRemove = ksLookup (returned, lookupKey, KDB_O_POP); diff --git a/tests/abi/testabi_key.c b/tests/abi/testabi_key.c index a37a552d7ab..7e72ba32848 100644 --- a/tests/abi/testabi_key.c +++ b/tests/abi/testabi_key.c @@ -116,7 +116,7 @@ static void test_keyNewSystem (void) key = keyNew ("system:/sw/test", KEY_END); succeed_if (key != NULL, "keyNew: Unable to create a key with name"); succeed_if_same_string (keyName (key), "system:/sw/test"); - keyCopy (key, 0); + keyCopyOld (key, 0); succeed_if_same_string (keyName (key), "/"); succeed_if (keyDel (key) == 0, "keyDel: Unable to delete key with name"); @@ -219,26 +219,26 @@ static void test_keyReference (void) succeed_if (keyIncRef (key) == 4, "keyIncRef return value"); succeed_if (keyGetRef (key) == 4, "After keyIncRef key reference"); - d = keyDup (key); + d = keyDupOld (key); succeed_if (keyGetRef (d) == 0, "After keyDup key reference"); succeed_if (keyIncRef (d) == 1, "keyIncRef return value"); succeed_if (keyGetRef (key) == 4, "Reference should not change"); succeed_if (keyDecRef (d) == 0, "decrement key"); succeed_if (keyDel (d) == 0, "last keyDel d, key exist"); - keyCopy (c, key); + keyCopyOld (c, key); succeed_if (keyGetRef (c) == 0, "After keyCopy key reference"); succeed_if (keyIncRef (c) == 1, "keyIncRef return value"); succeed_if (keyGetRef (key) == 4, "Reference should not change"); - keyCopy (c, key); + keyCopyOld (c, key); succeed_if (keyGetRef (c) == 1, "After keyCopy key reference"); succeed_if (keyDecRef (c) == 0, "keyDecRef return value"); succeed_if (keyGetRef (key) == 4, "Reference should not change"); succeed_if (keyIncRef (c) == 1, "keyIncRef return value"); succeed_if (keyIncRef (c) == 2, "keyIncRef return value"); - keyCopy (c, key); + keyCopyOld (c, key); succeed_if (keyGetRef (c) == 2, "After keyCopy key reference"); succeed_if (keyDecRef (c) == 1, "keyDecRef return value"); succeed_if (keyDecRef (c) == 0, "keyDecRef return value"); @@ -737,10 +737,10 @@ static void test_keyNameSlashes (void) key = keyNew (tstKeyName[i].keyName, KEY_END); succeed_if (keyGetRef (copy) == 0, "reference of copy not correct"); - keyCopy (copy, key); + keyCopyOld (copy, key); succeed_if (keyGetRef (copy) == 0, "reference of copy not correct"); - Key * dup = keyDup (key); + Key * dup = keyDupOld (key); succeed_if (keyGetRef (dup) == 0, "reference of dup not correct"); compare_key (copy, key); @@ -1378,14 +1378,14 @@ static void test_keyDup (void) printf ("Test key duplication\n"); - succeed_if (keyDup (0) == 0, "could not duplicate null"); + succeed_if (keyDupOld (0) == 0, "could not duplicate null"); // Create test key orig = keyNew ("user:/foo/bar", KEY_BINARY, KEY_SIZE, 6, KEY_VALUE, "foobar", KEY_COMMENT, "mycomment", KEY_END); // Dup the key - succeed_if ((copy = keyDup (orig)) != 0, "keyDup failed"); + succeed_if ((copy = keyDupOld (orig)) != 0, "keyDup failed"); compare_key (orig, copy); keyDel (orig); // everything independent from original! @@ -1396,7 +1396,7 @@ static void test_keyDup (void) // Dup the key again Key * ccopy; - succeed_if ((ccopy = keyDup (copy)) != 0, "keyDup failed"); + succeed_if ((ccopy = keyDupOld (copy)) != 0, "keyDup failed"); compare_key (copy, ccopy); keyDel (copy); // everything independent from original! @@ -1409,7 +1409,7 @@ static void test_keyDup (void) orig = keyNew ("/", KEY_END); keySetName (orig, "invalid"); - succeed_if ((copy = keyDup (orig)) != 0, "keyDup failed"); + succeed_if ((copy = keyDupOld (orig)) != 0, "keyDup failed"); succeed_if_same_string (keyName (orig), "/"); succeed_if_same_string (keyName (copy), "/"); succeed_if (keyGetNameSize (orig) == 2, "orig name size"); @@ -1433,12 +1433,12 @@ static void test_keyCopy (void) // Copy the key copy = keyNew ("/", KEY_END); - succeed_if (keyCopy (copy, orig) == 1, "keyCopy failed"); + succeed_if (keyCopyOld (copy, orig) == 1, "keyCopy failed"); succeed_if (keyGetRef (orig) == 0, "orig ref counter should be 0"); succeed_if (keyGetRef (copy) == 0, "copy ref counter should be 0"); compare_key (orig, copy); - succeed_if (keyCopy (copy, orig) == 1, "keyCopy failed"); + succeed_if (keyCopyOld (copy, orig) == 1, "keyCopy failed"); succeed_if (keyGetRef (orig) == 0, "orig ref counter should be 0"); succeed_if (keyGetRef (copy) == 0, "copy ref counter should be 0"); compare_key (orig, copy); @@ -1449,10 +1449,10 @@ static void test_keyCopy (void) succeed_if (strncmp (keyValue (copy), "foobar", 6) == 0, "keyCopy: key value copy error"); orig = keyNew ("/", KEY_END); - succeed_if (keyCopy (copy, orig) == 1, "make a key copy of an unmodified key"); + succeed_if (keyCopyOld (copy, orig) == 1, "make a key copy of an unmodified key"); compare_key (orig, copy); - succeed_if (keyCopy (copy, 0) == 0, "make the key copy fresh"); + succeed_if (keyCopyOld (copy, 0) == 0, "make the key copy fresh"); compare_key (orig, copy); keyDel (orig); @@ -1462,7 +1462,7 @@ static void test_keyCopy (void) keySetName (orig, "invalid"); copy = keyNew ("/", KEY_END); - succeed_if (keyCopy (copy, orig) == 1, "keyCopy failed"); + succeed_if (keyCopyOld (copy, orig) == 1, "keyCopy failed"); succeed_if_same_string (keyName (orig), "/"); succeed_if_same_string (keyName (copy), "/"); succeed_if (keyGetNameSize (orig) == 2, "orig name size"); @@ -1481,7 +1481,7 @@ static void test_keyCopy (void) succeed_if (keyNeedSync (copy), "fresh key does not need sync?"); succeed_if (keyGetRef (orig) == 1, "orig ref counter should be 1"); succeed_if (keyGetRef (copy) == 0, "copy ref counter should be 0"); - succeed_if (keyCopy (orig, copy) == -1, "copy should not be allowed when key is already referred to"); + succeed_if (keyCopyOld (orig, copy) == -1, "copy should not be allowed when key is already referred to"); succeed_if (keyNeedSync (orig), "copied key does not need sync?"); succeed_if (keyNeedSync (copy), "copied key does not need sync?"); diff --git a/tests/abi/testabi_ks.c b/tests/abi/testabi_ks.c index 2a66c1125ab..850f74c4195 100644 --- a/tests/abi/testabi_ks.c +++ b/tests/abi/testabi_ks.c @@ -178,7 +178,7 @@ static void test_ksReference (void) succeed_if (ksHead (ks) == k1, "head wrong"); succeed_if (ksTail (ks) == k1, "tail wrong"); - k2 = keyDup (k1); + k2 = keyDupOld (k1); keySetString (k2, "newvalue"); succeed_if (keyGetRef (k2) == 0, "reference counter not resetted"); @@ -748,7 +748,7 @@ static void test_ksSort (void) k1 = keyNew ("user:/xname", KEY_END); ksAppendKey (ks, k1); - k2 = keyDup (k1); + k2 = keyDupOld (k1); succeed_if (keyGetRef (k2) == 0, "reference counter not resetted"); ksAppendKey (ks, k2); @@ -760,7 +760,7 @@ static void test_ksSort (void) ks = ksNew (0, KS_END); k1 = keyNew ("user:/yname", KEY_END); - k2 = keyDup (k1); + k2 = keyDupOld (k1); ksAppendKey (ks, k2); ksAppendKey (ks, k1); @@ -1316,7 +1316,7 @@ static void test_ksLookupNameCascading (void) Key * k2; ksAppendKey (ks, k1 = keyNew ("system:/test/myapp/key", KEY_VALUE, "wrong", KEY_END)); ksAppendKey (ks, k2 = keyNew ("user:/test/myapp/key", KEY_VALUE, "correct", KEY_END)); - ksAppendKey (ks, keyDup ((s = keyNew ("/test/myapp/key", KEY_END)))); + ksAppendKey (ks, keyDupOld ((s = keyNew ("/test/myapp/key", KEY_END)))); succeed_if (ksGetSize (ks) == 3, "initial size of keyset"); succeed_if (keyGetNameSize (s) == 16, "initial name size"); @@ -1571,7 +1571,7 @@ int ksFilter (KeySet * result, KeySet * input, int (*filter) (Key * k)) else if (rc != 0) { ++ret; - ksAppendKey (result, keyDup (current)); + ksAppendKey (result, keyDupOld (current)); } } ksSetCursor (input, cursor); @@ -1994,7 +1994,7 @@ static void test_ksAppendKey (void) succeed_if (ksCurrent (ks) == cur, "did not update current position"); succeed_if (ksGetSize (ks) == 4, "size not correct after 4 keys"); - Key * newKey = keyDup (cur); + Key * newKey = keyDupOld (cur); keySetBaseName (newKey, "second_bool_key"); succeed_if (ksAppendKey (ks, newKey) == 5, "could not append a key"); @@ -2212,7 +2212,7 @@ static void test_cut (void) for (int i = 0; i < 16; ++i) { orig = set_a (); - cutpoint = keyDup (ksAtCursor (orig, i)); + cutpoint = keyDupOld (ksAtCursor (orig, i)); result = ksCut (orig, cutpoint); compare_keyset (result, cmp_result[i]); @@ -2710,7 +2710,7 @@ static void test_simpleLookup (void) Key * k0 = ksLookup (ks, searchKey, 0); succeed_if (!k0, "we have a problem: found not inserted key"); - Key * dup = keyDup (searchKey); + Key * dup = keyDupOld (searchKey); succeed_if_same_string (keyName (dup), "user:/something"); succeed_if_same_string (keyString (dup), "a value"); ksAppendKey (ks, dup); @@ -2797,7 +2797,7 @@ static void test_ksAppend2 (void) succeed_if_same_string (keyValue (keyGetMeta (ksCurrent (ks2), "hello")), "hello_world"); succeed_if (keyGetMeta (ksCurrent (ks2), "error") == 0, "hello was not set up to now"); - Key * dup = keyDup (inks); + Key * dup = keyDupOld (inks); succeed_if_same_string (keyValue (keyGetMeta (inks, "hello")), "hello_world"); succeed_if (keyGetMeta (inks, "error") == 0, "hello was not set up to now"); @@ -2825,7 +2825,7 @@ static void test_ksAppend2 (void) ksRewind (iter); Key * key = ksNext (iter); succeed_if (keyGetMeta (key, "name") == 0, "no such meta exists"); - Key * result = keyDup (key); + Key * result = keyDupOld (key); succeed_if (keyGetRef (parent) == 2, "ref wrong"); succeed_if (keyGetRef (result) == 0, "ref wrong"); keySetName (result, keyName (parent)); diff --git a/tests/abi/testabi_meta.c b/tests/abi/testabi_meta.c index c234fcc7688..5067bdb5cb1 100644 --- a/tests/abi/testabi_meta.c +++ b/tests/abi/testabi_meta.c @@ -180,7 +180,7 @@ static void test_dup (void) succeed_if (keySetMeta (key, "test", "some_meta_test") == sizeof ("some_meta_test"), "could not set meta"); succeed_if_same_string (keyValue (keyGetMeta (key, "test")), "some_meta_test"); - dup = keyDup (key); + dup = keyDupOld (key); succeed_if_same_string (keyValue (keyGetMeta (dup, "test")), "some_meta_test"); succeed_if (keySetMeta (dup, "test", "some_other_meta_test") == sizeof ("some_other_meta_test"), "sizeof meta test wrong"); succeed_if_same_string (keyValue (keyGetMeta (dup, "test")), "some_other_meta_test"); @@ -200,7 +200,7 @@ static void j (Key * k) // receive key g_c memcpy (value, keyValue (k), size); - keyCopy (k, g_c); + keyCopyOld (k, g_c); if (bstring) keySetString (k, value); else diff --git a/tests/ctest/test_key.c b/tests/ctest/test_key.c index 75dc619e3e9..3928922d84a 100644 --- a/tests/ctest/test_key.c +++ b/tests/ctest/test_key.c @@ -370,13 +370,13 @@ static void test_keySetName (void) succeed_if (keySetName (key, "/") != -1, "could not set cascading name"); succeed_if_same_string (keyName (key), "/"); - dup = keyDup (key); + dup = keyDupOld (key); succeed_if_same_string (keyName (dup), "/"); keyDel (dup); keySetName (key, "/c"); succeed_if_same_string (keyName (key), "/c"); - dup = keyDup (key); + dup = keyDupOld (key); succeed_if_same_string (keyName (dup), "/c"); keyDel (dup); @@ -384,43 +384,43 @@ static void test_keySetName (void) succeed_if_same_string (keyName (key), "/"); keySetName (key, "/cascading"); succeed_if_same_string (keyName (key), "/cascading"); - dup = keyDup (key); + dup = keyDupOld (key); succeed_if_same_string (keyName (dup), "/cascading"); keyDel (dup); keySetName (key, "/cascading/s/deep/below"); succeed_if_same_string (keyName (key), "/cascading/s/deep/below"); - dup = keyDup (key); + dup = keyDupOld (key); succeed_if_same_string (keyName (dup), "/cascading/s/deep/below"); keyDel (dup); keySetName (key, "user:/cascading/s/deep/below"); succeed_if_same_string (keyName (key), "user:/cascading/s/deep/below"); - dup = keyDup (key); + dup = keyDupOld (key); succeed_if_same_string (keyName (dup), "user:/cascading/s/deep/below"); keyDel (dup); keySetName (key, "system:/cascading/s/deep/below"); succeed_if_same_string (keyName (key), "system:/cascading/s/deep/below"); - dup = keyDup (key); + dup = keyDupOld (key); succeed_if_same_string (keyName (dup), "system:/cascading/s/deep/below"); keyDel (dup); keySetName (key, "meta:/order"); succeed_if_same_string (keyName (key), "meta:/order"); - dup = keyDup (key); + dup = keyDupOld (key); succeed_if_same_string (keyName (dup), "meta:/order"); keyDel (dup); keySetName (key, "meta:/check/type"); succeed_if_same_string (keyName (key), "meta:/check/type"); - dup = keyDup (key); + dup = keyDupOld (key); succeed_if_same_string (keyName (dup), "meta:/check/type"); keyDel (dup); keySetName (key, "meta:/a"); succeed_if_same_string (keyName (key), "meta:/a"); - dup = keyDup (key); + dup = keyDupOld (key); succeed_if_same_string (keyName (dup), "meta:/a"); keyDel (dup); @@ -432,21 +432,21 @@ static void test_keySetName (void) keySetName (key, "/cascading"); succeed_if_same_string (keyName (key), "/cascading"); - dup = keyDup (key); + dup = keyDupOld (key); succeed_if_same_string (keyName (dup), "/cascading"); keyDel (dup); keySetName (key, "meta:/"); succeed_if_same_string (keyName (key), "meta:/"); succeed_if (key->key != 0, "null pointer?"); - dup = keyDup (key); + dup = keyDupOld (key); succeed_if_same_string (keyName (dup), "meta:/"); keyDel (dup); keySetName (key, "meta:/other"); succeed_if_same_string (keyName (key), "meta:/other"); succeed_if (key->key != 0, "null pointer?"); - dup = keyDup (key); + dup = keyDupOld (key); succeed_if_same_string (keyName (dup), "meta:/other"); keyDel (dup); @@ -454,31 +454,31 @@ static void test_keySetName (void) { keySetName (key, "spec:/test"); succeed_if_same_string (keyName (key), "spec:/test"); - dup = keyDup (key); + dup = keyDupOld (key); succeed_if_same_string (keyName (dup), "spec:/test"); keyDel (dup); keySetName (key, "proc:/test"); succeed_if_same_string (keyName (key), "proc:/test"); - dup = keyDup (key); + dup = keyDupOld (key); succeed_if_same_string (keyName (dup), "proc:/test"); keyDel (dup); keySetName (key, "dir:/test"); succeed_if_same_string (keyName (key), "dir:/test"); - dup = keyDup (key); + dup = keyDupOld (key); succeed_if_same_string (keyName (dup), "dir:/test"); keyDel (dup); keySetName (key, "user:/test"); succeed_if_same_string (keyName (key), "user:/test"); - dup = keyDup (key); + dup = keyDupOld (key); succeed_if_same_string (keyName (dup), "user:/test"); keyDel (dup); keySetName (key, "system:/test"); succeed_if_same_string (keyName (key), "system:/test"); - dup = keyDup (key); + dup = keyDupOld (key); succeed_if_same_string (keyName (dup), "system:/test"); keyDel (dup); } @@ -710,12 +710,12 @@ static void test_keyNeedSync (void) succeed_if (keyNeedSync (k), "new meta, should definitely need sync"); clear_bit (k->flags, KEY_FLAG_SYNC); - Key * d = keyDup (k); + Key * d = keyDupOld (k); succeed_if (keyNeedSync (d), "dup key, should definitely need sync"); clear_bit (k->flags, KEY_FLAG_SYNC); clear_bit (d->flags, KEY_FLAG_SYNC); - succeed_if (keyCopy (d, k) != -1, "copy not successful"); + succeed_if (keyCopyOld (d, k) != -1, "copy not successful"); succeed_if (keyNeedSync (d), "copy key, should definitely need sync"); succeed_if (!keyNeedSync (k), "sources sync flag should not be affected"); keyDel (d); @@ -756,12 +756,12 @@ static void test_keyCopy (void) Key * k = keyNew ("/", KEY_END); Key * c = keyNew ("user:/name", KEY_END); - succeed_if (keyCopy (c, k) != -1, "could not copy"); + succeed_if (keyCopyOld (c, k) != -1, "could not copy"); succeed_if_same_string (keyName (k), "/"); succeed_if_same_string (keyName (c), "/"); succeed_if (keySetName (k, "/abc") != -1, "could not set cascading name"); - succeed_if (keyCopy (c, k) != -1, "could not copy"); + succeed_if (keyCopyOld (c, k) != -1, "could not copy"); succeed_if_same_string (keyName (k), "/abc"); succeed_if_same_string (keyName (c), "/abc"); diff --git a/tests/ctest/test_ks.c b/tests/ctest/test_ks.c index ac9babe056c..905aa31f323 100644 --- a/tests/ctest/test_ks.c +++ b/tests/ctest/test_ks.c @@ -106,7 +106,7 @@ static void test_creatingLookup (void) searchKey = keyNew ("/something", KEY_VALUE, "a value", KEY_END); // check if duplication works: - Key * dupKey = keyDup (searchKey); + Key * dupKey = keyDupOld (searchKey); succeed_if_same_string (keyName (dupKey), keyName (searchKey)); succeed_if_same_string (keyString (dupKey), keyString (searchKey)); ksAppendKey (ks, dupKey); diff --git a/tests/ctest/test_spec.c b/tests/ctest/test_spec.c index 82823244bb3..4c0f7e9c2a2 100644 --- a/tests/ctest/test_spec.c +++ b/tests/ctest/test_spec.c @@ -146,7 +146,7 @@ static void test_lookupNoOverride (void) KEY_META, "override/#2", "/test/heavy_material_lift/limit", KEY_END); // clang-format on - Key * dup = keyDup (specKey); + Key * dup = keyDupOld (specKey); Key * k1 = 0; Key * k2 = 0; @@ -199,7 +199,7 @@ static void test_lookupNoascading (void) Key * specKey = keyNew ("/abc", KEY_END); - Key * d = keyDup (specKey); + Key * d = keyDupOld (specKey); keySetString (d, "dup"); succeed_if_same_string (keyName (specKey), "/abc"); succeed_if_same_string (keyName (d), "/abc"); diff --git a/tests/ctest/test_storage.c b/tests/ctest/test_storage.c index 39dada79ae9..0b6006b8098 100644 --- a/tests/ctest/test_storage.c +++ b/tests/ctest/test_storage.c @@ -437,7 +437,7 @@ static void test_keyDup (const size_t storagePlugin, const char * tmpFile) Key * found = ksLookupByName (ks, "user:/tests/storage/b", 0); succeed_if (found, "did not find key"); - Key * duplicate = keyDup (found); + Key * duplicate = keyDupOld (found); // check that keyDup has not changed KeySet KeySet * expected = metaTestKeySet (); @@ -467,7 +467,7 @@ static void test_keyCopy_newKey (const size_t storagePlugin, const char * tmpFil succeed_if (found, "did not find key"); Key * copy = keyNew ("/", KEY_END); - succeed_if (keyCopy (copy, found) != -1, "keyCopy failed"); + succeed_if (keyCopyOld (copy, found) != -1, "keyCopy failed"); compare_key (found, copy); @@ -507,8 +507,8 @@ static void test_keyCopy_clearOverwriteKey (const size_t storagePlugin, const ch } // overwrite Key - succeed_if (keyCopy (found, 0) == 0, "keyCopy: clear destination failed"); - succeed_if (keyCopy (found, toCopy) == 1, "keyCopy failed"); + succeed_if (keyCopyOld (found, 0) == 0, "keyCopy: clear destination failed"); + succeed_if (keyCopyOld (found, toCopy) == 1, "keyCopy failed"); compare_key (found, toCopy); keyDel (toCopy); @@ -615,7 +615,7 @@ static void test_keySetName (const size_t storagePlugin, const char * tmpFile) Key * found = ksLookupByName (ks, "user:/tests/storage/b", 0); succeed_if (found, "did not find key"); - Key * duplicate = keyDup (found); + Key * duplicate = keyDupOld (found); keySetName (duplicate, "user:/tests/storage/z"); keySetString (duplicate, "zzz"); @@ -681,7 +681,7 @@ static void test_keyValue (const size_t storagePlugin, const char * tmpFile) Key * key = keyNew (name, KEY_END); keySetBinary (key, value, valueSize); - ksAppendKey (ks, keyDup (key)); + ksAppendKey (ks, keyDupOld (key)); succeed_if (plugin->kdbSet (plugin, ks, parentKey) == 1, "kdbSet was not successful"); succeed_if (plugin->kdbGet (plugin, ks, parentKey) == 1, "kdbGet was not successful");