Directory Value: Use separate contract function
#include <kdbhelper.h>
-int elektraDirectoryvalueGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key * parentKey)
-{
- if (!elektraStrCmp (keyName (parentKey), "system/elektra/modules/directoryvalue"))
+/**
+ * @brief This function returns a key set containing the contract of this plugin.
+ *
+ * @return A contract describing the functionality of this plugin.
+ */
+static KeySet * directoryValueContract (void)
{
- KeySet * contract =
- ksNew (30, keyNew ("system/elektra/modules/directoryvalue", KEY_VALUE,
- "directoryvalue plugin waits for your orders", KEY_END),
+ return ksNew (30,
+ keyNew ("system/elektra/modules/directoryvalue", KEY_VALUE, "directoryvalue plugin waits for your orders", KEY_END),
keyNew ("system/elektra/modules/directoryvalue/exports", KEY_END),
keyNew ("system/elektra/modules/directoryvalue/exports/get", KEY_FUNC, elektraDirectoryvalueGet, KEY_END),
keyNew ("system/elektra/modules/directoryvalue/exports/set", KEY_FUNC, elektraDirectoryvalueSet, KEY_END),
#include ELEKTRA_README (directoryvalue)
keyNew ("system/elektra/modules/directoryvalue/infos/version", KEY_VALUE, PLUGINVERSION, KEY_END), KS_END);
+}
+
+int elektraDirectoryvalueGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key * parentKey)
+{
+ if (!elektraStrCmp (keyName (parentKey), "system/elektra/modules/directoryvalue"))
+ {
+ KeySet * contract = directoryValueContract ();
ksAppend (returned, contract);
ksDel (contract);
return ELEKTRA_PLUGIN_STATUS_SUCCESS;
}
+
return ELEKTRA_PLUGIN_STATUS_NO_UPDATE;
}
