diff options
author | Rosen Penev <rosenp@gmail.com> | 2020-05-10 18:25:47 -0700 |
---|---|---|
committer | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2020-05-11 09:21:29 +0200 |
commit | bbdc0269bf49aa8dd8259d0c31efff2366f6647f (patch) | |
tree | 516c2ef42233cb6b5c71a8100a4ae71f87cf6fd8 /utils/cec-ctl/cec-ctl.cpp | |
parent | c39488120a52f88b730c406e2c6abf3176f5d06f (diff) |
utils: replace chr functions with std variants
*chr in std offers const overloads, which avoid conversions.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'utils/cec-ctl/cec-ctl.cpp')
-rw-r--r-- | utils/cec-ctl/cec-ctl.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp index b8edb105..899b83b1 100644 --- a/utils/cec-ctl/cec-ctl.cpp +++ b/utils/cec-ctl/cec-ctl.cpp @@ -3,10 +3,11 @@ * Copyright 2016 Cisco Systems, Inc. and/or its affiliates. All rights reserved. */ +#include <cstring> + #include <unistd.h> #include <stdlib.h> #include <stdio.h> -#include <string.h> #include <inttypes.h> #include <getopt.h> #include <sys/types.h> @@ -1650,7 +1651,7 @@ static void stress_test_power_cycle(struct node &node, unsigned cnt, static int calc_node_val(const char *s) { - s = strrchr(s, '/') + 1; + s = std::strrchr(s, '/') + 1; if (!memcmp(s, "cec", 3)) return atol(s + 3); @@ -1917,7 +1918,7 @@ int main(int argc, char **argv) case OptIgnore: { bool all_la = !strncmp(optarg, "all", 3); bool all_opcodes = true; - const char *sep = strchr(optarg, ','); + const char *sep = std::strchr(optarg, ','); unsigned la_mask = 0xffff, opcode, la = 0; if (sep) @@ -2068,7 +2069,7 @@ int main(int argc, char **argv) size--; break; } - value = strchr(value, ':'); + value = std::strchr(value, ':'); if (value == NULL) break; value++; @@ -2109,7 +2110,7 @@ int main(int argc, char **argv) size--; break; } - value = strchr(value, ':'); + value = std::strchr(value, ':'); if (value == NULL) break; value++; @@ -2150,7 +2151,7 @@ int main(int argc, char **argv) size--; break; } - value = strchr(value, ':'); + value = std::strchr(value, ':'); if (value == NULL) break; value++; @@ -2184,7 +2185,7 @@ int main(int argc, char **argv) size--; break; } - value = strchr(value, ':'); + value = std::strchr(value, ':'); if (value == NULL) break; value++; |