c->pred = NULL;
c->resid = NULL;
+ c->refcnt = 1;
return c;
}
-bool
-linreg_free (void *m)
+void
+linreg_ref (linreg *c)
+{
+ c->refcnt++;
+}
+
+void
+linreg_unref (linreg *c)
{
- linreg *c = m;
- if (c != NULL)
+ if (c && --c->refcnt == 0)
{
gsl_vector_free (c->indep_means);
gsl_vector_free (c->indep_std);
free (c->coeff);
free (c);
}
- return true;
}
static void