Hi Denis,
On 17/06/2019 22.42, Denis Kenzior wrote:
>>> +LIB_EXPORT char *l_gpio_chip_get_line_label(struct
l_gpio_chip *chip,
>>> + uint32_t offset)
>>
>> Is there a particular reason to return char * here? Why not const
>> char * and have the caller l_strdup as needed?
>
> The info object is allocated on the stack, so we cannot return the
> .name member to the caller.
>
Sure, but there's no reason why we couldn't make info a static function
scope variable. Or use a different static char buffer. Bet you'll be
the first one that wishes you didn't need to free the label :)
I briefly considered caching the labels in a hashmap in struct
l_gpiochip, but I deemed it too clumsy :)
// Martin