Re: vmd: def nitems() locally

2018-05-01 Thread Theo de Raadt
Mike Larkin  wrote:

> On Mon, Apr 30, 2018 at 07:49:20PM -0300, Gleydson Soares wrote:
> > hi,
> > 
> > following diff defines nitems locally and stop 
> > including 
> 
> Has this been done elsewhere in the tree? Is this the new paradigm
> we will be adopting? I don't have a strong opinion one way or the
> other, just want to be consistent.

I prefer the current "document the problem on #include "
line approach, until we make a decision about making this available in
userland.  Which would require a robust assessment of impact on the
entire ports ecosystem, and consider how it may bleed into other
projects.

I don't believe we have reached that point yet, so I prefer if it
remains as-is.



Re: vmd: def nitems() locally

2018-05-01 Thread Mike Larkin
On Mon, Apr 30, 2018 at 07:49:20PM -0300, Gleydson Soares wrote:
> hi,
> 
> following diff defines nitems locally and stop 
> including 

Has this been done elsewhere in the tree? Is this the new paradigm
we will be adopting? I don't have a strong opinion one way or the
other, just want to be consistent.

-ml


> Index: control.c
> ===
> RCS file: /cvs/src/usr.sbin/vmd/control.c,v
> retrieving revision 1.22
> diff -u -p -r1.22 control.c
> --- control.c 8 Sep 2017 06:24:31 -   1.22
> +++ control.c 30 Apr 2018 22:45:22 -
> @@ -17,7 +17,6 @@
>   * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
>   */
>  
> -#include/* nitems */
>  #include 
>  #include 
>  #include 
> Index: priv.c
> ===
> RCS file: /cvs/src/usr.sbin/vmd/priv.c,v
> retrieving revision 1.13
> diff -u -p -r1.13 priv.c
> --- priv.c11 Nov 2017 02:50:07 -  1.13
> +++ priv.c30 Apr 2018 22:45:22 -
> @@ -16,7 +16,6 @@
>   * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
>   */
>  
> -#include/* nitems */
>  #include 
>  #include 
>  #include 
> Index: vmd.c
> ===
> RCS file: /cvs/src/usr.sbin/vmd/vmd.c,v
> retrieving revision 1.84
> diff -u -p -r1.84 vmd.c
> --- vmd.c 25 Apr 2018 15:49:48 -  1.84
> +++ vmd.c 30 Apr 2018 22:45:22 -
> @@ -16,7 +16,6 @@
>   * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
>   */
>  
> -#include/* nitems */
>  #include 
>  #include 
>  #include 
> Index: vmd.h
> ===
> RCS file: /cvs/src/usr.sbin/vmd/vmd.h,v
> retrieving revision 1.68
> diff -u -p -r1.68 vmd.h
> --- vmd.h 27 Apr 2018 12:15:10 -  1.68
> +++ vmd.h 30 Apr 2018 22:45:22 -
> @@ -35,6 +35,10 @@
>  #ifndef VMD_H
>  #define VMD_H
>  
> +#ifndef nitems
> +#define nitems(_a)(sizeof((_a)) / sizeof((_a)[0]))
> +#endif
> +
>  #define SET(_v, _m)  ((_v) |= (_m))
>  #define CLR(_v, _m)  ((_v) &= ~(_m))
>  #define ISSET(_v, _m)((_v) & (_m))
> Index: vmm.c
> ===
> RCS file: /cvs/src/usr.sbin/vmd/vmm.c,v
> retrieving revision 1.81
> diff -u -p -r1.81 vmm.c
> --- vmm.c 13 Apr 2018 17:12:44 -  1.81
> +++ vmm.c 30 Apr 2018 22:45:22 -
> @@ -16,7 +16,6 @@
>   * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
>   */
>  
> -#include/* nitems */
>  #include 
>  #include 
>  #include