From: Nathan Lynch <ntl@pobox.com>
To: Dan Smith <danms@us.ibm.com>
Cc: containers@lists.osdl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] c/r: Add CR_COPY() macro (v3)
Date: Wed, 4 Mar 2009 14:01:29 -0600 [thread overview]
Message-ID: <20090304140129.35e1ad97@thinkcentre.lan> (raw)
In-Reply-To: <1236095764-19325-3-git-send-email-danms@us.ibm.com>
Hi Dan.
Dan Smith <danms@us.ibm.com> wrote:
> +#define CR_CPT 1
> +#define CR_RST 2
> +
> +#define CR_COPY(op, a, b) \
> + do { \
> + if (op == CR_CPT) \
> + a = b; \
> + else \
> + b = a; \
> + } while (0);
Drop the semicolon ^
> +
> +#define CR_COPY_ARRAY(op, a, b, count) \
> + do { \
> + BUILD_BUG_ON(sizeof(*a) != sizeof(*b)); \
> + if (op == CR_CPT) \
> + memcpy(a, b, count * sizeof(*a)); \
> + else \
> + memcpy(b, a, count * sizeof(*a)); \
> + } while (0);
> +
You might want to employ __must_be_array() or similar to catch misuse.
Misuse might also be prevented by providing some documentation :)
next prev parent reply other threads:[~2009-03-04 20:01 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-03 15:56 [PATCH 0/3] c/r: Add s390 support Dan Smith
2009-03-03 15:56 ` [PATCH 1/3] s390: Expose a constant for the number of words representing the CRs Dan Smith
2009-03-03 16:08 ` Dave Hansen
2009-03-04 0:56 ` Dan Smith
2009-03-04 0:59 ` Dave Hansen
2009-03-03 15:56 ` [PATCH 2/3] c/r: Add CR_COPY() macro (v3) Dan Smith
2009-03-03 16:22 ` Dave Hansen
2009-03-04 0:57 ` Dan Smith
2009-03-04 1:00 ` Dave Hansen
2009-03-04 15:05 ` Serge E. Hallyn
2009-03-18 7:51 ` Oren Laadan
2009-03-18 13:43 ` Serge E. Hallyn
2009-03-04 19:53 ` Nathan Lynch
2009-03-04 20:18 ` Dave Hansen
2009-03-04 20:01 ` Nathan Lynch [this message]
2009-03-04 20:18 ` Dan Smith
2009-03-03 15:56 ` [PATCH 3/3] c/r: define s390-specific checkpoint-restart code (v7) Dan Smith
2009-03-03 22:40 ` Serge E. Hallyn
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=20090304140129.35e1ad97@thinkcentre.lan \
--to=ntl@pobox.com \
--cc=containers@lists.osdl.org \
--cc=danms@us.ibm.com \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox