basic: nulstr-util: add nulstr_get() returning the matching string
authorArnaud Ferraris <arnaud.ferraris@collabora.com>
Tue, 14 Sep 2021 14:20:20 +0000 (16:20 +0200)
committerArnaud Ferraris <arnaud.ferraris@collabora.com>
Wed, 15 Sep 2021 14:45:58 +0000 (16:45 +0200)
commit533f11c5292ff68aaaaf08cff3570140bb6d1f1b
tree2498ebbf450188b38688c8a824fa0fa12fb84d07
parent76ab98fa2b221576c81d13c69cfe4cad5bcd23e4
basic: nulstr-util: add nulstr_get() returning the matching string

Currently `nulstr_contains` returns a boolean, making it difficult to
identify which of the input strings matches the "needle".

Adding a new `nulstr_get()` function, returning a const pointer to the
matching string, eases this process and allows us to directly re-use the
result of a call to this function without additional processing or
memory allocation.

Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
src/basic/nulstr-util.c
src/basic/nulstr-util.h