OLD | NEW |
1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
4 */ | 4 */ |
5 | 5 |
6 /* Helper functions/wrappers for memory allocations, manipulation and | 6 /* Helper functions/wrappers for memory allocations, manipulation and |
7 * comparison. | 7 * comparison. |
8 */ | 8 */ |
9 | 9 |
10 #ifndef VBOOT_REFERENCE_UTILITY_H_ | 10 #ifndef VBOOT_REFERENCE_UTILITY_H_ |
11 #define VBOOT_REFERENCE_UTILITY_H_ | 11 #define VBOOT_REFERENCE_UTILITY_H_ |
12 | 12 |
13 #include "sysincludes.h" | 13 #include "sysincludes.h" |
14 | 14 |
| 15 /* Debug and error output */ |
| 16 #ifdef VBOOT_DEBUG |
| 17 #define VBDEBUG(params) debug params |
| 18 #else |
| 19 #define VBDEBUG(params) |
| 20 #endif |
| 21 |
15 /* Outputs an error message and quits. */ | 22 /* Outputs an error message and quits. */ |
16 void error(const char *format, ...); | 23 void error(const char *format, ...); |
17 | 24 |
18 /* Outputs debug/warning messages. */ | 25 /* Outputs debug/warning messages. */ |
19 void debug(const char *format, ...); | 26 void debug(const char *format, ...); |
20 | 27 |
21 #define assert(expr) do { if (!(expr)) { \ | 28 #define assert(expr) do { if (!(expr)) { \ |
22 error("assert fail: %s at %s:%d\n", \ | 29 error("assert fail: %s at %s:%d\n", \ |
23 #expr, __FILE__, __LINE__); }} while(0) | 30 #expr, __FILE__, __LINE__); }} while(0) |
24 | 31 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 #ifndef _STUB_IMPLEMENTATION_ | 67 #ifndef _STUB_IMPLEMENTATION_ |
61 #define malloc _do_not_use_standard_malloc | 68 #define malloc _do_not_use_standard_malloc |
62 #define free _do_not_use_standard_free | 69 #define free _do_not_use_standard_free |
63 #define memcmp _do_not_use_standard_memcmp | 70 #define memcmp _do_not_use_standard_memcmp |
64 #define memcpy _do_not_use_standard_memcpy | 71 #define memcpy _do_not_use_standard_memcpy |
65 #define memset _do_not_use_standard_memset | 72 #define memset _do_not_use_standard_memset |
66 #endif | 73 #endif |
67 | 74 |
68 | 75 |
69 #endif /* VBOOT_REFERENCE_UTILITY_H_ */ | 76 #endif /* VBOOT_REFERENCE_UTILITY_H_ */ |
OLD | NEW |