g_value_set_instance -- how to use?



There is very little documentation that I can find explaining how
g_value_set_instance is supposed to work. Is the following anywhere near
correct?

    void my_gvalue_setter( const GValue *gv,
                         gpointer      val,
                         Gtype         type)
     {
          g_value_unset(gv);
          g_value_init(gv, type);
          g_value_set_instance(gv,  val);
     }

Then provided val is a pointer to a quantity of type type, it's equivalent
to using the specific setting routine or am I barking up quite the wrong
tree?



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]