* Re: master b944e88 5/7: emacsclient.c: use C99 better
[not found] ` <20181119193828.D38F420CF3@vcs0.savannah.gnu.org>
@ 2018-11-20 11:19 ` Robert Pluim
2018-11-21 2:29 ` Paul Eggert
0 siblings, 1 reply; 2+ messages in thread
From: Robert Pluim @ 2018-11-20 11:19 UTC (permalink / raw)
To: emacs-devel; +Cc: Paul Eggert
eggert@cs.ucla.edu (Paul Eggert) writes:
>
> - 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).
Robert
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: master b944e88 5/7: emacsclient.c: use C99 better
2018-11-20 11:19 ` master b944e88 5/7: emacsclient.c: use C99 better Robert Pluim
@ 2018-11-21 2:29 ` Paul Eggert
0 siblings, 0 replies; 2+ messages in thread
From: Paul Eggert @ 2018-11-21 2:29 UTC (permalink / raw)
To: Robert Pluim, emacs-devel
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....).
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-11-21 2:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20181119193826.11810.69647@vcs0.savannah.gnu.org>
[not found] ` <20181119193828.D38F420CF3@vcs0.savannah.gnu.org>
2018-11-20 11:19 ` master b944e88 5/7: emacsclient.c: use C99 better Robert Pluim
2018-11-21 2:29 ` Paul Eggert
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.