diff --git a/libbb/arith.c b/libbb/arith.c
index d79501c..3e10712 100644
--- a/libbb/arith.c
+++ b/libbb/arith.c
@@ -140,8 +140,7 @@
 #define TOK_REM tok_decl(10,2)
 
 /* For now all unary operators have the same precedence, and that's used to
- * identify them as unary operators
- */
+ * identify them as unary operators */
 #define UNARYPREC 14
 #define TOK_BNOT tok_decl(UNARYPREC,0)
 #define TOK_NOT tok_decl(UNARYPREC,1)
@@ -157,82 +156,68 @@
 
 /* "applying" a token means performing it on the top elements on the integer
  * stack. For a unary operator it will only change the top element, but a
- * binary operator will pop two arguments and push a result
- */
+ * binary operator will pop two arguments and push a result */
 static short arith_apply(operator    op, long *numstack, long **numstackptr)
 {
 	long numptr_val;
 	long *NUMPTR_M1;
 
-	/* There is no operator that can work without arguments */
-	if (NUMPTR == numstack) {
-		goto err;
-	}
-
+	if (NUMPTR == numstack) goto err; /* There is no operator that can work
+										 without arguments */
 	NUMPTR_M1 = NUMPTR - 1;
-	if (op == TOK_UMINUS) {
+	if (op == TOK_UMINUS)
 		*NUMPTR_M1 *= -1;
-	} else if (op == TOK_NOT) {
+	else if (op == TOK_NOT)
 		*NUMPTR_M1 = !(*NUMPTR_M1);
-	} else if (op == TOK_BNOT) {
+	else if (op == TOK_BNOT)
 		*NUMPTR_M1 = ~(*NUMPTR_M1);
-	} else if (op != TOK_UPLUS) {
+	else if (op != TOK_UPLUS) {
 		/* Binary operators */
-
-		/* ... and binary operators need two arguments */
-		if (NUMPTR_M1 == numstack) {
-			goto err;
-		}
-		/* ... and they pop one */
-		numptr_val = *--NUMPTR;
-
+	if (NUMPTR_M1 == numstack) goto err; /* ... and binary operators need two
+										   arguments */
+	numptr_val = *--NUMPTR;         /* ... and they pop one */
 		NUMPTR_M1 = NUMPTR - 1;
-
-		if (op == TOK_BOR) {
+	if (op == TOK_BOR)
 			*NUMPTR_M1 |= numptr_val;
-		} else if (op == TOK_OR) {
+	else if (op == TOK_OR)
 			*NUMPTR_M1 = numptr_val || *NUMPTR_M1;
-		} else if (op == TOK_BAND) {
+	else if (op == TOK_BAND)
 			*NUMPTR_M1 &= numptr_val;
-		} else if (op == TOK_AND) {
+	else if (op == TOK_AND)
 			*NUMPTR_M1 = *NUMPTR_M1 && numptr_val;
-		} else if (op == TOK_EQ) {
+	else if (op == TOK_EQ)
 			*NUMPTR_M1 = (*NUMPTR_M1 == numptr_val);
-		} else if (op == TOK_NE) {
+	else if (op == TOK_NE)
 			*NUMPTR_M1 = (*NUMPTR_M1 != numptr_val);
-		} else if (op == TOK_GE) {
+	else if (op == TOK_GE)
 			*NUMPTR_M1 = (*NUMPTR_M1 >= numptr_val);
-		} else if (op == TOK_RSHIFT) {
+	else if (op == TOK_RSHIFT)
 			*NUMPTR_M1 >>= numptr_val;
-		} else if (op == TOK_LSHIFT) {
+	else if (op == TOK_LSHIFT)
 			*NUMPTR_M1 <<= numptr_val;
-		} else if (op == TOK_GT) {
+	else if (op == TOK_GT)
 			*NUMPTR_M1 = (*NUMPTR_M1 > numptr_val);
-		} else if (op == TOK_LT) {
+	else if (op == TOK_LT)
 			*NUMPTR_M1 = (*NUMPTR_M1 < numptr_val);
-		} else if (op == TOK_LE) {
+	else if (op == TOK_LE)
 			*NUMPTR_M1 = (*NUMPTR_M1 <= numptr_val);
-		} else if (op == TOK_MUL) {
+	else if (op == TOK_MUL)
 			*NUMPTR_M1 *= numptr_val;
-		} else if (op == TOK_ADD) {
+	else if (op == TOK_ADD)
 			*NUMPTR_M1 += numptr_val;
-		} else if (op == TOK_SUB) {
+	else if (op == TOK_SUB)
 			*NUMPTR_M1 -= numptr_val;
-		}
-		/* zero divisor check */
-		else if (numptr_val == 0) {
+	else if(numptr_val==0)          /* zero divisor check */
 			return -2;
-		} else if (op == TOK_DIV) {
+	else if (op == TOK_DIV)
 			*NUMPTR_M1 /= numptr_val;
-		} else if (op == TOK_REM) {
+	else if (op == TOK_REM)
 			*NUMPTR_M1 %= numptr_val;
-		}
 		/* WARNING!!!  WARNING!!!  WARNING!!! */
 		/* Any new operators should be added BEFORE the zero divisor check! */
 	}
 	return 0;
-  err:
-	return (-1);
+err: return(-1);
 }
 
 static const char endexpression[] = ")";
@@ -242,7 +227,7 @@
 static const char op_token[] = {
 	/* paired with equal */
 	TOK_NE, TOK_LE, TOK_GE,
-	/* paired with self -- note: ! is special-cased below */
+	/* paired with self -- note: ! is special-cased below*/
 	TOK_ERROR, TOK_LSHIFT, TOK_RSHIFT, TOK_EQ, TOK_OR, TOK_AND,
 	/* singles */
 	TOK_NOT, TOK_LT, TOK_GT, TOK_ERROR, TOK_BOR, TOK_BAND,
@@ -253,33 +238,34 @@
 #define NUM_PAIR_EQUAL  3
 #define NUM_PAIR_SAME   6
 
-extern long arith(const char *expr, int *errcode)
+extern long arith (const char *expr, int *errcode)
 {
 	register char arithval;	/* Current character under analysis */
 	operator    lasttok, op;
 	unsigned char prec;
+
 	const char *p = endexpression;
-	size_t datasizes = strlen(expr);
+
+	size_t datasizes = strlen(expr) + 2;
 
 	/* Stack of integers */
 	/* The proof that there can be no more than strlen(startbuf)/2+1 integers
 	 * in any given correct or incorrect expression is left as an excersize to
 	 * the reader. */
-	long *numstack = alloca(((datasizes + 1) / 2) * sizeof(long));
-	long *numstackptr = numstack;
-
+	long *numstack = alloca(((datasizes)/2)*sizeof(long)),
+		*numstackptr = numstack;
 	/* Stack of operator tokens */
-	operator * stack = alloca((datasizes + 1) * sizeof(operator));
-	operator * stackptr = stack;
+	operator *stack = alloca((datasizes) * sizeof(operator)),
+		*stackptr = stack;
 
-	/* start off with a left paren */
-	*stackptr++ = lasttok = TOK_LPAREN;
+	*numstack = 0;
+	*stackptr++ = lasttok = TOK_LPAREN;     /* start off with a left paren */
 
   loop:
 	if ((arithval = *expr) == 0) {
-		/* Null expression. */
-		if (p == endexpression) {
-			return (*errcode = 0);
+		if (p == endexpression) { /* Null expression. */
+			*errcode = 0;
+			return *numstack;
 		}
 
 		/* This is only reached after all tokens have been extracted from the
@@ -292,7 +278,7 @@
 			goto loop;	/* and let the loop process it. */
 		}
 		/* At this point, we're done with the expression. */
-		if (numstackptr != numstack + 1) {	/* ... but if there isn't, it's bad */
+		if (numstackptr != numstack+1) {/* ... but if there isn't, it's bad */
 		  err:
 			return (*errcode = -1);
 			/* NOTREACHED */
@@ -300,12 +286,10 @@
 		return *numstack;
 	} else {
 		/* Continue processing the expression.  */
-		/* Skip whitespace */
 		if (isspace(arithval)) {
-			goto prologue;
+			goto prologue;          /* Skip whitespace */
 		}
-		/* isdigit ? */
-		if ((unsigned) arithval - '0' <= 9) {
+		if ((unsigned)arithval-'0' <= 9) /* isdigit */ {
 			*numstackptr++ = strtol(expr, (char **) &expr, 10);
 			lasttok = TOK_NUM;
 			goto loop;
@@ -315,21 +299,20 @@
 			goto err;
 		}
 #else
-		for (p = op_char; *p != arithval; p++) {
+	    for ( p=op_char ; *p != arithval ; p++ ) {
 			if (!*p) {
 				goto err;
 			}
 		}
 #endif
-		p = op_token + (int) (p - op_char);
+		p = op_token + (int)(p - op_char);
 		++expr;
 		if ((p >= op_token + NUM_PAIR_EQUAL) || (*expr != '=')) {
 			p += NUM_PAIR_EQUAL;
 			if ((p >= op_token + NUM_PAIR_SAME + NUM_PAIR_EQUAL)
 				|| (*expr != arithval) || (arithval == '!')) {
 				--expr;
-				/* single = */
-				if (arithval == '=') {
+				if (arithval == '=') { /* single = */
 					goto err;
 				}
 				p += NUM_PAIR_SAME;
@@ -338,11 +321,9 @@
 				 * a number, since it evaluates to one). Think about it.
 				 * It makes sense. */
 				if ((lasttok != TOK_NUM)
-					&& (p >=
-						(op_token + NUM_PAIR_SAME + NUM_PAIR_EQUAL +
-						 sizeof(op_char) - 2))) {
-					/* Unary plus or minus */
-					p += 2;
+					&& (p >= op_token + NUM_PAIR_SAME + NUM_PAIR_EQUAL
+						+ sizeof(op_char) - 2)) {
+					p += 2; /* Unary plus or minus */
 				}
 			}
 		}
@@ -358,11 +339,8 @@
 		/* Left paren is given the lowest priority so it will never be
 		 * "applied" in this way */
 		prec = PREC(op);
-
-		/* not left paren or unary */
-		if ((prec > 0) && (prec != UNARYPREC)) {
-			/* binary op must be preceded by a num */
-			if (lasttok != TOK_NUM) {
+		if ((prec > 0) && (prec != UNARYPREC)) { /* not left paren or unary */
+			if (lasttok != TOK_NUM) { /* binary op must be preceded by a num */
 				goto err;
 			}
 			while (stackptr != stack) {
@@ -372,10 +350,7 @@
 					 * tokens and apply them */
 					if (stackptr[-1] == TOK_LPAREN) {
 						--stackptr;
-
-						/* Any operator directly after a */
-						lasttok = TOK_NUM;
-
+						lasttok = TOK_NUM; /* Any operator directly after a */
 						/* close paren should consider itself binary */
 						goto prologue;
 					}
@@ -383,9 +358,7 @@
 					break;
 				}
 				*errcode = ARITH_APPLY(*--stackptr);
-				if (*errcode) {
-					return *errcode;
-				}
+				if(*errcode) return *errcode;
 			}
 			if (op == TOK_RPAREN) {
 				goto err;
diff --git a/libbb/bb_asprintf.c b/libbb/bb_asprintf.c
index c0c5cde..9a71be7 100644
--- a/libbb/bb_asprintf.c
+++ b/libbb/bb_asprintf.c
@@ -7,83 +7,15 @@
 #include <stdarg.h>
 
 
-#ifdef TEST
-extern void *xrealloc(void *p, size_t size);
-#else
-#include "libbb.h"      /* busybox source */
-#endif
+#include "libbb.h"
 
 
-/* Exchange glibc vasprintf - minimize allocate memory version */
-/* libc5 and uclibc have not vasprintf function */
-void bb_vasprintf(char **string_ptr, const char *format, va_list args)
-{
-       int   bs = 128;
-       char  stack_buff[128];
-       char *buff = stack_buff;
-       int   done;
-
-       /* two or more loop, first - calculate memory size only */
-       while(1) {
-               done = vsnprintf (buff, bs, format, args);
-/* Different libc have different interpretation vsnprintf returned value */
-               if(done >= 0) {
-                       if(done < bs && buff != stack_buff) {
-                               /* allocated */
-                               *string_ptr = buff;
-                               return;
-                       } else {
-                               /* true calculate memory size */
-                               bs = done+1;
-                       }
-               } else {
-                       /*
-                        * Old libc. Incrementaly test.
-                        * Exact not minimize allocate memory.
-                        */
-                       bs += 128;
-               }
-               buff = xrealloc((buff == stack_buff ? NULL : buff), bs);
-       }
-}
-
 void bb_asprintf(char **string_ptr, const char *format, ...)
 {
        va_list p;
 
        va_start(p, format);
-       bb_vasprintf(string_ptr, format, p);
+       if(vasprintf(string_ptr, format, p)<0)
+		error_msg_and_die(memory_exhausted);
        va_end(p);
 }
-
-#ifdef TEST
-int main(int argc, char **argv)
-{
-       char *out_buf;
-       char big_buf[200];
-       int i;
-
-       bb_asprintf(&out_buf, "Hi!\nargc=%d argv[0]=%s\n", argc, argv[0]);
-       printf(out_buf);
-       free(out_buf);
-
-       for(i=0; i < sizeof(big_buf)-1; i++)
-               big_buf[i]='x';
-       big_buf[i]=0;
-       bb_asprintf(&out_buf, "Test Big\n%s\n", big_buf);
-       printf(out_buf);
-       free(out_buf);
-
-       return 0;
-}
-
-void *xrealloc(void *p, size_t size)
-{
-       void *p2 = realloc(p, size);
-       if(p2==0) {
-               fprintf(stderr, "TEST: memory_exhausted\n");
-               exit(1);
-       }
-       return p2;
-}
-#endif
