All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pete Zaitcev <zaitcev@redhat.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: Project Hail List <hail-devel@vger.kernel.org>
Subject: Re: [Patch] libcldc,cldcli: Use humanized error messages
Date: Wed, 26 Aug 2009 20:50:03 -0600	[thread overview]
Message-ID: <20090826205003.79e4b2af@redhat.com> (raw)
In-Reply-To: <4A95EEEA.9000301@garzik.org>

On Wed, 26 Aug 2009 22:26:50 -0400, Jeff Garzik <jeff@garzik.org> wrote:
> On 08/26/2009 10:06 PM, Pete Zaitcev wrote:

> > Signed-off-by: Pete Zaitcev<zaitcev@redhat.com>
> 
> applied a modified version, see attached...  after that short IRC 
> discussion, I think an array with a range check would be nicer than 
> coding it (though the C compiler should make a nice, efficient table 
> from 'switch' statement for us...)

I don't think it's enough. Look:

+static const char *cld_errlist[] =
+{
+	[CLE_OK]		= "Success",
+	[CLE_SESS_EXISTS]	= "Session exists",

When you do indexed initializations, it's possible to create
empty array elements (currently there are none because indexes
are contiguous). So, the following needs a NULL check:

+	return cld_errlist[ecode];
+}

-- Pete

  reply	other threads:[~2009-08-27  2:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-27  2:06 [Patch] libcldc,cldcli: Use humanized error messages Pete Zaitcev
2009-08-27  2:26 ` Jeff Garzik
2009-08-27  2:50   ` Pete Zaitcev [this message]
2009-08-27  3:04     ` Jeff Garzik

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=20090826205003.79e4b2af@redhat.com \
    --to=zaitcev@redhat.com \
    --cc=hail-devel@vger.kernel.org \
    --cc=jeff@garzik.org \
    /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.
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.