From e08854f4f25313b4f7c2fb40569add43d9ea8349 Mon Sep 17 00:00:00 2001 From: Jan-Oliver Wagner Date: Sun, 23 Jun 2019 11:24:29 +0200 Subject: [PATCH 1/2] Remove unused functions for otp. The function send_printf() is not used anymore as it was used only for OTP. Also auth_send can be removed because it was only used by send_printf(). --- src/utils.c | 48 ------------------------------------------------ src/utils.h | 3 --- 2 files changed, 51 deletions(-) diff --git a/src/utils.c b/src/utils.c index 2c842f3e5..f15c997a4 100644 --- a/src/utils.c +++ b/src/utils.c @@ -168,51 +168,3 @@ is_scanner_only_pref (const char *pref) return 1; return 0; } - -/** - * @brief Writes data to a socket. - */ -static void -auth_send (int soc, char *data) -{ - unsigned int sent = 0; - gsize length; - - if (soc < 0) - return; - - /* Convert to UTF-8 before sending to Manager. */ - data = g_convert (data, -1, "UTF-8", "ISO_8859-1", NULL, &length, NULL); - while (sent < length) - { - int n = nsend (soc, data + sent, length - sent, 0); - if (n < 0) - { - if ((errno != ENOMEM) && (errno != ENOBUFS)) - { - g_free (data); - return; - } - } - else - sent += n; - } - g_free (data); -} - -/** - * @brief Writes data to a socket. - */ -void -send_printf (int soc, char *data, ...) -{ - va_list param; - char *buffer; - - va_start (param, data); - buffer = g_strdup_vprintf (data, param); - va_end (param); - - auth_send (soc, buffer); - g_free (buffer); -} diff --git a/src/utils.h b/src/utils.h index 54238b3b5..7ff3daa0f 100644 --- a/src/utils.h +++ b/src/utils.h @@ -45,7 +45,4 @@ wait_for_children1 (void); int is_scanner_only_pref (const char *); -void -send_printf (int, char *, ...) __attribute__ ((format (printf, 2, 3))); - #endif From 44621e338fcc3e97f4cc40622c3eead127b904ee Mon Sep 17 00:00:00 2001 From: Jan-Oliver Wagner Date: Sun, 23 Jun 2019 11:34:10 +0200 Subject: [PATCH 2/2] Remove unneeded includes. --- src/utils.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/utils.c b/src/utils.c index f15c997a4..e78f676d4 100644 --- a/src/utils.c +++ b/src/utils.c @@ -23,17 +23,11 @@ * @brief A bunch of miscellaneous functions, mostly file conversions. */ -#include "utils.h" - -#include "../misc/network.h" /* for stream_zero */ -#include "pluginscheduler.h" - #include /* for errno() */ #include /* for prefs_get() */ #include /* for atoi() */ -#include /* for strchr() */ +#include /* for strcmp() */ #include /* for ioctl() */ -#include /* for stat() */ #include /* for waitpid() */ extern int global_max_hosts;