Tree wide: Move utilities and libraries to src/utils/.
[collectd.git] / src / daemon / types_list.c
index 8cfddda..9c61040 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "collectd.h"
 
-#include "common.h"
+#include "utils/common/common.h"
 
 #include "configfile.h"
 #include "plugin.h"
@@ -113,7 +113,7 @@ static void parse_line(char *buf) {
   sstrncpy(ds->type, fields[0], sizeof(ds->type));
 
   ds->ds_num = fields_num - 1;
-  ds->ds = (data_source_t *)calloc(ds->ds_num, sizeof(data_source_t));
+  ds->ds = calloc(ds->ds_num, sizeof(*ds->ds));
   if (ds->ds == NULL) {
     sfree(ds);
     return;
@@ -174,11 +174,9 @@ int read_types_list(const char *file) {
 
   fh = fopen(file, "r");
   if (fh == NULL) {
-    char errbuf[1024];
     fprintf(stderr, "Failed to open types database `%s': %s.\n", file,
-            sstrerror(errno, errbuf, sizeof(errbuf)));
-    ERROR("Failed to open types database `%s': %s", file,
-          sstrerror(errno, errbuf, sizeof(errbuf)));
+            STRERRNO);
+    ERROR("Failed to open types database `%s': %s", file, STRERRNO);
     return -1;
   }