On Wed, 2019-04-03 at 09:00 -0400, Steven Rostedt wrote: > On Tue, 2 Apr 2019 16:45:30 +0300 > Slavomir Kaslev <kaslevs@xxxxxxxxxx> wrote: > > > -static int write_ints(char *buf, size_t buf_len, int *arr, int > > arr_len) > > +static unsigned int atou(const char *s) > > +{ > > + long r; > > + > > + r = atol(s); > > + if (r >= 0 && r <= UINT_MAX) > > + return r; > > + > > + return 0; > > +} > > + > > I wonder if we should do this instead: > > /* test a to u */ > static int tatou(const char *s, int *res) > { > long r; > > r = atol(s); > if (r >= 0 && r <= UINT_MAX) { > *res = (unsigned)r; > return 0; > } > return -1; > } Makes sense. I did consider it while writing this but decided to go with the traditional "broken" prototype for such functions.