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

A new attempt at location information for decoded JSON elements #662

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Commits on Sep 28, 2023

  1. test: Update .gitignore

    This was missed when introducing the new fixed size test.
    
    Fixes: ca6775d ("introduce new fixed-size key API")
    Signed-off-by: Phil Sutter <[email protected]>
    SirPhuttel committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    c882db1 View commit details
    Browse the repository at this point in the history
  2. test: util: Introduce fail_args()

    This macro is very similar to fail() but supports variable number of
    arguments to print format strings.
    
    Signed-off-by: Phil Sutter <[email protected]>
    SirPhuttel committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    c3628e1 View commit details
    Browse the repository at this point in the history
  3. Introduce JSON_STORE_LOCATION decoder flag

    This will turn on recording of parsed JSON elements in input.
    
    Signed-off-by: Phil Sutter <[email protected]>
    SirPhuttel committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    15218cc View commit details
    Browse the repository at this point in the history
  4. Introduce refcounted simple values

    When storing object location, the singleton true, false and null objects
    are problematic since they are indistinguishable from each other.
    Overcome this by introducing a refcounted variant to allocate when
    JSON_STORE_LOCATION flag was given.
    
    Signed-off-by: Phil Sutter <[email protected]>
    SirPhuttel committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    9535972 View commit details
    Browse the repository at this point in the history

Commits on Oct 13, 2023

  1. Add location information to decoded JSON objects

    Aid users in printing semantic errors in JSON input by providing them
    with location data for each parsed JSON element. An example usage of
    such data is demonstrated by nftables' error messages:
    
    | # nft add chain mytable mychain
    | Error: No such file or directory
    | add chain mytable mychain
    |           ^^^^^^^
    
    To reduce overhead for library users not interested in such data, store
    it only if `JSON_STORE_LOCATION' flag was passed to json_load*()
    functions. It may then be retrieved using the new API function
    json_get_location().
    
    Signed-off-by: Phil Sutter <[email protected]>
    SirPhuttel committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    60fa2a7 View commit details
    Browse the repository at this point in the history