diff options
| author | David Lamparter <equinox@diac24.net> | 2019-03-06 15:54:44 +0100 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-06 15:54:44 +0100 | 
| commit | d3b05897edff14ceb71c2f5603a9fcdb1ae10c83 (patch) | |
| tree | 274b088939d9686c289d5de95d70cdb39a01e4b4 /bgpd/bgp_lcommunity.c | |
| parent | b19abe1131daa38d1d0e31c4793925bb89f11c07 (diff) | |
| parent | 25af5f0d79f9e5595b1ba3bb04a0aff876471029 (diff) | |
Merge pull request #3869 from qlyoung/cocci-fixes
Assorted Coccinelle fixes
Diffstat (limited to 'bgpd/bgp_lcommunity.c')
| -rw-r--r-- | bgpd/bgp_lcommunity.c | 17 | 
1 files changed, 7 insertions, 10 deletions
diff --git a/bgpd/bgp_lcommunity.c b/bgpd/bgp_lcommunity.c index 1e45897192..44766c9b6e 100644 --- a/bgpd/bgp_lcommunity.c +++ b/bgpd/bgp_lcommunity.c @@ -38,17 +38,14 @@ static struct hash *lcomhash;  /* Allocate a new lcommunities.  */  static struct lcommunity *lcommunity_new(void)  { -	return (struct lcommunity *)XCALLOC(MTYPE_LCOMMUNITY, -					    sizeof(struct lcommunity)); +	return XCALLOC(MTYPE_LCOMMUNITY, sizeof(struct lcommunity));  }  /* Allocate lcommunities.  */  void lcommunity_free(struct lcommunity **lcom)  { -	if ((*lcom)->val) -		XFREE(MTYPE_LCOMMUNITY_VAL, (*lcom)->val); -	if ((*lcom)->str) -		XFREE(MTYPE_LCOMMUNITY_STR, (*lcom)->str); +	XFREE(MTYPE_LCOMMUNITY_VAL, (*lcom)->val); +	XFREE(MTYPE_LCOMMUNITY_STR, (*lcom)->str);  	XFREE(MTYPE_LCOMMUNITY, *lcom);  } @@ -180,7 +177,7 @@ static void set_lcommunity_string(struct lcommunity *lcom, bool make_json)  {  	int i;  	int len; -	bool first = 1; +	bool first = true;  	char *str_buf;  	char *str_pnt;  	uint8_t *pnt; @@ -218,7 +215,7 @@ static void set_lcommunity_string(struct lcommunity *lcom, bool make_json)  	for (i = 0; i < lcom->size; i++) {  		if (first) -			first = 0; +			first = false;  		else  			*str_pnt++ = ' '; @@ -319,10 +316,10 @@ bool lcommunity_cmp(const void *arg1, const void *arg2)  	const struct lcommunity *lcom2 = arg2;  	if (lcom1 == NULL && lcom2 == NULL) -		return 1; +		return true;  	if (lcom1 == NULL || lcom2 == NULL) -		return 0; +		return false;  	return (lcom1->size == lcom2->size  		&& memcmp(lcom1->val, lcom2->val, lcom_length(lcom1)) == 0);  | 
