[vlc-devel] [DISCUSSION] To use or not to use EMPTY_STR?

Filip Roséen filip at atch.se
Fri Aug 5 15:01:56 CEST 2016

Hi Remi,

On 16/08/05 14:53, Rémi Denis-Courmont wrote:

> Le 2016-08-05 14:20, Filip Roséen a écrit :
> >
> >#define EMPTY_STR(str) (!str || !*str)
> >
> In many (but not all) sites, it is cargo cult. Either the string pointer
> cannot NULL, or the string cannot be empty.
> I am not aware of a project-wide position.

I would be happy to write up some guidelines regarding similar issues and
create a page on the wiki and/or in the documentation, but given that I
have not been around long enough (compared to others with more experience
working on the codebase) it might be unwise for me to be the author of such

> The macro lacks expansion safety, in several ways. And its name is confusingly wrong: A
> NULL string pointer is not a string, and thus not an empty string. The distinction
> sometimes does matter.

I agree on all points raised above, which leads to follow-up questions:

  - would it be appropriate to completely deprecate the macro (and replace
    usage of such), or;
  - should we fix it in a way that could make the intention more clear, or;
  - let it be and intentionally look the other way when such is used/not

> Therefore, I dislike it and avoid it.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20160805/7d0e39df/attachment.html>

More information about the vlc-devel mailing list