Print this page
use thread_local for ntoa buf
@@ -108,21 +108,23 @@
*
* Reentrant interface
*/
#include "lint.h"
-#include "thr_uberdata.h"
#include <sys/types.h>
#include <netinet/in.h>
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
+#include <threads.h>
+static thread_local char ntoa_buf[18];
+
char *
inet_ntoa_r(struct in_addr in, char b[])
{
char *p;
@@ -134,11 +136,11 @@
}
char *
inet_ntoa(struct in_addr in)
{
- return (inet_ntoa_r(in, curthread->ul_ntoabuf));
+ return (inet_ntoa_r(in, ntoa_buf));
}
/*
* Check whether "cp" is a valid ascii representation
* of an Internet address and convert to a binary address.