• M
    virobject: Introduce VIR_CLASS_NEW() macro · 10f94828
    Michal Privoznik 提交于
    So far we are repeating the following lines over and over:
    
      if (!(virSomeObjectClass = virClassNew(virClassForObject(),
                                 "virSomeObject",
                                 sizeof(virSomeObject),
                                 virSomeObjectDispose)))
          return -1;
    
    While this works, it is impossible to do some checking. Firstly,
    the class name (the 2nd argument) doesn't match the name in the
    code in all cases (the 3rd argument). Secondly, the current style
    is needlessly verbose. This commit turns example into following:
    
      if (!(VIR_CLASS_NEW(virSomeObject,
                          virClassForObject)))
          return -1;
    Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
    Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
    10f94828
vbox_common.c 268.0 KB