author | The Android Open Source Project <initial-contribution@android.com> | |
Mon, 3 May 2010 22:33:05 +0000 (15:33 -0700) | ||
committer | The Android Open Source Project <initial-contribution@android.com> | |
Mon, 3 May 2010 22:33:05 +0000 (15:33 -0700) |
Change-Id: If02d33af51017dbd85e91c79ac2e848eda6cf253
1 | 2 | |||
---|---|---|---|---|
libc/bionic/logd_write.c | patch | | diff1 | | diff2 | | blob | history |
libc/bionic/malloc_debug_leak.c | patch | | diff1 | | diff2 | | blob | history |
libc/stdlib/strtod.c | patch | | diff1 | | diff2 | | blob | history |
libc/stdlib/wchar.c | patch | | diff1 | | diff2 | | blob | history |
diff --cc libc/bionic/logd_write.c
index 2c5bf42f34f18ac8d199a21617d4162c5d21db47,39f02588ed425bd6cc18b6fc13a85700e2ebdfdb..618160faa7a313c46ad21d4e649e49f0f267fd87
+++ b/libc/bionic/logd_write.c
log_channels[log_id].logger =
(fd < 0) ? __write_to_log_null : __write_to_log_kernel;
+ log_channels[log_id].fd = fd;
+ log_channels[log_id].fd = fd;
+
pthread_mutex_unlock(&log_init_lock);
return log_channels[log_id].logger(log_id, vec);
diff --cc libc/bionic/malloc_debug_leak.c
Simple merge
diff --cc libc/stdlib/strtod.c
index b1f5868c3ecf31e7bdc52986a7ff1514468a2d06,d2582b1ebfc6ec0a19cb751fb5b83bdc914b0220..9d599b05993a4e846bd2929dfadbe915a5f6ca22
+++ b/libc/stdlib/strtod.c
else {
x = 1 << k;
rv = (Bigint *)MALLOC(sizeof(Bigint) + (x-1)*sizeof(Long));
+ if (rv == NULL) {
+ rv = BIGINT_INVALID;
+ goto EXIT;
+ }
rv->k = k;
rv->maxwds = x;
- }
+ }
rv->sign = rv->wds = 0;
-
+EXIT:
mutex_unlock(&freelist_mutex);
return rv;
freelist[v->k] = v;
mutex_unlock(&freelist_mutex);
- }
}
+ }
-#define Bcopy(x,y) memcpy(&x->sign, &y->sign, \
- y->wds*sizeof(Long) + 2*sizeof(int))
+#define Bcopy_valid(x,y) memcpy(&(x)->sign, &(y)->sign, \
+ (y)->wds*sizeof(Long) + 2*sizeof(int))
+
+#define Bcopy(x,y) Bcopy_ptr(&(x),(y))
+
+ static void
+Bcopy_ptr(Bigint **px, Bigint *y)
+{
+ if (*px == BIGINT_INVALID)
+ return; /* no space to store copy */
+ if (y == BIGINT_INVALID) {
+ Bfree(*px); /* invalid input */
+ *px = BIGINT_INVALID;
+ } else {
+ Bcopy_valid(*px,y);
+ }
+}
static Bigint *
multadd
Bigint *b;
b = Balloc(1);
- b->x[0] = i;
- b->wds = 1;
+ if (b != BIGINT_INVALID) {
+ b->x[0] = i;
+ b->wds = 1;
+ }
return b;
- }
+ }
static Bigint *
mult
return b;
if (!(p5 = p5s)) {
/* first time */
- p5 = p5s = i2b(625);
+ p5 = i2b(625);
+ if (p5 == BIGINT_INVALID) {
+ Bfree(b);
+ return p5;
+ }
+ p5s = p5;
p5->next = 0;
- }
+ }
for(;;) {
if (k & 1) {
b1 = mult(b, p5);
if (!(k = (unsigned int) k >> 1))
break;
if (!(p51 = p5->next)) {
- p51 = p5->next = mult(p5,p5);
+ p51 = mult(p5,p5);
+ if (p51 == BIGINT_INVALID) {
+ Bfree(b);
+ return p51;
+ }
+ p5->next = p51;
p51->next = 0;
- }
- p5 = p51;
}
- return b;
+ p5 = p51;
}
+ return b;
+ }
static Bigint *
lshift
i = cmp(a,b);
if (!i) {
c = Balloc(0);
- c->wds = 1;
- c->x[0] = 0;
+ if (c != BIGINT_INVALID) {
+ c->wds = 1;
+ c->x[0] = 0;
+ }
return c;
- }
+ }
if (i < 0) {
c = a;
a = b;
if (!value(d)) {
*decpt = 1;
result = Balloc(2);
- s0 = (char *)(void *)result;
- strcpy(s0, "0");
- if (rve)
+ if (result == BIGINT_INVALID)
+ return NULL;
+ s0 = (char *)(void *)result;
+ strcpy(s0, "0");
+ if (rve)
*rve = s0 + 1;
- return s0;
- }
+ return s0;
+ }
b = d2b(value(d), &be, &bbits);
#ifdef Sudden_Underflow
diff --cc libc/stdlib/wchar.c
Simple merge