> -----Original Message----- > From: Stephen Hemminger <step...@networkplumber.org> > Sent: Monday, March 17, 2025 2:33 PM > To: Chia-Yu Chang (Nokia) <chia-yu.ch...@nokia-bell-labs.com> > Cc: net...@vger.kernel.org; dave.t...@gmail.com; pab...@redhat.com; > j...@mojatatu.com; k...@kernel.org; xiyou.wangc...@gmail.com; > j...@resnulli.us; da...@davemloft.net; eduma...@google.com; ho...@kernel.org; > andrew+net...@lunn.ch; donald.hun...@gmail.com; a...@fiberby.net; > liuhang...@gmail.com; sh...@kernel.org; linux-kselftest@vger.kernel.org; > i...@kernel.org; ncardw...@google.com; Koen De Schepper (Nokia) > <koen.de_schep...@nokia-bell-labs.com>; g.white <g.wh...@cablelabs.com>; > ingemar.s.johans...@ericsson.com; mirja.kuehlew...@ericsson.com; > chesh...@apple.com; rs.i...@gmx.at; jason_living...@comcast.com; vidhi_goel > <vidhi_g...@apple.com>; Olga Albisser <o...@albisser.org>; Olivier Tilmans > (Nokia) <olivier.tilm...@nokia.com>; Bob Briscoe <resea...@bobbriscoe.net>; > Henrik Steen <henr...@henrist.net> > Subject: Re: [PATCH v4 iproute2-next 1/1] tc: add dualpi2 scheduler module > > > CAUTION: This is an external email. Please be very careful when clicking > links or opening attachments. See the URL nok.it/ext for additional > information. > > > > On Sun, 16 Mar 2025 16:39:17 +0100 > chia-yu.ch...@nokia-bell-labs.com wrote: > > > +static int get_packets(uint32_t *val, const char *arg) { > > + unsigned long res; > > + char *ptr; > > + > > + if (!arg || !*arg) > > + return -1; > > + res = strtoul(arg, &ptr, 10); > > + if (!ptr || ptr == arg || > > + (strcmp(ptr, "p") && strcmp(ptr, "pkt") && strcmp(ptr, "pkts") && > > + strcmp(ptr, "packet") && strcmp(ptr, "packets"))) > > + return -1; > > No shortcuts please. > We ran into this with matches() and arg conflicts already.
Thanks for the feedback, and I will use matches() between ptr and "pkts" and matches() between ptr and "packets". Would this be ok or you expect further things to be modified? Many thanks. Chia-Yu