summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cbbb31b)
raw | patch | inline | side by side (parent: cbbb31b)
author | Sebastian Harl <sh@tokkee.org> | |
Wed, 14 Nov 2012 18:05:10 +0000 (19:05 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Wed, 14 Nov 2012 18:05:10 +0000 (19:05 +0100) |
Don't pass any pointers to interval_g around just in order to later
dereference them. There's just no reason to do so ;-)
dereference them. There's just no reason to do so ;-)
src/perl.c | patch | blob | history |
diff --git a/src/perl.c b/src/perl.c
index e5dc6c7563437c18134aab5fc4dd1c557a51ae36..924cb63fe195d018517f4c361f5b10ed848c5996 100644 (file)
--- a/src/perl.c
+++ b/src/perl.c
static int g_interval_get (pTHX_ SV *var, MAGIC *mg)
{
- cdtime_t *interval = (cdtime_t *)mg->mg_ptr;
- double nv;
-
- nv = CDTIME_T_TO_DOUBLE (*interval);
-
- sv_setnv (var, nv);
+ sv_setnv (var, CDTIME_T_TO_DOUBLE (interval_g));
return 0;
} /* static int g_interval_get (pTHX_ SV *, MAGIC *) */
static int g_interval_set (pTHX_ SV *var, MAGIC *mg)
{
- cdtime_t *interval = (cdtime_t *)mg->mg_ptr;
- double nv;
-
- nv = (double)SvNV (var);
-
- *interval = DOUBLE_TO_CDTIME_T (nv);
+ double nv = (double)SvNV (var);
+ interval_g = DOUBLE_TO_CDTIME_T (nv);
return 0;
} /* static int g_interval_set (pTHX_ SV *, MAGIC *) */
tmp = get_sv ("Collectd::interval_g", /* create = */ 1);
sv_magicext (tmp, NULL, /* how = */ PERL_MAGIC_ext,
/* vtbl = */ &g_interval_vtbl,
- /* name = */ (char *) &interval_g, /* namelen = */ 0);
+ /* name = */ NULL, /* namelen = */ 0);
return;
} /* static void xs_init (pTHX) */