Thread

  1. Re: System views for versions reporting

    Laurenz Albe <laurenz.albe@cybertec.at> — 2025-11-26T13:28:06Z

    On Tue, 2025-11-25 at 16:40 +0100, Dmitry Dolgov wrote:
    > Here is the updated patch.
    
    Thanks for the updated patch.
    
    Comments:
    
    You didn't address any of my suggestions concerning the documentation,
    except that you moved the entry in "System Views" to the correct place.
    
    The second patch contains:
    
    > +void
    > +jit_register_version(void)
    > +{
    > +   add_system_version("LLVM", jit_get_version, RunTime);
    > +}
    
    But that belongs into the third patch.
    
    +/*
    + * Callback for add_system_version, returns JIT provider's version string and
    + * reports if it's not available.
    + */
    +const char *
    +jit_get_version(bool *available)
    +{
    +   const char *version;
    +
    +   if (!provider_init())
    +   {
    +       *available = false;
    +       return "";
    +   }
    +
    +   version = provider.get_version();
    +
    +   if (version == NULL)
    +   {
    +       *available = false;
    +       return "";
    +   }
    +
    +   *available = true;
    +   return version;
    +}
    
    Perhaps more elegant would be:
    
        if (provider_init())
        {
            version = provider.get_version();
            if (version)
            {
                *available = true;
                return version;
            }
        }
    
        *available = false;
        return "";
    
    Other than that, it looks fine.
    
    Yours,
    Laurenz Albe