all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Robert Pluim <rpluim@gmail.com>, emacs-devel@gnu.org
Subject: Re: master b944e88 5/7: emacsclient.c: use C99 better
Date: Tue, 20 Nov 2018 18:29:27 -0800	[thread overview]
Message-ID: <c029467a-5ef6-fe78-b129-3d3cd7d92b8f@cs.ucla.edu> (raw)
In-Reply-To: <m2a7m40zf4.fsf@gmail.com>

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	other threads:[~2018-11-21  2:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c029467a-5ef6-fe78-b129-3d3cd7d92b8f@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=rpluim@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.