Преглед изворни кода

resolv.c: include param.h and use MIN instead of min

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Peter S. Mazinger пре 13 година
родитељ
комит
3d1c785587
1 измењених фајлова са 3 додато и 5 уклоњено
  1. 3 5
      libc/inet/resolv.c

+ 3 - 5
libc/inet/resolv.c

@@ -315,6 +315,7 @@ Domain name in a message can be represented as either:
 #include <sys/utsname.h>
 #include <sys/un.h>
 #include <sys/stat.h>
+#include <sys/param.h>
 #include <bits/uClibc_mutex.h>
 #include "internal/parse_config.h"
 
@@ -1824,21 +1825,18 @@ int getnameinfo(const struct sockaddr *sa,
 
 				if (hoste) {
 					char *c;
-#undef min
-#define min(x,y) (((x) > (y)) ? (y) : (x))
 					if ((flags & NI_NOFQDN)
 					 && (getdomainname(domain, sizeof(domain)) == 0)
 					 && (c = strstr(hoste->h_name, domain)) != NULL
 					 && (c != hoste->h_name) && (*(--c) == '.')
 					) {
 						strncpy(host, hoste->h_name,
-							min(hostlen, (size_t) (c - hoste->h_name)));
-						host[min(hostlen - 1, (size_t) (c - hoste->h_name))] = '\0';
+							MIN(hostlen, (size_t) (c - hoste->h_name)));
+						host[MIN(hostlen - 1, (size_t) (c - hoste->h_name))] = '\0';
 					} else {
 						strncpy(host, hoste->h_name, hostlen);
 					}
 					ok = 1;
-#undef min
 				}
 			}