Print this page
use thread_local for ntoa buf
*** 108,128 ****
*
* 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>
char *
inet_ntoa_r(struct in_addr in, char b[])
{
char *p;
--- 108,130 ----
*
* Reentrant interface
*/
#include "lint.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,144 ****
}
char *
inet_ntoa(struct in_addr in)
{
! return (inet_ntoa_r(in, curthread->ul_ntoabuf));
}
/*
* Check whether "cp" is a valid ascii representation
* of an Internet address and convert to a binary address.
--- 136,146 ----
}
char *
inet_ntoa(struct in_addr in)
{
! 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.