author | David Turner <digit@android.com> | |
Mon, 29 Mar 2010 22:05:47 +0000 (15:05 -0700) | ||
committer | Android Code Review <code-review@android.com> | |
Mon, 29 Mar 2010 22:05:47 +0000 (15:05 -0700) |
* changes:
Correct generic memset implementation
Generic memcpy should define MEMCOPY before including bcopy.c
Correct generic memset implementation
Generic memcpy should define MEMCOPY before including bcopy.c
libc/string/memcpy.c | patch | blob | history | |
libc/string/memset.c | patch | blob | history |
diff --git a/libc/string/memcpy.c b/libc/string/memcpy.c
index 4cd4a80757bf2ab614eb6e68a4f032c3ec82df04..dea78b2d9189baab959e19cab58daf81867b38fd 100644 (file)
--- a/libc/string/memcpy.c
+++ b/libc/string/memcpy.c
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#define MEM_COPY
+#define MEMCOPY
#include "bcopy.c"
diff --git a/libc/string/memset.c b/libc/string/memset.c
index ed9cdd7c8e7708396a88ac9432502563ea80702d..41dafb289b29b317d6ad16fd2393bec2b421cdf5 100644 (file)
--- a/libc/string/memset.c
+++ b/libc/string/memset.c
char* end = q + n;
for (;;) {
- if (q < end) break; *q++ = (char) c;
- if (q < end) break; *q++ = (char) c;
- if (q < end) break; *q++ = (char) c;
- if (q < end) break; *q++ = (char) c;
+ if (q >= end) break; *q++ = (char) c;
+ if (q >= end) break; *q++ = (char) c;
+ if (q >= end) break; *q++ = (char) c;
+ if (q >= end) break; *q++ = (char) c;
}
return dst;