• P
    util: typedparam: Simplify handling of lists of typed parameters · 33773355
    Peter Krempa 提交于
    Introduce a new set of helpers including a new data structure which
    simplifies keeping and construction of lists of typed parameters.
    
    The use of VIR_RESIZE_N in the virTypedParamsAdd API has performance
    benefits but requires passing around 3 arguments. Use of them lead to a
    set of macros with embedded jumps used in the qemu statistics code.
    
    This patch introduces 'virTypedParamList' type which aggregates the
    necessary list-keeping variables and also a new set of functions to add
    new typed parameters to a list.
    
    These new helpers use printf-like format string and arguments to format
    the argument name as the stats code often uses indexed typed parameters.
    
    The accessor function then allows extracting the typed parameter list in
    the same format as virTypedParamsAdd* functions would do.
    
    One additional benefit is also that the list function can easily be used
    with VIR_AUTOPTR.
    Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
    Reviewed-by: NJán Tomko <jtomko@redhat.com>
    33773355
virtypedparam.h 6.4 KB