Re: [Linuxptp-devel] [PATCH RFC 26/30] config: Use the proper create/destroy API for network interfaces.

2020-02-18 Thread Jacob Keller
On 2/11/2020 6:04 AM, Richard Cochran wrote:
> Signed-off-by: Richard Cochran 

Reviewed-by: Jacob Keller 

> ---
>  config.c | 6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/config.c b/config.c
> index 717ee65..e033842 100644
> --- a/config.c
> +++ b/config.c
> @@ -829,13 +829,11 @@ struct interface *config_create_interface(const char 
> *name, struct config *cfg)
>   return iface;
>   }
>  
> - iface = calloc(1, sizeof(struct interface));
> + iface = interface_create(name);
>   if (!iface) {
>   fprintf(stderr, "cannot allocate memory for a port\n");
>   return NULL;
>   }
> -
> - interface_set_name(iface, name);
>   STAILQ_INSERT_TAIL(>interfaces, iface, list);
>   cfg->n_interfaces++;
>  
> @@ -906,7 +904,7 @@ void config_destroy(struct config *cfg)
>  
>   while ((iface = STAILQ_FIRST(>interfaces))) {
>   STAILQ_REMOVE_HEAD(>interfaces, list);
> - free(iface);
> + interface_destroy(iface);
>   }
>   while ((table = STAILQ_FIRST(>unicast_master_tables))) {
>   while ((address = STAILQ_FIRST(>addrs))) {
> 


___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


[Linuxptp-devel] [PATCH RFC 26/30] config: Use the proper create/destroy API for network interfaces.

2020-02-11 Thread Richard Cochran
Signed-off-by: Richard Cochran 
---
 config.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/config.c b/config.c
index 717ee65..e033842 100644
--- a/config.c
+++ b/config.c
@@ -829,13 +829,11 @@ struct interface *config_create_interface(const char 
*name, struct config *cfg)
return iface;
}
 
-   iface = calloc(1, sizeof(struct interface));
+   iface = interface_create(name);
if (!iface) {
fprintf(stderr, "cannot allocate memory for a port\n");
return NULL;
}
-
-   interface_set_name(iface, name);
STAILQ_INSERT_TAIL(>interfaces, iface, list);
cfg->n_interfaces++;
 
@@ -906,7 +904,7 @@ void config_destroy(struct config *cfg)
 
while ((iface = STAILQ_FIRST(>interfaces))) {
STAILQ_REMOVE_HEAD(>interfaces, list);
-   free(iface);
+   interface_destroy(iface);
}
while ((table = STAILQ_FIRST(>unicast_master_tables))) {
while ((address = STAILQ_FIRST(>addrs))) {
-- 
2.20.1



___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel