Re: [PATCH 3/4] text-utils: use min() from c.h

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

 



On Thu, May 17, 2012 at 09:41:08AM +0200, Petr Uzel wrote:
>  text-utils/display.c |    7 ++-----
>  1 files changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/text-utils/display.c b/text-utils/display.c
> index ad638e7..84ec5d8 100644
> --- a/text-utils/display.c
> +++ b/text-utils/display.c
> @@ -41,14 +41,11 @@
>  #include <string.h>
>  #include "hexdump.h"
>  #include "xalloc.h"
> +#include "c.h"
>  
>  static void doskip(const char *, int);
>  static u_char *get(void);
>  
> -#ifndef MIN
> -#define MIN(a,b) ((a)<(b)?(a):(b))
> -#endif
> -
>  enum _vflag vflag = FIRST;
>  
>  static off_t address;			/* address/offset in stream */
> @@ -262,7 +259,7 @@ get(void)
>  			return(curp);
>  		}
>  		n = fread((char *)curp + nread, sizeof(unsigned char),
> -		    length == -1 ? need : MIN(length, need), stdin);
> +		    length == -1 ? need : min(length, need), stdin);

 It seems that the macro works as expected and detects some
 disadvantages :-)

 display.c: In function ‘get’:
 display.c:262:117: warning: comparison of distinct pointer types
 lacks a cast [enabled by default]

 Fixed and applied, thanks.

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux