[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master b944e88 5/7: emacsclient.c: use C99 better

From: Paul Eggert
Subject: Re: master b944e88 5/7: emacsclient.c: use C99 better
Date: Tue, 20 Nov 2018 18:29:27 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0

On 11/20/18 3:19 AM, Robert Pluim wrote:
- size_t dlen;
-  if (!data)
-    return;
-  dlen = strlen (data);
I convinced myself that data could never be NULL here, but perhaps a
comment to that effect? (or restore the NULL check).

Any such check should be a compile-time check, by declaring the containing function with the ARG_NONNULL () attribute. But why stop there? ARG_NONNULL () could be applied to every function in emacsclient.c.

For Emacs, ARG_NONNULL () is typically overkill, as it doesn't help the user or the compiler enough to be worth the overhead of using it. In this particular case we have a static function that calls strlen on its argument so it is obviously expecting the argument to be a nonnull pointer and ARG_NONNULL () isn't needed. That being said, a comment might not hurt, and I'll look into doing that in my next revision (I'm currently looking into fixing some problems with emacsclient.c anyway....).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]