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

feat: Implement support for multiple 'H' ranges in one field #3

Merged
merged 14 commits into from
Oct 22, 2024

Commits on Oct 21, 2024

  1. Implement support for multiple 'H' ranges in one field

    If no range is specified, they will return the same number.
    But if different ranges (optionally with different offsets) are specified, different numbers should be returned due to the different modulo and/or offsets of the ranges.
    Thus, multiple 'H' with ranges in one field should be allowed for convenience.
    Kniggebrot committed Oct 21, 2024
    Configuration menu
    Copy the full SHA
    7ec2355 View commit details
    Browse the repository at this point in the history
  2. Move asserts to each test case

    Easier to see which test failed
    Kniggebrot committed Oct 21, 2024
    Configuration menu
    Copy the full SHA
    97bbc25 View commit details
    Browse the repository at this point in the history
  3. CMake: Test Malloc as well

    Kniggebrot committed Oct 21, 2024
    Configuration menu
    Copy the full SHA
    8a605c3 View commit details
    Browse the repository at this point in the history
  4. Add util to append multiple strings together

    Useful for putting the parsed H fields back together
    Kniggebrot committed Oct 21, 2024
    Configuration menu
    Copy the full SHA
    76e59e2 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    eb0687b View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    14bc349 View commit details
    Browse the repository at this point in the history
  7. Last state str_append

    Kniggebrot committed Oct 21, 2024
    Configuration menu
    Copy the full SHA
    c519bd9 View commit details
    Browse the repository at this point in the history
  8. Fix replacement of 'H' in lists

    The issue was the missed `free()` of the result fields being merged into the final field.
    As the original subfields are already freed in `replace_hashed()`, this should now happen in the final free for the list subfields.
    Also removed the `str_append()` utility, as allocating one big string and filling it with the single results (via sprintf) may take more runtime (for looping twice), but simplifies memory management and improves readability.
    Kniggebrot committed Oct 21, 2024
    Configuration menu
    Copy the full SHA
    a924bd8 View commit details
    Browse the repository at this point in the history
  9. Simplify H replacement further, avoid extra res_arr

    Contents are identical to subfields. Can simply use it instead
    Kniggebrot committed Oct 21, 2024
    Configuration menu
    Copy the full SHA
    7cabf1e View commit details
    Browse the repository at this point in the history

Commits on Oct 22, 2024

  1. Use strcpy instead of rewriting the whole field for 'H' replacement

    It requires tracking of the substring lens, but it should be more efficient with shorter writes.
    Kniggebrot committed Oct 22, 2024
    Configuration menu
    Copy the full SHA
    14c4ef1 View commit details
    Browse the repository at this point in the history
  2. Add more tests for 'H' in lists

    Regarding parsability, combinability with other options
    Kniggebrot committed Oct 22, 2024
    Configuration menu
    Copy the full SHA
    3989f92 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    f01bb90 View commit details
    Browse the repository at this point in the history
  4. fix: concat regular fields mixed with 'W' fields properly

    Add commas when needed. Also use strcpy and a tracking pointer to make copying more efficient
    Kniggebrot committed Oct 22, 2024
    Configuration menu
    Copy the full SHA
    ad5be5d View commit details
    Browse the repository at this point in the history
  5. Make errors in H replacement more resilient

    Free the accum_field and subfields always if an error occurs during field replacement (in a list) and they were malloced
    Kniggebrot committed Oct 22, 2024
    Configuration menu
    Copy the full SHA
    3ccbfcf View commit details
    Browse the repository at this point in the history