Merge "x86 syscall system call implementation"
diff --git a/libc/bionic/malloc_leak.c b/libc/bionic/malloc_leak.c
index 305f954..ad1d2b4 100644
--- a/libc/bionic/malloc_leak.c
+++ b/libc/bionic/malloc_leak.c
@@ -665,8 +665,9 @@
     }
 
     if (new_buffer) {
-        size_t size = (bytes < old_bytes)?(bytes):(old_bytes);
-        memcpy(new_buffer, mem, size);
+        if (bytes > old_bytes)
+            bytes = old_bytes;
+        memcpy(new_buffer, mem, bytes);
         chk_free(mem);
     }
 
diff --git a/libc/bionic/ssp.c b/libc/bionic/ssp.c
index 20794f4..f83b2a4 100644
--- a/libc/bionic/ssp.c
+++ b/libc/bionic/ssp.c
@@ -76,9 +76,9 @@
     sigprocmask(SIG_BLOCK, &sigmask, NULL);
 
     /* Use /proc/self/exe link to obtain the program name for logging
-     * purposes. If it's not available, we set it to "unknown" */
+     * purposes. If it's not available, we set it to "<unknown>" */
     if ((count = readlink("/proc/self/exe", path, sizeof(path) - 1)) == -1) {
-        strlcpy(path, "unknown", sizeof(path));
+        strlcpy(path, "<unknown>", sizeof(path));
     } else {
         path[count] = '\0';
     }
diff --git a/libc/string/strcasecmp.c b/libc/string/strcasecmp.c
index 12f3a09..2be0913 100644
--- a/libc/string/strcasecmp.c
+++ b/libc/string/strcasecmp.c
@@ -98,8 +98,8 @@
 			if (cm[*us1] != cm[*us2++])
 				return (cm[*us1] - cm[*--us2]);
 			if (*us1++ == '\0')
-      break;
+				break;
 		} while (--n != 0);
-  }
+	}
 	return (0);
 }
diff --git a/libc/string/strchr.c b/libc/string/strchr.c
index e33694c..31ba4e2 100644
--- a/libc/string/strchr.c
+++ b/libc/string/strchr.c
@@ -38,6 +38,6 @@
 			return((char *)p);
 		if (!*p)
 			return((char *)NULL);
-  }
+	}
 	/* NOTREACHED */
 }
diff --git a/libc/string/strcoll.c b/libc/string/strcoll.c
index 365cad5..e3b1ec3 100755
--- a/libc/string/strcoll.c
+++ b/libc/string/strcoll.c
@@ -36,5 +36,5 @@
 int
 strcoll(const char *s1, const char *s2)
 {
-	return strcmp (s1, s2);
+	return strcmp(s1, s2);
 }
diff --git a/libc/string/strlcat.c b/libc/string/strlcat.c
index ad2215b..ceab094 100644
--- a/libc/string/strlcat.c
+++ b/libc/string/strlcat.c
@@ -46,9 +46,9 @@
 		if (n != 1) {
 			*d++ = *s;
 			n--;
-  }
+		}
 		s++;
-  }
+	}
 	*d = '\0';
 
 	return(dlen + (s - src));	/* count does not include NUL */
diff --git a/libc/string/strlcpy.c b/libc/string/strlcpy.c
index 38277eb..d32b659 100644
--- a/libc/string/strlcpy.c
+++ b/libc/string/strlcpy.c
@@ -37,7 +37,7 @@
 			if ((*d++ = *s++) == '\0')
 				break;
 		}
-  }
+	}
 
 	/* Not enough room in dst, add NUL and traverse rest of src */
 	if (n == 0) {
diff --git a/libc/string/strncat.c b/libc/string/strncat.c
index 1cb9405..c4df4f2 100644
--- a/libc/string/strncat.c
+++ b/libc/string/strncat.c
@@ -52,6 +52,6 @@
 			d++;
 		} while (--n != 0);
 		*d = 0;
-  }
+	}
 	return (dst);
 }
diff --git a/libc/string/strncmp.c b/libc/string/strncmp.c
index 9da41ab..1768808 100644
--- a/libc/string/strncmp.c
+++ b/libc/string/strncmp.c
@@ -38,14 +38,13 @@
 int
 strncmp(const char *s1, const char *s2, size_t n)
 {
-
 	if (n == 0)
 		return (0);
 	do {
 		if (*s1 != *s2++)
 			return (*(unsigned char *)s1 - *(unsigned char *)--s2);
 		if (*s1++ == 0)
-      break;
+			break;
 	} while (--n != 0);
 	return (0);
 }
diff --git a/libc/string/strncpy.c b/libc/string/strncpy.c
index b91091b..4426cbe 100644
--- a/libc/string/strncpy.c
+++ b/libc/string/strncpy.c
@@ -54,8 +54,8 @@
 				/* NUL pad the remaining n-1 bytes */
 				while (--n != 0)
 					*d++ = 0;
