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

clean up genalloc implementation #128

Merged
merged 8 commits into from May 19, 2020
Merged

clean up genalloc implementation #128

merged 8 commits into from May 19, 2020

Commits on May 18, 2020

  1. genalloc: reorder functions in header

    This only moves the code blocks, but does not change any code at all.
    DerDakon committed May 18, 2020
    Copy the full SHA
    9175e79 View commit details
    Browse the repository at this point in the history
  2. genalloc: reorder callers

    Make sure calls to GEN_ALLOC_ready always follow GEN_ALLOC_readyplus.
    DerDakon committed May 18, 2020
    Copy the full SHA
    721a288 View commit details
    Browse the repository at this point in the history
  3. genalloc: unify GEN_ALLOC_readyplus and GEN_ALLOC_ready internals

    Introduce an internal static helper function that does the common parts, which
    both functions can use.
    DerDakon committed May 18, 2020
    Copy the full SHA
    20c4811 View commit details
    Browse the repository at this point in the history
  4. genalloc: generate C89 function interfaces

    While at it drop the register specification.
    DerDakon committed May 18, 2020
    Copy the full SHA
    5806288 View commit details
    Browse the repository at this point in the history
  5. genalloc: do not rename parameter names

    The names of the function parameters as well as the name of the local variable
    were taken from the macro arguments. Noone passed anything different than the
    default names there, and doing so doesn't make any sense anyway.
    DerDakon committed May 18, 2020
    Copy the full SHA
    a41404c View commit details
    Browse the repository at this point in the history

Commits on May 19, 2020

  1. genalloc: invert code flow

    Save the new length in a local variable, and only change the value in the struct
    if allocation succeeds instead of changing it back on failure.
    DerDakon committed May 19, 2020
    Copy the full SHA
    8b68e39 View commit details
    Browse the repository at this point in the history
  2. genalloc: unfold tail code

    This was doing 2 assignments, a function call and a return on the same line.
    This had the additional slight bug that if the allocation failed it returned 0,
    but the allocation length in the struct passed in was already changed to the new
    value. This would not do any harm on subsequent calls as the pointer was still
    NULL and only that is checked.
    DerDakon committed May 19, 2020
    Copy the full SHA
    8fd5473 View commit details
    Browse the repository at this point in the history
  3. include alloc.h in gen_allocdefs.h

    alloc() is used in the generated code, so directly include it in this header
    instead of all the callers.
    DerDakon committed May 19, 2020
    Copy the full SHA
    edf54c8 View commit details
    Browse the repository at this point in the history