summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-05-02 15:34:02 +0100
committerRichard W.M. Jones <rjones@redhat.com>2012-05-14 15:40:53 +0100
commite7120d25ac26dc1d05608310927dc03169547706 (patch)
tree991c07f163fe66c4e55a3b4ad23a31900594493b
parent095c565cc7352117e00cf48d33c9880a4b34eb34 (diff)
downloadlibguestfs-e7120d25ac26dc1d05608310927dc03169547706.tar.gz
libguestfs-e7120d25ac26dc1d05608310927dc03169547706.tar.xz
libguestfs-e7120d25ac26dc1d05608310927dc03169547706.zip
fish: Move 'feature_available' function to global.
This is just code motion. (cherry picked from commit 79bf966ceaa3508698f19bdc951ffc51693eb499)
-rw-r--r--fish/edit.c20
-rw-r--r--fish/fish.c19
-rw-r--r--fish/fish.h1
3 files changed, 20 insertions, 20 deletions
diff --git a/fish/edit.c b/fish/edit.c
index 517c098a..1538e356 100644
--- a/fish/edit.c
+++ b/fish/edit.c
@@ -32,7 +32,6 @@
static char *generate_random_name (const char *filename);
static int copy_attributes (const char *src, const char *dest);
-static int feature_available (guestfs_h *g, const char *feature);
/* guestfish edit command, suggested by Ján Ondrej, implemented by RWMJ */
@@ -241,22 +240,3 @@ copy_attributes (const char *src, const char *dest)
return 0;
}
-
-static int
-feature_available (guestfs_h *g, const char *feature)
-{
- /* If there's an error we should ignore it, so to do that we have to
- * temporarily replace the error handler with a null one.
- */
- guestfs_error_handler_cb old_error_cb;
- void *old_error_data;
- old_error_cb = guestfs_get_error_handler (g, &old_error_data);
- guestfs_set_error_handler (g, NULL, NULL);
-
- const char *groups[] = { feature, NULL };
- int r = guestfs_available (g, (char * const *) groups);
-
- guestfs_set_error_handler (g, old_error_cb, old_error_data);
-
- return r == 0 ? 1 : 0;
-}
diff --git a/fish/fish.c b/fish/fish.c
index 575fe99d..52d01850 100644
--- a/fish/fish.c
+++ b/fish/fish.c
@@ -1771,3 +1771,22 @@ progress_callback (guestfs_h *g, void *data,
progress_bar_set (bar, position, total);
}
+
+int
+feature_available (guestfs_h *g, const char *feature)
+{
+ /* If there's an error we should ignore it, so to do that we have to
+ * temporarily replace the error handler with a null one.
+ */
+ guestfs_error_handler_cb old_error_cb;
+ void *old_error_data;
+ old_error_cb = guestfs_get_error_handler (g, &old_error_data);
+ guestfs_set_error_handler (g, NULL, NULL);
+
+ const char *groups[] = { feature, NULL };
+ int r = guestfs_available (g, (char * const *) groups);
+
+ guestfs_set_error_handler (g, old_error_cb, old_error_data);
+
+ return r == 0 ? 1 : 0;
+}
diff --git a/fish/fish.h b/fish/fish.h
index d25fd356..14408329 100644
--- a/fish/fish.h
+++ b/fish/fish.h
@@ -81,6 +81,7 @@ extern void free_file_in (char *s);
extern char *file_out (const char *arg);
extern void extended_help_message (void);
extern void progress_callback (guestfs_h *g, void *data, uint64_t event, int event_handle, int flags, const char *buf, size_t buf_len, const uint64_t *array, size_t array_len);
+extern int feature_available (guestfs_h *g, const char *feature);
/* in cmds.c (auto-generated) */
extern void list_commands (void);