Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(635)

Unified Diff: third_party/minicrt/memory.cc

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/minicrt/memory.h ('k') | third_party/minicrt/misc.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/minicrt/memory.cc
diff --git a/third_party/minicrt/memory.cc b/third_party/minicrt/memory.cc
deleted file mode 100644
index 5509bcd7153997102a4ea393dd2de6aa0d636d03..0000000000000000000000000000000000000000
--- a/third_party/minicrt/memory.cc
+++ /dev/null
@@ -1,100 +0,0 @@
-
-#include "libctiny.h"
-#include <windows.h>
-#include <errno.h>
-#include "memory.h"
-
-// memmove is defined first so it will use the intrinsic memcpy
-void * __cdecl memmove(void * dst, const void * src, size_t count) {
- void * ret = dst;
-
- if (dst <= src || (char *)dst >= ((char *)src + count)) {
- // Non-Overlapping Buffers - copy from lower addresses to higher addresses
- // saves 500 bytes of 1.4MB in uncompressed setup.exe, worth it?
- memcpy(dst, src, count);
- // while (count--) {
- // *(char *)dst = *(char *)src;
- // dst = (char *)dst + 1;
- // src = (char *)src + 1;
- // }
- }
- else {
- // Overlapping Buffers - copy from higher addresses to lower addresses
- dst = (char *)dst + count - 1;
- src = (char *)src + count - 1;
-
- while (count--) {
- *(char *)dst = *(char *)src;
- dst = (char *)dst - 1;
- src = (char *)src - 1;
- }
- }
-
- return(ret);
-}
-
-// Turn off compiler intrinsics so that we can define these functions
-#pragma function(memcmp, memcpy, memset)
-
-int __cdecl memcmp(const void * buf1, const void * buf2, size_t count) {
- if (!count)
- return(0);
- while (--count && *(char *)buf1 == *(char *)buf2) {
- buf1 = (char *)buf1 + 1;
- buf2 = (char *)buf2 + 1;
- }
- return( *((unsigned char *)buf1) - *((unsigned char *)buf2) );
-}
-
-void * __cdecl memcpy(void * dst, const void * src, size_t count) {
- void * ret = dst;
- // copy from lower addresses to higher addresses
- while (count--) {
- *(char *)dst = *(char *)src;
- dst = (char *)dst + 1;
- src = (char *)src + 1;
- }
- return(ret);
-}
-
-void * __cdecl memset(void *dst, int val, size_t count) {
- void *start = dst;
- while (count--) {
- *(char *)dst = (char)val;
- dst = (char *)dst + 1;
- }
- return(start);
-}
-
-errno_t __cdecl memmove_s(void* dst,
- size_t size_in_bytes,
- const void* src,
- size_t count) {
- if (count == 0) {
- return 0;
- }
-
- if (!dst) return EINVAL;
- if (!src) return EINVAL;
- if (size_in_bytes < count) return ERANGE;
-
- memmove(dst, src, count);
- return 0;
-}
-
-errno_t __cdecl memcpy_s(void *dst,
- size_t size_in_bytes,
- const void *src,
- size_t count) {
- if (count == 0) {
- return 0;
- }
-
- if (!dst) return EINVAL;
- if (!src) return EINVAL;
- if (size_in_bytes < count) return ERANGE;
-
- memcpy(dst, src, count);
- return 0;
-}
-
« no previous file with comments | « third_party/minicrt/memory.h ('k') | third_party/minicrt/misc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698