hashtable: drop all non-reentrant versions

The non-reentrant versions of the hashtable functions operate on a single
shared hashtable.  So if two different people try using these funcs for
two different purposes, they'll cause problems for the other.

Avoid this by converting all existing hashtable consumers over to the
reentrant versions and then punting the non-reentrant ones.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index c3b57f2..f8c7976 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -111,7 +111,7 @@
 
 		e.key = name;
 		e.data = NULL;
-		ep = hsearch (e, FIND);
+		hsearch_r(e, FIND, &ep, &env_htab);
 		if (ep == NULL)
 			return 0;
 		len = printf ("%s=%s\n", ep->key, ep->data);
@@ -119,7 +119,7 @@
 	}
 
 	/* print whole list */
-	len = hexport('\n', &res, 0);
+	len = hexport_r(&env_htab, '\n', &res, 0);
 
 	if (len > 0) {
 		puts(res);
@@ -184,7 +184,7 @@
 	 */
 	e.key = name;
 	e.data = NULL;
-	ep = hsearch (e, FIND);
+	hsearch_r(e, FIND, &ep, &env_htab);
 
 	/* Check for console redirection */
 	if (strcmp(name,"stdin") == 0) {
@@ -267,7 +267,7 @@
 
 	/* Delete only ? */
 	if ((argc < 3) || argv[2] == NULL) {
-		int rc = hdelete(name);
+		int rc = hdelete_r(name, &env_htab);
 		return !rc;
 	}
 
@@ -293,7 +293,7 @@
 
 	e.key  = name;
 	e.data = value;
-	ep = hsearch(e, ENTER);
+	hsearch_r(e, ENTER, &ep, &env_htab);
 	free(value);
 	if (!ep) {
 		printf("## Error inserting \"%s\" variable, errno=%d\n",
@@ -456,7 +456,7 @@
 
 		e.key  = name;
 		e.data = NULL;
-		ep = hsearch (e, FIND);
+		hsearch_r(e, FIND, &ep, &env_htab);
 
 		return (ep ? ep->data : NULL);
 	}
@@ -651,7 +651,7 @@
 	}
 
 	if (sep) {		/* export as text file */
-		len = hexport(sep, &addr, size);
+		len = hexport_r(&env_htab, sep, &addr, size);
 		if (len < 0) {
 			error("Cannot export environment: errno = %d\n",
 				errno);
@@ -670,7 +670,7 @@
 	else			/* export as raw binary data */
 		res = addr;
 
-	len = hexport('\0', &res, ENV_SIZE);
+	len = hexport_r(&env_htab, '\0', &res, ENV_SIZE);
 	if (len < 0) {
 		error("Cannot export environment: errno = %d\n",
 			errno);
@@ -790,7 +790,7 @@
 		addr = (char *)ep->data;
 	}
 
-	if (himport(addr, size, sep, del ? 0 : H_NOCLEAR) == 0) {
+	if (himport_r(&env_htab, addr, size, sep, del ? 0 : H_NOCLEAR) == 0) {
 		error("Environment import failed: errno = %d\n", errno);
 		return 1;
 	}