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

Expose non-nullable elements from slices of pointers #2200

Merged
merged 1 commit into from
Dec 1, 2020

Commits on Dec 1, 2020

  1. Expose non-nullable elements from slices of pointers

    Currently for slices of pointers, pdata exposes elements that are pointers to the pointer in the slice (double pointers in the internal implementation). Because of this users have to deal with possible nil values, have to initialize elements (in some cases) etc, but in reality the elements in the slice cannot be nil, so this just adds extra unnecessary complexity. This is possible because:
    
    * Gogo proto (and protobuf) will not unmarshal any nil element in a slice;
    * Our APIs to add elements/remove elements from the slice will guarantee that we never have a nil element in the slice between [0, len-1];
    
    This is an important change because will allow us to change the internal representation (use slice of pointers or non-pointers) without affecting the public API.
    
    Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
    bogdandrutu committed Dec 1, 2020
    Configuration menu
    Copy the full SHA
    4eeb597 View commit details
    Browse the repository at this point in the history