Unified string handling.
[collectd.git] / src / ascent.c
index 94691d6..6b4f21f 100644 (file)
@@ -130,10 +130,12 @@ static int ascent_submit_gauge (const char *plugin_instance, /* {{{ */
     sstrncpy (vl.plugin_instance, plugin_instance,
         sizeof (vl.plugin_instance));
 
+  sstrncpy (vl.type, type, sizeof (vl.type));
+
   if (type_instance != NULL)
     sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
 
-  plugin_dispatch_values (type, &vl);
+  plugin_dispatch_values (&vl);
   return (0);
 } /* }}} int ascent_submit_gauge */
 
@@ -534,7 +536,7 @@ static int ascent_init (void) /* {{{ */
   {
     int status;
 
-    status = snprintf (credentials, sizeof (credentials), "%s:%s",
+    status = ssnprintf (credentials, sizeof (credentials), "%s:%s",
         user, (pass == NULL) ? "" : pass);
     if (status >= sizeof (credentials))
     {
@@ -542,7 +544,6 @@ static int ascent_init (void) /* {{{ */
           "credentials have been truncated.");
       return (-1);
     }
-    credentials[sizeof (credentials) - 1] = '\0';
 
     curl_easy_setopt (curl, CURLOPT_USERPWD, credentials);
   }