• Nils Goroll's avatar
    make vmod_std conversions more flexible · 5a1a9b08
    Nils Goroll authored
    In order to avoid the cross product problem with conversion functions
    (from x to y types would require x*y functions), we add flexibility
    regarding the input parameters to conversion functions:
    
    Each convertion function named after the destination type now takes all
    sensible arguments by name.
    
    int is named integer because of the reserved symbol name "int" in C.
    
    All functions should be fully backwards compatible (existing vtcs
    continue to work), but compile time checks are now effectively removed.
    The conversion functions now trigger vcl errors if used incorrectly or
    if conversion errors occur and no failback is provided. However, if a
    failback is provided, vcl errors are only raised for usage errors.
    
    For consistency, the conversion functions now only ever truncate if
    necessary. std.round() is added for explicit rounding where required.
    
    Existing functions which are now obsolete are marked deprecated.
    
    Ref #2899
    Ref https://github.com/varnishcache/varnish-cache/wiki/VIP12:-vmod-polymorphism-(for-type-conversions)
    5a1a9b08
m00020.vtc 4.17 KB