treewide: use designated initializers for ai_hints
[collectd.git] / src / ted.c
index e76b3c9..282212b 100644 (file)
--- a/src/ted.c
+++ b/src/ted.c
@@ -70,11 +70,15 @@ static int ted_read_value(double *ret_power, double *ret_voltage)
 {
     unsigned char receive_buffer[300];
     unsigned char package_buffer[300];
-    char pkt_request[1] = {0xAA};
+    unsigned char pkt_request[1] = {0xAA};
     int package_buffer_pos;
 
     fd_set input;
-    struct timeval timeout;
+
+    /* Initialize timeout structure, set to 2 seconds */
+    struct timeval timeout = {
+      .tv_sec = 2
+    };
 
     int end_flag;
     int escape_flag;
@@ -87,11 +91,6 @@ static int ted_read_value(double *ret_power, double *ret_voltage)
     FD_ZERO (&input);
     FD_SET (fd, &input);
 
-    /* Initialize timeout structure, set to 2 seconds */
-    memset (&timeout, 0, sizeof (timeout));
-    timeout.tv_sec = 2;
-    timeout.tv_usec = 0;
-
     /* clear out anything in the buffer */
     tcflush (fd, TCIFLUSH);
 
@@ -263,7 +262,7 @@ static int ted_open_device (void)
     return (0);
 } /* int ted_open_device */
 
-static void ted_submit (char *type, double value)
+static void ted_submit (const char *type, double value)
 {
     value_t values[1];
     value_list_t vl = VALUE_LIST_INIT;