diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2015-12-13 22:44:18 +0100 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2015-12-13 22:44:27 +0100 |
commit | 7d531a9bbf01e15573c4a5b9d6a06bd20eb2f983 (patch) | |
tree | f8d3cca1fc70c41e59aeaa5f768bc2466a9c44e4 | |
parent | 1c009f394a65930e066a85357c0f0347ef8cc413 (diff) | |
download | xK-7d531a9bbf01e15573c4a5b9d6a06bd20eb2f983.tar.gz xK-7d531a9bbf01e15573c4a5b9d6a06bd20eb2f983.tar.xz xK-7d531a9bbf01e15573c4a5b9d6a06bd20eb2f983.zip |
Bump liberty
-rw-r--r-- | degesch.c | 67 | ||||
m--------- | liberty | 0 |
2 files changed, 1 insertions, 66 deletions
@@ -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 |