/* Printf formatting for source code locations. */
#define SOURCE_LOCATION_FORMAT "%s:%u"
-/* Calculates the number of elements in an array. */
-#define ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0]))
-
/*
* Declare and initialize the pointer member of ValuePointer variable name
* with ptr.
/* Default signal functions that should be restored after a test is complete. */
typedef void (*SignalFunction)(int signal);
static SignalFunction default_signal_functions[
- ARRAY_LENGTH(exception_signals)];
+ ARRAY_SIZE(exception_signals)];
#else /* _WIN32 */
{
char *guards[2] = {block - MALLOC_GUARD_SIZE,
block + block_info->size};
- for (i = 0; i < ARRAY_LENGTH(guards); i++) {
+ for (i = 0; i < ARRAY_SIZE(guards); i++) {
unsigned int j;
char * const guard = guards[i];
for (j = 0; j < MALLOC_GUARD_SIZE; j++) {
exception_pointers->ExceptionRecord;
const DWORD code = exception_record->ExceptionCode;
unsigned int i;
- for (i = 0; i < ARRAY_LENGTH(exception_codes); i++) {
+ for (i = 0; i < ARRAY_SIZE(exception_codes); i++) {
const ExceptionCodeInfo * const code_info = &exception_codes[i];
if (code == code_info->code) {
static int shown_debug_message = 0;
if (handle_exceptions) {
#ifndef _WIN32
unsigned int i;
- for (i = 0; i < ARRAY_LENGTH(exception_signals); i++) {
+ for (i = 0; i < ARRAY_SIZE(exception_signals); i++) {
default_signal_functions[i] = signal(
exception_signals[i], exception_handler);
}
if (handle_exceptions) {
#ifndef _WIN32
unsigned int i;
- for (i = 0; i < ARRAY_LENGTH(exception_signals); i++) {
+ for (i = 0; i < ARRAY_SIZE(exception_signals); i++) {
signal(exception_signals[i], default_signal_functions[i]);
}
#else /* _WIN32 */