DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH 01/11] ip_pipeline: add parsing for config files with new syntax
Date: Mon, 1 Jun 2015 06:34:12 -0700	[thread overview]
Message-ID: <20150601063412.5805c879@urahara> (raw)
In-Reply-To: <1432914198-11812-2-git-send-email-maciejx.t.gajdzica@intel.com>

On Fri, 29 May 2015 17:43:08 +0200
Maciej Gajdzica <maciejx.t.gajdzica@intel.com> wrote:

> +/**
> + * Find object of name *name* in *obj_array* which is constant size array of
> + * elements that have field *name*.
> + *
> + * @param obj_array
> + *  Constant size array
> + * @param name
> + *  name of object to find.
> + * @return
> + *  Pointer to object in *obj_array* or NULL if not found.
> + */
> +#define APP_PARAM_FIND(obj_array, key)                          \
> +({                                                              \
> +	ssize_t obj_idx;                                            \
> +	const ssize_t obj_count = RTE_DIM(obj_array);               \
> +                                                                \
> +	for (obj_idx = 0; obj_idx < obj_count; obj_idx++) {         \
> +		if (!APP_PARAM_VALID(&((obj_array)[obj_idx])))          \
> +			continue;                                           \
> +			                                                    \
> +		if (strcmp(key, (obj_array)[obj_idx].name) == 0)        \
> +			break;                                              \
> +	}                                                           \
> +	obj_idx < obj_count ? obj_idx : -ENOENT;                    \
> +})

Converting all the functions to macro's is a step backwards in several ways.
 * macro's are hard to support
 * macro's lead to lots of programming errors
 * macro's look ugly

Why not use real functions, or make the example into C++ if you have
to do generic programming.

  reply	other threads:[~2015-06-01 13:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-29 15:43 [dpdk-dev] [PATCH 00/11] ip_pipeline: ip_pipeline application enhancements Maciej Gajdzica
2015-05-29 15:43 ` [dpdk-dev] [PATCH 01/11] ip_pipeline: add parsing for config files with new syntax Maciej Gajdzica
2015-06-01 13:34   ` Stephen Hemminger [this message]
2015-06-04 17:29     ` Dumitrescu, Cristian
2015-05-29 15:43 ` [dpdk-dev] [PATCH 02/11] ip_pipeline: added config checks Maciej Gajdzica
2015-05-29 15:43 ` [dpdk-dev] [PATCH 03/11] ip_pipeline: modified init to match new params struct Maciej Gajdzica
2015-05-29 15:43 ` [dpdk-dev] [PATCH 04/11] ip_pipeline: moved pipelines to separate folder Maciej Gajdzica
2015-05-29 15:43 ` [dpdk-dev] [PATCH 05/11] ip_pipeline: added master pipeline Maciej Gajdzica
2015-05-29 15:43 ` [dpdk-dev] [PATCH 06/11] ip_pipeline: added application thread Maciej Gajdzica
2015-05-29 15:43 ` [dpdk-dev] [PATCH 07/11] ip_pipeline: moved config files to separate folder Maciej Gajdzica
2015-05-29 15:43 ` [dpdk-dev] [PATCH 08/11] ip_pipeline: added new implementation of passthrough pipeline Maciej Gajdzica
2015-05-29 15:43 ` [dpdk-dev] [PATCH 09/11] ip_pipeline: added new implementation of firewall pipeline Maciej Gajdzica
2015-05-29 15:43 ` [dpdk-dev] [PATCH 10/11] ip_pipeline: added new implementation of routing pipeline Maciej Gajdzica
2015-05-29 15:43 ` [dpdk-dev] [PATCH 11/11] ip_pipeline: added new implementation of flow classification pipeline Maciej Gajdzica
2015-06-23 13:48 ` [dpdk-dev] [PATCH 00/11] ip_pipeline: ip_pipeline application enhancements Thomas Monjalon
2015-06-23 13:54   ` Gajdzica, MaciejX T

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=20150601063412.5805c879@urahara \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=maciejx.t.gajdzica@intel.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).