summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--degesch.c67
m---------liberty0
2 files changed, 1 insertions, 66 deletions
diff --git a/degesch.c b/degesch.c
index 1e93dc3..ba624de 100644
--- a/degesch.c
+++ b/degesch.c
@@ -1980,42 +1980,6 @@ get_aliases_config (struct app_context *ctx)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-static char *
-write_configuration_file (const struct str *data, struct error **e)
-{
- struct str path;
- str_init (&path);
- get_xdg_home_dir (&path, "XDG_CONFIG_HOME", ".config");
- str_append (&path, "/" PROGRAM_NAME);
-
- if (!mkdir_with_parents (path.str, e))
- goto error;
-
- str_append (&path, "/" PROGRAM_NAME ".conf");
- FILE *fp = fopen (path.str, "w");
- if (!fp)
- {
- error_set (e, "could not open `%s' for writing: %s",
- path.str, strerror (errno));
- goto error;
- }
-
- errno = 0;
- fwrite (data->str, data->len, 1, fp);
- fclose (fp);
-
- if (errno)
- {
- error_set (e, "writing to `%s' failed: %s", path.str, strerror (errno));
- goto error;
- }
- return str_steal (&path);
-
-error:
- str_free (&path);
- return NULL;
-}
-
static void
serialize_configuration (struct config_item *root, struct str *output)
{
@@ -7136,7 +7100,7 @@ save_configuration (struct app_context *ctx)
serialize_configuration (ctx->config.root, &data);
struct error *e = NULL;
- char *filename = write_configuration_file (&data, &e);
+ char *filename = write_configuration_file (NULL, &data, &e);
str_free (&data);
if (!filename)
@@ -10655,35 +10619,6 @@ app_editline_init (struct input *self)
// --- Configuration loading ---------------------------------------------------
-static bool
-read_file (const char *filename, struct str *output, struct error **e)
-{
- FILE *fp = fopen (filename, "rb");
- if (!fp)
- {
- error_set (e, "could not open `%s' for reading: %s",
- filename, strerror (errno));
- return false;
- }
-
- char buf[BUFSIZ];
- size_t len;
-
- while ((len = fread (buf, 1, sizeof buf, fp)) == sizeof buf)
- str_append_data (output, buf, len);
- str_append_data (output, buf, len);
-
- bool success = !ferror (fp);
- fclose (fp);
-
- if (success)
- return true;
-
- error_set (e, "error while reading `%s': %s",
- filename, strerror (errno));
- return false;
-}
-
static struct config_item *
load_configuration_file (const char *filename, struct error **e)
{
diff --git a/liberty b/liberty
-Subproject 91fca5cb054fc95fe2e7ac090cac2c3a302565c
+Subproject 8b2e41ed8ffac0494763495896c6a80a9e9db54