Signed-off-by: Richard Cochran <richardcoch...@gmail.com> --- config.c | 11 ----------- util.c | 11 +++++++++++ util.h | 8 ++++++++ 3 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/config.c b/config.c index cc4e0f2..3190ad2 100644 --- a/config.c +++ b/config.c @@ -446,17 +446,6 @@ static enum parser_result parse_port_setting(struct config *cfg, return parse_item(cfg, iface->name, option, value); } -static int count_char(const char *str, char c) -{ - int num = 0; - char s; - while ((s = *(str++))) { - if (s == c) - num++; - } - return num; -} - static enum parser_result parse_global_setting(const char *option, const char *value, struct config *cfg) diff --git a/util.c b/util.c index 1fa8336..9202c55 100644 --- a/util.c +++ b/util.c @@ -77,6 +77,17 @@ char *cid2str(struct ClockIdentity *id) return buf; } +int count_char(const char *str, char c) +{ + int num = 0; + char s; + while ((s = *(str++))) { + if (s == c) + num++; + } + return num; +} + char *pid2str(struct PortIdentity *id) { static char buf[64]; diff --git a/util.h b/util.h index 734ea05..758ee5f 100644 --- a/util.h +++ b/util.h @@ -45,6 +45,14 @@ extern const char *ev_str[]; char *cid2str(struct ClockIdentity *id); /** + * Counts the number of occurrences of a given character. + * @param str String to evaluate. + * @param c The character of interest. + * @return The number of time 'c' appears in 'str'. + */ +int count_char(const char *str, char c); + +/** * Convert a port identity into a human readable string. * * Note that this function uses a static global variable to store the -- 2.1.4 ------------------------------------------------------------------------------ _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel