Re: [kvm-unit-tests PATCH 06/14] util: move MAX/MIN macro into util.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 14, 2016 at 08:40:44PM +0800, Peter Xu wrote:
> Signed-off-by: Peter Xu <peterx@xxxxxxxxxx>
> ---
>  lib/alloc.c | 3 ---
>  lib/util.h  | 3 +++
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/alloc.c b/lib/alloc.c
> index e1d7b8a..58af52b 100644
> --- a/lib/alloc.c
> +++ b/lib/alloc.c
> @@ -7,9 +7,6 @@
>  #include "asm/spinlock.h"
>  #include "asm/io.h"
>  
> -#define MIN(a, b)		((a) < (b) ? (a) : (b))
> -#define MAX(a, b)		((a) > (b) ? (a) : (b))
> -
>  #define PHYS_ALLOC_NR_REGIONS	256
>  
>  struct phys_alloc_region {
> diff --git a/lib/util.h b/lib/util.h
> index 4c4b441..1462f4f 100644
> --- a/lib/util.h
> +++ b/lib/util.h
> @@ -20,4 +20,7 @@
>   */
>  extern int parse_keyval(char *s, long *val);
>  
> +#define MIN(a, b)		((a) < (b) ? (a) : (b))
> +#define MAX(a, b)		((a) > (b) ? (a) : (b))
> +
>  #endif
> -- 
> 2.7.4
>

I'd prefer they move to lib/libcflat.h. Currently util is for unit
test utilities. MIN/MAX are useful to the library code as well. We
shouldn't require util.h be included by library code.

(I agree libcflat.h is getting ugly, but cleaning it up is beyond the
 scope of this series and right now MIN/MAX would fit there best.)

Thanks,
drew
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux