summary refs log tree commit diff
path: root/resolv
diff options
context:
space:
mode:
Diffstat (limited to 'resolv')
-rw-r--r--resolv/inet_net_pton.c8
-rw-r--r--resolv/res_hconf.c4
-rw-r--r--resolv/res_init.c5
3 files changed, 6 insertions, 11 deletions
diff --git a/resolv/inet_net_pton.c b/resolv/inet_net_pton.c
index d3f1350312..2f06c6803f 100644
--- a/resolv/inet_net_pton.c
+++ b/resolv/inet_net_pton.c
@@ -91,9 +91,7 @@ inet_net_pton_ipv4(src, dst, size)
 	u_char *dst;
 	size_t size;
 {
-	static const char
-		xdigits[] = "0123456789abcdef",
-		digits[] = "0123456789";
+	static const char xdigits[] = "0123456789abcdef";
 	int n, ch, tmp, dirty, bits;
 	const u_char *odst = dst;
 
@@ -125,7 +123,7 @@ inet_net_pton_ipv4(src, dst, size)
 		for (;;) {
 			tmp = 0;
 			do {
-				n = strchr(digits, ch) - digits;
+				n = strchr(xdigits, ch) - xdigits;
 				assert(n >= 0 && n <= 9);
 				tmp *= 10;
 				tmp += n;
@@ -153,7 +151,7 @@ inet_net_pton_ipv4(src, dst, size)
 		ch = *src++;	/* Skip over the /. */
 		bits = 0;
 		do {
-			n = strchr(digits, ch) - digits;
+			n = strchr(xdigits, ch) - xdigits;
 			assert(n >= 0 && n <= 9);
 			bits *= 10;
 			bits += n;
diff --git a/resolv/res_hconf.c b/resolv/res_hconf.c
index 06306f7726..ab49ccf9d6 100644
--- a/resolv/res_hconf.c
+++ b/resolv/res_hconf.c
@@ -334,9 +334,7 @@ _res_hconf_init (void)
       while (fgets_unlocked (buf, sizeof (buf), fp))
 	{
 	  ++line_num;
-	  end = strchr (buf, '\n');
-	  if (end)
-	    *end = '\0';
+	  *__strchrnul (buf, '\n') = '\0';
 	  parse_line (hconf_name, line_num, buf);
 	}
       fclose (fp);
diff --git a/resolv/res_init.c b/resolv/res_init.c
index 893072f24e..de053c4993 100644
--- a/resolv/res_init.c
+++ b/resolv/res_init.c
@@ -289,8 +289,7 @@ res_init()
 		    if ((*cp == '\0') || (*cp == '\n'))
 			    continue;
 		    strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1);
-		    if ((cp = strchr(_res.defdname, '\n')) != NULL)
-			    *cp = '\0';
+		    *__strchrnul (_res.defdname, '\n') = '\0';
 		    /*
 		     * Set search list to be blank-separated strings
 		     * on rest of line.
@@ -406,7 +405,7 @@ res_init()
 		while (pp < _res.dnsrch + MAXDFLSRCH) {
 			if (dots < LOCALDOMAINPARTS)
 				break;
-			cp = strchr(cp, '.') + 1;    /* we know there is one */
+			cp = __rawmemchr(cp, '.') + 1;    /* we know there is one */
 			*pp++ = cp;
 			dots--;
 		}