Code

core: Changed internal API to allow for per-plugin intervals.
[collectd.git] / src / match_hashed.c
index 062a7a7299be36816d6eb64c1773378f9f9842ad..6cb2c5a161057123838b2bfb1189ca55e1f208e1 100644 (file)
@@ -158,8 +158,8 @@ static int mh_match (const data_set_t __attribute__((unused)) *ds, /* {{{ */
 
   for (host_ptr = vl->host; *host_ptr != 0; host_ptr++)
   {
-    /* 251 is the largest prime smaller than 256. */
-    hash_val = (hash_val * 251) + ((uint32_t) *host_ptr);
+    /* 2184401929 is some appropriately sized prime number. */
+    hash_val = (hash_val * UINT32_C (2184401929)) + ((uint32_t) *host_ptr);
   }
   DEBUG ("hashed match: host = %s; hash_val = %"PRIu32";", vl->host, hash_val);
 
@@ -170,10 +170,12 @@ static int mh_match (const data_set_t __attribute__((unused)) *ds, /* {{{ */
   return (FC_MATCH_NO_MATCH);
 } /* }}} int mh_match */
 
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
 {
   match_proc_t mproc;
 
+  PLUGIN_INIT_INTERVAL (data);
+
   memset (&mproc, 0, sizeof (mproc));
   mproc.create  = mh_create;
   mproc.destroy = mh_destroy;