[network-manager-libreswan/th/vpn-plugin-debug-bgo766872: 11/22] shared: move write_config_option() from header to source file



commit 5efea8ca1b99430c1e17ca5fb31c1d41cb2b53d3
Author: Thomas Haller <thaller redhat com>
Date:   Thu May 26 12:51:59 2016 +0200

    shared: move write_config_option() from header to source file

 po/POTFILES.in |    2 +-
 shared/utils.c |   58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 shared/utils.h |   58 ++++---------------------------------------------------
 3 files changed, 64 insertions(+), 54 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index bfb0960..089b619 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -5,7 +5,7 @@ auth-dialog/main.c
 properties/nm-libreswan-editor-plugin.c
 properties/nm-libreswan-editor.c
 src/nm-libreswan-service.c
-shared/utils.h
+shared/utils.c
 shared/nm-utils/nm-shared-utils.c
 shared/nm-vpn/nm-vpn-plugin-utils.c
 [type: gettext/glade]properties/nm-libreswan-dialog.ui
diff --git a/shared/utils.c b/shared/utils.c
index 38977a9..fe311a0 100644
--- a/shared/utils.c
+++ b/shared/utils.c
@@ -27,6 +27,64 @@
 
 #include <unistd.h>
 #include <string.h>
+#include <errno.h>
+
+gboolean
+write_config_option_newline (int fd,
+                             gboolean new_line,
+                             NMDebugWriteFcn debug_write_fcn,
+                             GError **error,
+                             const char *format, ...)
+{
+       gs_free char *string = NULL;
+       const char *p;
+       va_list args;
+       gsize l;
+       int errsv;
+       gssize w;
+
+       va_start (args, format);
+       string = g_strdup_vprintf (format, args);
+       va_end (args);
+
+       if (debug_write_fcn)
+               debug_write_fcn (string);
+
+       l = strlen (string);
+       if (new_line) {
+               gs_free char *s = string;
+
+               string = g_new (char, l + 1 + 1);
+               memcpy (string, s, l);
+               string[l] = '\n';
+               string[l + 1] = '\0';
+               l++;
+       }
+
+       p = string;
+       while (true) {
+               w = write (fd, p, l);
+               if (w == l)
+                       return TRUE;
+               if (w > 0) {
+                       g_assert (w < l);
+                       p += w;
+                       l -= w;
+                       continue;
+               }
+               if (w == 0) {
+                       errno = EIO;
+                       break;
+               }
+               errsv = errno;
+               if (errsv == EINTR)
+                       continue;
+               break;
+       }
+       g_set_error (error, NMV_EDITOR_PLUGIN_ERROR, NMV_EDITOR_PLUGIN_ERROR,
+                    _("Error writing config: %s"), g_strerror (errsv));
+       return FALSE;
+}
 
 gboolean
 nm_libreswan_config_write (gint fd,
diff --git a/shared/utils.h b/shared/utils.h
index 6181218..768a74a 100644
--- a/shared/utils.h
+++ b/shared/utils.h
@@ -24,63 +24,15 @@
 #ifndef __UTILS_H__
 #define __UTILS_H__
 
-#include <errno.h>
-
 typedef void (*NMDebugWriteFcn) (const char *setting);
 
 __attribute__((__format__ (__printf__, 5, 6)))
-static inline gboolean
-write_config_option_newline (int fd, gboolean new_line, NMDebugWriteFcn debug_write_fcn, GError **error, 
const char *format, ...)
-{
-       gs_free char *string = NULL;
-       const char *p;
-       va_list args;
-       gsize l;
-       int errsv;
-       gssize w;
-
-       va_start (args, format);
-       string = g_strdup_vprintf (format, args);
-       va_end (args);
-
-       if (debug_write_fcn)
-               debug_write_fcn (string);
-
-       l = strlen (string);
-       if (new_line) {
-               gs_free char *s = string;
-
-               string = g_new (char, l + 1 + 1);
-               memcpy (string, s, l);
-               string[l] = '\n';
-               string[l + 1] = '\0';
-               l++;
-       }
+gboolean write_config_option_newline (int fd,
+                                      gboolean new_line,
+                                      NMDebugWriteFcn debug_write_fcn,
+                                      GError **error,
+                                      const char *format, ...);
 
-       p = string;
-       while (true) {
-               w = write (fd, p, l);
-               if (w == l)
-                       return TRUE;
-               if (w > 0) {
-                       g_assert (w < l);
-                       p += w;
-                       l -= w;
-                       continue;
-               }
-               if (w == 0) {
-                       errno = EIO;
-                       break;
-               }
-               errsv = errno;
-               if (errsv == EINTR)
-                       continue;
-               break;
-       }
-       g_set_error (error, NMV_EDITOR_PLUGIN_ERROR, NMV_EDITOR_PLUGIN_ERROR,
-                    _("Error writing config: %s"), g_strerror (errsv));
-       return FALSE;
-}
 #define write_config_option(fd, debug_write_fcn, error, ...) write_config_option_newline((fd), TRUE, 
debug_write_fcn, error, __VA_ARGS__)
 
 gboolean


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]