Skip to content
  • Ian Campbell's avatar
    libxl: idl: always initialise the KeyedEnum keyvar in the member init function · 6d5317a5
    Ian Campbell authored
    
    
    Previously we only initialised it if an explicit keyvar_init_val was
    given but not if the default was implicitly 0.
    
    In the generated code this only changes the unused libxl_event_init_type
    function:
    
     void libxl_event_init_type(libxl_event *p, libxl_event_type type)
     {
    +    assert(!p->type);
    +    p->type = type;
         switch (p->type) {
         case LIBXL_EVENT_TYPE_DOMAIN_SHUTDOWN:
             break;
    
    However I think it is wrong that this function is unused, this and
    libxl_event_init should be used by libxl__event_new. As it happens
    both are just memset to zero but for correctness we should use the
    init functions (in case the IDL changes).
    
    In the generator we also need to properly handle init_var == 0 which
    the current if statements incorrectly treat as False. This doesn't
    actually have any impact on the generated code.
    
    Signed-off-by: default avatarIan Campbell <ian.campbell@citrix.com>
    Acked-by: default avatarIan Jackson <ian.jackson@eu.citrix.com>
    Committed-by: default avatarIan Campbell <ian.campbell@citrix.com>
    6d5317a5