From: Johan Hedberg <johan.hedberg@gmail.com>
To: sbrown@cortland.com
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] mesh: Add subscriptions to node structure and json database
Date: Wed, 20 Dec 2017 15:05:45 +0100 [thread overview]
Message-ID: <20171220140545.GA12891@x1c> (raw)
In-Reply-To: <20171220131008.10640-1-sbrown@cortland.com>
Hi Steve,
On Wed, Dec 20, 2017, sbrown@cortland.com wrote:
> mesh/config-client.c | 27 +++++++++++++++++-----
> mesh/node.c | 22 ++++++++++++++++++
> mesh/node.h | 2 ++
> mesh/prov-db.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> mesh/prov-db.h | 2 ++
> 5 files changed, 110 insertions(+), 6 deletions(-)
Just a couple of coding style comments:
> +bool node_add_subscription(struct mesh_node *node, uint8_t ele_idx,
> + uint32_t model_id, uint16_t addr)
> +{
> + struct mesh_model *model;
> + GList *l;
> +
> + model = get_model(node, ele_idx, model_id);
> +
> + if(!model)
Missing space after if, and remove the empty line before it (in general
no empty line between assigning to a variable and testing its value).
> + l = g_list_find(model->subscriptions, GUINT_TO_POINTER(addr));
> +
> + if (l)
Same thing here with the empty line
> +bool prov_db_add_subscription(struct mesh_node *node, uint8_t ele_idx,
> + uint32_t model_id, uint16_t addr)
> +{
> + json_object *jmain;
> + json_object *jmodel;
> + json_object *jsubscriptions = NULL;
> + bool local = (node == node_get_local_node());
Rather minor, but the generally preferred aestethic with variable
declarations is "reverse xmas tree", i.e. longest ones first.
> + jmodel = get_jmodel_obj(node, ele_idx, model_id, &jmain);
> +
> + if (!jmodel)
Same thing as earlier with the empty line.
Otherwise looks fine to me.
Johan
prev parent reply other threads:[~2017-12-20 14:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-20 13:10 [PATCH] mesh: Add subscriptions to node structure and json database sbrown
2017-12-20 14:05 ` Johan Hedberg [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=20171220140545.GA12891@x1c \
--to=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=sbrown@cortland.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).