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

Side by Side Diff: third_party/tcmalloc/vendor/src/windows/port.h

Issue 9316021: Update the tcmalloc vendor branch to r144 (gperftools 2.0). (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Reuploading Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* Copyright (c) 2007, Google Inc. 1 /* Copyright (c) 2007, Google Inc.
2 * All rights reserved. 2 * All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #include <process.h> /* for _getpid */ 58 #include <process.h> /* for _getpid */
59 #include <limits.h> /* for PATH_MAX */ 59 #include <limits.h> /* for PATH_MAX */
60 #include <stdarg.h> /* for va_list */ 60 #include <stdarg.h> /* for va_list */
61 #include <stdio.h> /* need this to override stdio's (v)snprintf */ 61 #include <stdio.h> /* need this to override stdio's (v)snprintf */
62 #include <sys/types.h> /* for _off_t */ 62 #include <sys/types.h> /* for _off_t */
63 #include <assert.h> 63 #include <assert.h>
64 #include <stdlib.h> /* for rand, srand, _strtoxxx */ 64 #include <stdlib.h> /* for rand, srand, _strtoxxx */
65 65
66 /* 66 /*
67 * 4018: signed/unsigned mismatch is common (and ok for signed_i < unsigned_i) 67 * 4018: signed/unsigned mismatch is common (and ok for signed_i < unsigned_i)
68 * 4244: otherwise we get problems when substracting two size_t's to an int 68 * 4244: otherwise we get problems when subtracting two size_t's to an int
69 * 4288: VC++7 gets confused when a var is defined in a loop and then after it 69 * 4288: VC++7 gets confused when a var is defined in a loop and then after it
70 * 4267: too many false positives for "conversion gives possible data loss" 70 * 4267: too many false positives for "conversion gives possible data loss"
71 * 4290: it's ok windows ignores the "throw" directive 71 * 4290: it's ok windows ignores the "throw" directive
72 * 4996: Yes, we're ok using "unsafe" functions like vsnprintf and getenv() 72 * 4996: Yes, we're ok using "unsafe" functions like vsnprintf and getenv()
73 * 4146: internal_logging.cc intentionally negates an unsigned value
73 */ 74 */
74 #ifdef _MSC_VER 75 #ifdef _MSC_VER
75 #pragma warning(disable:4018 4244 4288 4267 4290 4996) 76 #pragma warning(disable:4018 4244 4288 4267 4290 4996 4146)
76 #endif 77 #endif
77 78
78 #ifndef __cplusplus 79 #ifndef __cplusplus
79 /* MSVC does not support C99 */ 80 /* MSVC does not support C99 */
80 # if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L 81 # if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L
81 # ifdef _MSC_VER 82 # ifdef _MSC_VER
82 # define inline __inline 83 # define inline __inline
83 # else 84 # else
84 # define inline static 85 # define inline static
85 # endif 86 # endif
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 408
408 /* ----------------------------------- OTHER */ 409 /* ----------------------------------- OTHER */
409 410
410 inline void srandom(unsigned int seed) { srand(seed); } 411 inline void srandom(unsigned int seed) { srand(seed); }
411 inline long random(void) { return rand(); } 412 inline long random(void) { return rand(); }
412 inline unsigned int sleep(unsigned int seconds) { 413 inline unsigned int sleep(unsigned int seconds) {
413 Sleep(seconds * 1000); 414 Sleep(seconds * 1000);
414 return 0; 415 return 0;
415 } 416 }
416 417
418 // mingw64 seems to define timespec (though mingw.org mingw doesn't),
419 // protected by the _TIMESPEC_DEFINED macro.
420 #ifndef _TIMESPEC_DEFINED
417 struct timespec { 421 struct timespec {
418 int tv_sec; 422 int tv_sec;
419 int tv_nsec; 423 int tv_nsec;
420 }; 424 };
425 #endif
421 426
422 inline int nanosleep(const struct timespec *req, struct timespec *rem) { 427 inline int nanosleep(const struct timespec *req, struct timespec *rem) {
423 Sleep(req->tv_sec * 1000 + req->tv_nsec / 1000000); 428 Sleep(req->tv_sec * 1000 + req->tv_nsec / 1000000);
424 return 0; 429 return 0;
425 } 430 }
426 431
427 #ifndef __MINGW32__ 432 #ifndef __MINGW32__
428 inline long long int strtoll(const char *nptr, char **endptr, int base) { 433 inline long long int strtoll(const char *nptr, char **endptr, int base) {
429 return _strtoi64(nptr, endptr, base); 434 return _strtoi64(nptr, endptr, base);
430 } 435 }
(...skipping 29 matching lines...) Expand all
460 */ 465 */
461 #define GOOGLE_MAYBE_THREADS_H_ 1 466 #define GOOGLE_MAYBE_THREADS_H_ 1
462 467
463 468
464 #endif /* _WIN32 */ 469 #endif /* _WIN32 */
465 470
466 #undef inline 471 #undef inline
467 #undef EXTERN_C 472 #undef EXTERN_C
468 473
469 #endif /* GOOGLE_BASE_WINDOWS_H_ */ 474 #endif /* GOOGLE_BASE_WINDOWS_H_ */
OLDNEW
« no previous file with comments | « third_party/tcmalloc/vendor/src/windows/patch_functions.cc ('k') | third_party/tcmalloc/vendor/src/windows/preamble_patcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698