> > +/* main setup function of test */
> > +void setup(void);
> > +/* cleanup function for the test */
> > +void __attribute__ ((noreturn)) cleanup(void);
> 
> There is LTP_ATTRIBUTE_NORETURN defined in standart test headers so this
> could be turned on/off in one place. See include/compiler.h that is
> included in include/test.h
OK.

> > +static int testcpuset(void);
> > +void help(void);
> > +static void sighandler(UNUSED int signo);
> 
> Same here, use LTP_ATTRIBUTE_UNUSED.
OK.

> > +static int mem_hog(void);
> > +long count_numa(void);
> > +long count_cpu(void);
> > +static int path_exist(const char *path, ...);
> > +int mem_hog_cpuset(int ntasks);
> > +static const char *path_vcreate(const char *path, va_list ap);
> 
> You could omit these by shifting functions to their right place. For
> example moving main at the end of file would save a few of them.
Well, I can see different people have different view here. Someone else may say 
it is a good practice to have the main() as the first function which might be 
easier for someone to follow what the code is doing.

> > +static int path_exist(const char *path, ...)
> > +{
> > +   va_list ap;
> > +   const char *p;
> > +
> > +   va_start(ap, path);
> > +   p = path_vcreate(path, ap);
> > +   va_end(ap);
> > +
> > +   return access(p, F_OK) == 0;
> > +}
> > +
> > +static const char *path_vcreate(const char *path, va_list ap)
> > +{
> > +   vsnprintf(pathbuf, sizeof(pathbuf), path, ap);
> > +   return pathbuf;
> > +}
> 
> You are returning pointer to global variable here. That's just too
> confusing.
> 
> I would merge the path_exist and path_vcreate functions into one so that
> you could declare pathbuf as local variable.
OK. Thanks.

CAI Qian

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to