Andy, first of all thank you for code review. At least somebody did take a look at it.
Now, for your question about subroutine. Yes, it is possible and, actually, it crossed my mind to write something like, but I didn't for two reasons: 1] I could barely see at the monitor 2] it felt silly to write a wrapper for a wrapper(str2uchar() is a wrapper for str-2-int conversion) and I had nobody to ask whether it is good idea or not. It's done now. However, for Kontron functions, error messages will vary. I just didn't have energy to write a proper ones in the end(yes, I did those last). It seems to me there is a lot to be done in 'lib/ipmi_fru.c'. But one step at the time. Again, thank you for code review, Z. On Wed, Oct 31, 2012 at 10:09 PM, Andy Cress <andy.cr...@us.kontron.com> wrote: > Zdenek, > > This is really messy. Can't you make all of that a subroutine instead of > adding so many lines of code? > Ideally the new subroutine (e.g. AtoI) should have the same format as atoi(), > but will detect errors and have printf's if there are errors. If errors, it > returns int of 0. > > Then to make code conform to it, just 's/atoi/AtoI/g'. > > Andy > > -----Original Message----- > From: Zdenek Styblik [mailto:zdenek.styb...@gmail.com] > Sent: Wednesday, October 31, 2012 4:51 PM > To: ipmitool-devel > Subject: [Ipmitool-devel] Code Review - ID: 3528271 - 'lib/ipmi_fru.c' > -possible *flow via FRUID > > Hi, > > attached is my take on elimination of atoi() from 'lib/ipmi_fru.c' and shot > at input validation. > Code review anyone, please? > > Thanks, > Z.
ipmi_fru-input_validation.c.diff
Description: Binary data
------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________ Ipmitool-devel mailing list Ipmitool-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ipmitool-devel