mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 12:49:18 +00:00
Merge pull request #2495 from pacovn/fixme_all_digit
bgpd, lib, ospfd, zebra: all_digit moved to frrstr
This commit is contained in:
commit
96be948bcd
@ -27,6 +27,7 @@
|
|||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "stream.h"
|
#include "stream.h"
|
||||||
#include "filter.h"
|
#include "filter.h"
|
||||||
|
#include "frrstr.h"
|
||||||
|
|
||||||
#include "bgpd/bgpd.h"
|
#include "bgpd/bgpd.h"
|
||||||
#include "bgpd/bgp_rd.h"
|
#include "bgpd/bgp_rd.h"
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "sockunion.h"
|
#include "sockunion.h"
|
||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
#include "queue.h"
|
#include "queue.h"
|
||||||
|
#include "frrstr.h"
|
||||||
|
|
||||||
#include "bgpd/bgpd.h"
|
#include "bgpd/bgpd.h"
|
||||||
#include "bgpd/bgp_table.h"
|
#include "bgpd/bgp_table.h"
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
#include "queue.h"
|
#include "queue.h"
|
||||||
#include "filter.h"
|
#include "filter.h"
|
||||||
|
#include "frrstr.h"
|
||||||
|
|
||||||
#include "bgpd/bgpd.h"
|
#include "bgpd/bgpd.h"
|
||||||
#include "bgpd/bgp_advertise.h"
|
#include "bgpd/bgp_advertise.h"
|
||||||
|
@ -161,3 +161,11 @@ bool begins_with(const char *str, const char *prefix)
|
|||||||
|
|
||||||
return strncmp(str, prefix, lenprefix) == 0;
|
return strncmp(str, prefix, lenprefix) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int all_digit(const char *str)
|
||||||
|
{
|
||||||
|
for (; *str != '\0'; str++)
|
||||||
|
if (!isdigit((int)*str))
|
||||||
|
return 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
11
lib/frrstr.h
11
lib/frrstr.h
@ -97,4 +97,15 @@ void frrstr_strvec_free(vector v);
|
|||||||
*/
|
*/
|
||||||
bool begins_with(const char *str, const char *prefix);
|
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_ */
|
#endif /* _FRRSTR_H_ */
|
||||||
|
11
lib/prefix.c
11
lib/prefix.c
@ -1373,17 +1373,6 @@ void prefix_free(struct prefix *p)
|
|||||||
XFREE(MTYPE_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 */
|
/* Utility function to convert ipv4 prefixes to Classful prefixes */
|
||||||
void apply_classful_mask_ipv4(struct prefix_ipv4 *p)
|
void apply_classful_mask_ipv4(struct prefix_ipv4 *p)
|
||||||
{
|
{
|
||||||
|
@ -458,7 +458,6 @@ static inline int ipv6_martian(struct in6_addr *addr)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int all_digit(const char *);
|
|
||||||
extern int macstr2prefix_evpn(const char *str, struct prefix_evpn *p);
|
extern int macstr2prefix_evpn(const char *str, struct prefix_evpn *p);
|
||||||
|
|
||||||
/* NOTE: This routine expects the address argument in network byte order. */
|
/* NOTE: This routine expects the address argument in network byte order. */
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "plist.h"
|
#include "plist.h"
|
||||||
#include "vrf.h"
|
#include "vrf.h"
|
||||||
|
#include "frrstr.h"
|
||||||
|
|
||||||
#include "ospfd/ospfd.h"
|
#include "ospfd/ospfd.h"
|
||||||
#include "ospfd/ospf_asbr.h"
|
#include "ospfd/ospf_asbr.h"
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "plist.h"
|
#include "plist.h"
|
||||||
#include "nexthop.h"
|
#include "nexthop.h"
|
||||||
#include "vrf.h"
|
#include "vrf.h"
|
||||||
|
#include "frrstr.h"
|
||||||
|
|
||||||
#include "zebra/zserv.h"
|
#include "zebra/zserv.h"
|
||||||
#include "zebra/redistribute.h"
|
#include "zebra/redistribute.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user