YAML: Remove `goto` statement
@@ -513,18 +513,17 @@ int elektraYamlSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELEKTRA_UN
int errorNumber = errno;
FILE * destination = fopen (keyString (parentKey), "w");
- if (!destination) goto error;
// The bitwise or in the next line is correct, since we need to close the file even if writing fails
- if ((writeFile (destination, returned, parentKey) < 0) | (fclose (destination) == EOF)) goto error; //! OCLint
-
- return ELEKTRA_PLUGIN_STATUS_SUCCESS;
-
-error:
+ if (!destination || (writeFile (destination, returned, parentKey) < 0) | (fclose (destination) == EOF)) //! OCLint
+ {
ELEKTRA_SET_ERROR_SET (parentKey);
errno = errorNumber;
return ELEKTRA_PLUGIN_STATUS_ERROR;
}
+ return ELEKTRA_PLUGIN_STATUS_SUCCESS;
+}
+
Plugin * ELEKTRA_PLUGIN_EXPORT (yaml)
{
return elektraPluginExport ("yaml", ELEKTRA_PLUGIN_GET, &elektraYamlGet, ELEKTRA_PLUGIN_SET, &elektraYamlSet, ELEKTRA_PLUGIN_END);
