diff options
| author | paco <paco@voltanet.io> | 2018-06-19 17:59:53 +0200 | 
|---|---|---|
| committer | paco <paco@voltanet.io> | 2018-06-19 17:59:53 +0200 | 
| commit | 5d5ba0185dd63e5443a9c005f8b369b17e82ab03 (patch) | |
| tree | 888436e6de484cc8a838d063b68880919f0855bd | |
| parent | 447297f34faa21a1436018caa213de216a93bc65 (diff) | |
bgpd, lib, ospfd, zebra: all_digit moved to frrstr
This solves a pending FIXME
Signed-off-by: F. Aragon <paco@voltanet.io>
| -rw-r--r-- | bgpd/bgp_rd.c | 1 | ||||
| -rw-r--r-- | bgpd/bgp_routemap.c | 1 | ||||
| -rw-r--r-- | bgpd/bgp_vty.c | 1 | ||||
| -rw-r--r-- | lib/frrstr.c | 8 | ||||
| -rw-r--r-- | lib/frrstr.h | 11 | ||||
| -rw-r--r-- | lib/prefix.c | 11 | ||||
| -rw-r--r-- | lib/prefix.h | 1 | ||||
| -rw-r--r-- | ospfd/ospf_routemap.c | 1 | ||||
| -rw-r--r-- | zebra/zebra_routemap.c | 1 | 
9 files changed, 24 insertions, 12 deletions
diff --git a/bgpd/bgp_rd.c b/bgpd/bgp_rd.c index 356a949d69..77f5aade5f 100644 --- a/bgpd/bgp_rd.c +++ b/bgpd/bgp_rd.c @@ -27,6 +27,7 @@  #include "memory.h"  #include "stream.h"  #include "filter.h" +#include "frrstr.h"  #include "bgpd/bgpd.h"  #include "bgpd/bgp_rd.h" diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index cbacd6b4f2..6462392096 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -37,6 +37,7 @@  #include "sockunion.h"  #include "hash.h"  #include "queue.h" +#include "frrstr.h"  #include "bgpd/bgpd.h"  #include "bgpd/bgp_table.h" diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index f0fc3a89e9..4e0f7155ba 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -34,6 +34,7 @@  #include "hash.h"  #include "queue.h"  #include "filter.h" +#include "frrstr.h"  #include "bgpd/bgpd.h"  #include "bgpd/bgp_advertise.h" diff --git a/lib/frrstr.c b/lib/frrstr.c index d003590ba6..1f0849566a 100644 --- a/lib/frrstr.c +++ b/lib/frrstr.c @@ -158,3 +158,11 @@ bool begins_with(const char *str, const char *prefix)  	return strncmp(str, prefix, lenprefix) == 0;  } + +int all_digit(const char *str) +{ +	for (; *str != '\0'; str++) +		if (!isdigit((int)*str)) +			return 0; +	return 1; +} diff --git a/lib/frrstr.h b/lib/frrstr.h index 2454771122..891a3f337c 100644 --- a/lib/frrstr.h +++ b/lib/frrstr.h @@ -97,4 +97,15 @@ void frrstr_strvec_free(vector v);   */  bool begins_with(const char *str, const char *prefix); +/* + * Check the string only contains digit characters. + * + * str + *    string to check for digits + * + * Returns: + *    1 str only contains digit characters, 0 otherwise + */ +int all_digit(const char *str); +  #endif /* _FRRSTR_H_ */ diff --git a/lib/prefix.c b/lib/prefix.c index b129665e7b..751f20cb83 100644 --- a/lib/prefix.c +++ b/lib/prefix.c @@ -1373,17 +1373,6 @@ void prefix_free(struct prefix *p)  	XFREE(MTYPE_PREFIX, p);  } -/* Utility function.  Check the string only contains digit - * character. - * FIXME str.[c|h] would be better place for this function. */ -int all_digit(const char *str) -{ -	for (; *str != '\0'; str++) -		if (!isdigit((int)*str)) -			return 0; -	return 1; -} -  /* Utility function to convert ipv4 prefixes to Classful prefixes */  void apply_classful_mask_ipv4(struct prefix_ipv4 *p)  { diff --git a/lib/prefix.h b/lib/prefix.h index f5dbb22f79..4247569137 100644 --- a/lib/prefix.h +++ b/lib/prefix.h @@ -458,7 +458,6 @@ static inline int ipv6_martian(struct in6_addr *addr)  	return 0;  } -extern int all_digit(const char *);  extern int macstr2prefix_evpn(const char *str, struct prefix_evpn *p);  /* NOTE: This routine expects the address argument in network byte order. */ diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c index ca711aa42f..f3271acfa2 100644 --- a/ospfd/ospf_routemap.c +++ b/ospfd/ospf_routemap.c @@ -32,6 +32,7 @@  #include "log.h"  #include "plist.h"  #include "vrf.h" +#include "frrstr.h"  #include "ospfd/ospfd.h"  #include "ospfd/ospf_asbr.h" diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index 10ba88880a..7afa2f853e 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -31,6 +31,7 @@  #include "plist.h"  #include "nexthop.h"  #include "vrf.h" +#include "frrstr.h"  #include "zebra/zserv.h"  #include "zebra/redistribute.h"  | 
