Skip to content

create nm_strvarray_get_idxnull_or_greturn macro, use in libnm api

Jan Vaclav requested to merge jvaclav/NetworkManager:jv/strv-checked into main

Summary

This merge request creates the nm_strvarray_get_idxnull_or_greturn macro which should be used for strv properties, and uses it in the various libnm API functions for strv properties. It will also be used in nm_setting_wireless_* in a later merge request.

Purpose

As mentioned here: !1741 (comment 2112607) it would be good to have a helper function/macro for getting elements out of "standard" strv properties, which codifies how the getter should behave (returning NULL at idx == len, failing assert if out of bounds)

Checklist

Please read https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/main/CONTRIBUTING.md before opening the merge request. In particular, check that:

  • the subject for all commits is concise and explicative
  • the message for all commits explains the reason for the change
  • the source is properly formatted
  • any relevant documentation is up to date
  • you have added unit tests if applicable
Edited by Jan Vaclav

Merge request reports