[OpenWrt-Devel] [PATCH 1/6] Changes for more readability.
Felix Fietkau
nbd at openwrt.org
Sat May 23 10:37:54 EDT 2015
On 2015-05-19 14:38, Yousong Zhou wrote:
> - "ifname" for Linux interface name.
> - "interface" for netifd defined logical interface names as in
> /etc/config/network.
> - A few comments and variable renames for better readability.
>
> Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
> ---
> device.c | 4 ++--
> device.h | 3 +++
> interface.c | 4 ++--
> interface.h | 1 +
> proto-shell.c | 8 ++++----
> ubus.c | 2 +-
> 6 files changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/device.c b/device.c
> index dd2823d..feb9460 100644
> --- a/device.c
> +++ b/device.c
> @@ -270,14 +270,14 @@ static void __init dev_init(void)
> static int device_broadcast_cb(void *ctx, struct safe_list *list)
> {
> struct device_user *dep = container_of(list, struct device_user, list);
> - int *ev = ctx;
> + int ev = *(int *)ctx;
I'm not a big fan of such pointer-cast + dereference lines. Assigning a
void * pointer to a pointer variable of the proper type is more common.
> /* device might have been removed by an earlier callback */
> if (!dep->dev)
> return 0;
>
> if (dep->cb)
> - dep->cb(dep, *ev);
> + dep->cb(dep, ev);
> return 0;
> }
>
> diff --git a/interface.h b/interface.h
> index 8eeb7db..4776073 100644
> --- a/interface.h
> +++ b/interface.h
> @@ -120,6 +120,7 @@ struct interface {
>
> struct list_head users;
>
> + /* alias: name of parent interface */
The "name of parent interface" comment is somewhat redundant. Better to
just write /* for alias interfaces */ here (it applies to both members
anyway).
- Felix
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list