[LTP] [RFC PATCH 2/3] Add more missing <string.h> and <strings.h> includes

Cyril Hrubis chrubis@suse.cz
Fri Apr 12 11:45:19 CEST 2019


Hi!
> >>>> diff --git a/include/tst_numa.h b/include/tst_numa.h
> >>>> index a4cd1be37..4f9806602 100644
> >>>> --- a/include/tst_numa.h
> >>>> +++ b/include/tst_numa.h
> >>>> @@ -7,6 +7,8 @@
> >>>>    #ifndef TST_NUMA_H__
> >>>>    #define TST_NUMA_H__
> >>>> +#include <string.h>
> >>>> +
> >>>>    /**
> >>>>     * Numa nodemap.
> >>>>     */
> >>>> diff --git a/lib/tst_af_alg.c b/lib/tst_af_alg.c
> >>>> index 97be548b4..edf8c0140 100644
> >>>> --- a/lib/tst_af_alg.c
> >>>> +++ b/lib/tst_af_alg.c
> >>>> @@ -5,6 +5,7 @@
> >>>>    #include <errno.h>
> >>>>    #include <stdlib.h>
> >>>> +#include <string.h>
> >>> Why not simply include <string.h>?? in tst_test.h. I did it in my another
> >>> review thread. This should be OK for most of cases.
> >> Sounds reasonable to me.
> > Agree, that'd be the easiest way :). NOTE: not sure what requires that, but
> > sometimes is <strings.h> needed as well.
> 
> As I know, calls likes str*, mem*, such as, strncpy, memset, requires 
> <string.h>,?? but bzero requires <strings.h>. Fortunately <strings.h> are 
> not used as often as <string.h>. See my another review thread. :-)

bzero() has been deprecated for quite some time, ideally we should
replace it with memset().

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list