Skip to content

libxo-2.0.0

Choose a tag to compare

@philshafer philshafer released this 05 Aug 21:52
· 1758 commits to main since this release

New filter facility

  • A new --libxo option "filter" takes an xpath-like expression and
    filters data based on that expression
  • small xpath expression parser
    • parses the full xpath language (plus my extensions)
    • have a mechanism to report usage of unsupported features, since
      the filtering is a subset of full xpath, allowing more useful errors.
  • small streaming xpath engine, maintains a stack of open
    tags/state/etc to ignore/buffer/emit output
  • implemented in a dynamically loaded library to reduce footprint
  • hooks are only compiled in with --with-filter"
  • new "filter-warn" option gives warnings for runtime filter evaluations
  • predicate functionality with function library

Two new llvm plugins:

  • "validate" does format string validation
  • "precompile" does compile-time pre-parsing of static format strings,
    rewriting xo_emit*() calls into xo_cached_emit*() ones.
  • Add -mllvm -xo-validate-errors-as-warnings option to treat errors as warnings

Support for FreeBSD'S extended errors

  • detect exterr infra
  • use it

Misc other bits:

  • Add "The escape-slash Modifier", so escaping forward slashes in JSON
  • Add LC_ALL=en_US.UTF-8
  • Handle https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=285177 by escaping JSON correctly; add "escape-slash" modifier; fix XML to turn control characters into spaces
  • add "fdr", the "Flight Data Recorder" that records operations for testing the xpath code
  • handle some bugs in "xo --top-wrap" where open/close braces were missing

Code maintenance

  • break the cases in xo_format_value into distinct functions, so simplify an overly long piece of code
  • buffer check off (>=); argc[argv] is unbounded and user-provided and startup cost, so use malloc/free instead
  • delete some #if 0 code
  • deprecate "retain" flag
  • deprecate the XOF_RETAIN_ALL flag
  • don't run off the end of a buffer for busted utf8 data
  • drop pointless optimization for identical gettext strings; fix "const" for xo_gettext_build_format
  • ensure that xo_failure is called when buffers cannot be expanded (xo_check_for_room)
  • fix bug where indirected pointer before checking it was past buffer
  • fix empty array problem for JSON
  • fix pointer-across-realloc bug
  • fix some UBs
  • fix some unhandled errors; break xo_do_format_field into smaller pieces
  • make XO_MAX_FIELDS to limit the number of fields
  • move from wchar_t to our own xo_codepoint_t since the definition of wchar_t (and wint_t) isn't standard/useful
  • rename "whiteboard" operation to "passthru", since it's not a whiteboard at all

Documentations

  • clarify that {t:} (trim) is only for encoding styles
  • document the "fdr" encoder