Clean up reentrancy cruft.

The DNS copy of reentrant.h was unused, so remove it.

The strtod implementation can use the upstream-netbsd reentrant.h and
get a little closer to what was then upstream. (It's since been replaced
by gdtoa, and we'll have to follow at some point, but for now this doesn't
make anything any worse.)

ANDROID_CHANGES is (now) only used in the DNS code, so push the -D
down.

The <locale.h> change prevents an LP32 hack from leaking into LP64.

Change-Id: Idf30b98a59d7ca8f7c6cd6d07020b512057911ef
This commit is contained in:
Elliott Hughes
2014-03-13 16:17:43 -07:00
parent d16100c1fb
commit 205c7887ad
5 changed files with 12 additions and 290 deletions

View File

@@ -91,12 +91,6 @@
* directly -- and assumed always to succeed.
*/
#ifdef ANDROID_CHANGES
#include <pthread.h>
#define mutex_lock(x) pthread_mutex_lock(x)
#define mutex_unlock(x) pthread_mutex_unlock(x)
#endif
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: strtod.c,v 1.45.2.1 2005/04/19 13:35:54 tron Exp $");
@@ -151,18 +145,14 @@ __RCSID("$NetBSD: strtod.c,v 1.45.2.1 2005/04/19 13:35:54 tron Exp $");
#ifndef KR_headers
#include "stdlib.h"
#include "string.h"
#ifndef ANDROID_CHANGES
#include "locale.h"
#endif /* ANDROID_CHANGES */
#else
#include "malloc.h"
#include "memory.h"
#endif
#endif
#ifndef ANDROID_CHANGES
#include "extern.h"
#include "reentrant.h"
#endif /* ANDROID_CHANGES */
#include "../upstream-netbsd/extern.h" /* Android-changed. */
#include "../upstream-netbsd/reentrant.h" /* Android-changed. */
#ifdef MALLOC
#ifdef KR_headers
@@ -370,13 +360,9 @@ Bigint {
static Bigint *freelist[Kmax+1];
#ifdef ANDROID_CHANGES
static pthread_mutex_t freelist_mutex = PTHREAD_MUTEX_INITIALIZER;
#else
#ifdef _REENTRANT
static mutex_t freelist_mutex = MUTEX_INITIALIZER;
#endif
#endif
/* Special value used to indicate an invalid Bigint value,
* e.g. when a memory allocation fails. The idea is that we
@@ -1346,16 +1332,14 @@ strtod
Bigint *bb1, *bd0;
Bigint *bb = NULL, *bd = NULL, *bs = NULL, *delta = NULL;/* pacify gcc */
#ifdef ANDROID_CHANGES
CONST char decimal_point = '.';
#else /* ANDROID_CHANGES */
#if 0 /* BEGIN android-changed: no localeconv. */
#ifndef KR_headers
CONST char decimal_point = localeconv()->decimal_point[0];
#else
CONST char decimal_point = '.';
#endif
#endif /* ANDROID_CHANGES */
#endif /* END android-changed */
sign = nz0 = nz = 0;
value(rv) = 0.;