Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed expanding runtime variables #241

Merged
merged 2 commits into from
Sep 24, 2020
Merged

Fixed expanding runtime variables #241

merged 2 commits into from
Sep 24, 2020

Commits on Sep 22, 2020

  1. Fixed expanding variables at runtime

    Expanding variables at runtime (that have not
    been registered before), for example in
    "ucl_parser_set_variables_handler" function,
    always expanded to an empty string though
    "replace" and "replace_len" were set properly.
    
    Example config:
    {
        foo = Hello World!;
        bar = ${foo};
    }
    
    Shortened unknown variable handler code:
    [...]
    
    root = ucl_parser_get_object(parser);
    var = ucl_object_lookup_path(root, path);
    *replace = (unsigned char*)var->value.sv;
    *replace_len = var->len;
    *need_free = false;
    return true;
    
    [...]
    
    In the above handler code "path" is "foo" but could
    be any dot notation path to an already existing
    object.
    
    UCL emitter always output:
    {
        foo = "Hello World!";
        bar = "";
    }
    
    Forwarding announced replaced data len from handler to
    "ucl_check_variable_safe" fixed the issue.
    PunishedSnakePr committed Sep 22, 2020
    Configuration menu
    Copy the full SHA
    826faf7 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    258df12 View commit details
    Browse the repository at this point in the history