-      break;
-  }
+				break;
+			}
 		} while (--n != 0);
 	}
 	return (dst);
diff --git a/libc/string/strpbrk.c b/libc/string/strpbrk.c
index 6ba3796..cd3b71c 100644
--- a/libc/string/strpbrk.c
+++ b/libc/string/strpbrk.c
@@ -38,7 +38,7 @@
 {
 	const char *scanp;
 	int c, sc;
-  
+
 	while ((c = *s1++) != 0) {
 		for (scanp = s2; (sc = *scanp++) != 0;)
 			if (sc == c)
diff --git a/libc/string/strrchr.c b/libc/string/strrchr.c
index 2800781..4918f82 100644
--- a/libc/string/strrchr.c
+++ b/libc/string/strrchr.c
@@ -34,12 +34,12 @@
 strrchr(const char *p, int ch)
 {
 	char *save;
-  
+
 	for (save = NULL;; ++p) {
 		if (*p == ch)
 			save = (char *)p;
 		if (!*p)
 			return(save);
-  }
+	}
 	/* NOTREACHED */
 }
diff --git a/libc/string/strsep.c b/libc/string/strsep.c
index bcca681..c44bc5b 100644
--- a/libc/string/strsep.c
+++ b/libc/string/strsep.c
@@ -34,7 +34,7 @@
 
 /*
  * Get next token from string *stringp, where tokens are possibly-empty
- * strings separated by characters from delim.  
+ * strings separated by characters from delim.
  *
  * Writes NULs into the string at *stringp to end tokens.
  * delim need not remain constant from call to call.
diff --git a/libc/string/strstr.c b/libc/string/strstr.c
index debe96c..95a865b 100644
--- a/libc/string/strstr.c
+++ b/libc/string/strstr.c
@@ -51,6 +51,6 @@
 			} while (sc != c);
 		} while (strncmp(s, find, len) != 0);
 		s--;
-    }
+	}
 	return ((char *)s);
 }
diff --git a/libc/string/strxfrm.c b/libc/string/strxfrm.c
index f1843b5..3c4d707 100755
--- a/libc/string/strxfrm.c
+++ b/libc/string/strxfrm.c
@@ -29,7 +29,7 @@
 
 /*
  * Transform string s2 to string s1 using the current locale so that
- * strcmp of transformed strings yields the same result as strcoll. 
+ * strcmp of transformed strings yields the same result as strcoll.
  * Since Bionic really does not support locales, we assume we always use
  * the C locale.
  *
diff --git a/libc/unistd/pread.c b/libc/unistd/pread.c
index d2f71f7..b55623e 100644
--- a/libc/unistd/pread.c
+++ b/libc/unistd/pread.c
@@ -25,10 +25,10 @@
 #include <sys/types.h>
 #include <unistd.h>
 
-extern int __pread64(int fd, void *buf, size_t nbytes, off_t lo, off_t hi);
+extern int __pread64(int fd, void *buf, size_t nbytes, loff_t offset);
 
 ssize_t pread(int fd, void *buf, size_t nbytes, off_t offset)
 {
-    return __pread64(fd, buf, nbytes, offset, 0);
+    return __pread64(fd, buf, nbytes, offset);
 }
 
diff --git a/libc/unistd/pwrite.c b/libc/unistd/pwrite.c
index 5adf40a..ea080d2 100644
--- a/libc/unistd/pwrite.c
+++ b/libc/unistd/pwrite.c
@@ -28,10 +28,10 @@
 #include <sys/types.h>
 #include <unistd.h>
 
-extern int __pwrite64(int fd, void *buf, size_t nbytes, off_t lo, off_t hi);
+extern int __pwrite64(int fd, void *buf, size_t nbytes, loff_t offset);
 
 ssize_t pwrite(int fd, void *buf, size_t nbytes, off_t offset)
 {
-    return __pwrite64(fd, buf, nbytes, offset, 0);
+    return __pwrite64(fd, buf, nbytes, offset);
 }
 
diff --git a/libstdc++/src/new.cpp b/libstdc++/src/new.cpp
index 8189159..a9c92d4 100644
--- a/libstdc++/src/new.cpp
+++ b/libstdc++/src/new.cpp
@@ -23,16 +23,12 @@
 
 void  operator delete(void* ptr)
 {
-    if (ptr) {
-        free(ptr);
-    }
+    free(ptr);
 }
 
 void  operator delete[](void* ptr)
 {
-    if (ptr) {
-        free(ptr);
-    }
+    free(ptr);
 }
 
 void* operator new(std::size_t size, const std::nothrow_t&)
@@ -47,16 +43,12 @@
 
 void  operator delete(void* ptr, const std::nothrow_t&)
 {
-    if (ptr) {
-        free(ptr);
-    }
+    free(ptr);
 }
 
 void  operator delete[](void* ptr, const std::nothrow_t&)
 {
-    if (ptr) {
-        free(ptr);
-    }
+    free(ptr);
 }