Mercurial > emacs
comparison src/ralloc.c @ 10766:07eea2d610d3
Whitespace fixes.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 16 Feb 1995 06:36:19 +0000 |
parents | c6a68e4ee53a |
children | 2954efb1d06c |
comparison
equal
deleted
inserted
replaced
10765:638d2df80894 | 10766:07eea2d610d3 |
---|---|
1012 #include <assert.h> | 1012 #include <assert.h> |
1013 | 1013 |
1014 int | 1014 int |
1015 r_alloc_check () | 1015 r_alloc_check () |
1016 { | 1016 { |
1017 int found = 0; | 1017 int found = 0; |
1018 heap_ptr h, ph = 0; | 1018 heap_ptr h, ph = 0; |
1019 bloc_ptr b, pb = 0; | 1019 bloc_ptr b, pb = 0; |
1020 | 1020 |
1021 if (!r_alloc_initialized) | 1021 if (!r_alloc_initialized) |
1022 return; | 1022 return; |
1023 | 1023 |
1024 assert (first_heap); | 1024 assert (first_heap); |
1025 assert (last_heap->end <= (POINTER) sbrk (0)); | 1025 assert (last_heap->end <= (POINTER) sbrk (0)); |
1026 assert ((POINTER) first_heap < first_heap->start); | 1026 assert ((POINTER) first_heap < first_heap->start); |
1027 assert (first_heap->start <= virtual_break_value); | 1027 assert (first_heap->start <= virtual_break_value); |
1028 assert (virtual_break_value <= first_heap->end); | 1028 assert (virtual_break_value <= first_heap->end); |
1029 | 1029 |
1030 for (h = first_heap; h; h = h->next) | 1030 for (h = first_heap; h; h = h->next) |
1031 { | 1031 { |
1032 assert (h->prev == ph); | 1032 assert (h->prev == ph); |
1033 assert ((POINTER) ROUNDUP (h->end) == h->end); | 1033 assert ((POINTER) ROUNDUP (h->end) == h->end); |
1034 assert ((POINTER) MEM_ROUNDUP (h->start) == h->start); | 1034 assert ((POINTER) MEM_ROUNDUP (h->start) == h->start); |
1035 assert ((POINTER) MEM_ROUNDUP (h->bloc_start) == h->bloc_start); | 1035 assert ((POINTER) MEM_ROUNDUP (h->bloc_start) == h->bloc_start); |
1036 assert (h->start <= h->bloc_start && h->bloc_start <= h->end); | 1036 assert (h->start <= h->bloc_start && h->bloc_start <= h->end); |
1037 | 1037 |
1038 if (ph) | 1038 if (ph) |
1039 { | 1039 { |
1040 assert (ph->end < h->start); | 1040 assert (ph->end < h->start); |
1041 assert (h->start <= (POINTER)h && (POINTER)(h+1) <= h->bloc_start); | 1041 assert (h->start <= (POINTER)h && (POINTER)(h+1) <= h->bloc_start); |
1042 } | 1042 } |
1043 | 1043 |
1044 if (h->bloc_start <= break_value && break_value <= h->end) | 1044 if (h->bloc_start <= break_value && break_value <= h->end) |
1045 found = 1; | 1045 found = 1; |
1046 | 1046 |
1047 ph = h; | 1047 ph = h; |
1048 } | 1048 } |
1049 | 1049 |
1050 assert (found); | 1050 assert (found); |
1051 assert (last_heap == ph); | 1051 assert (last_heap == ph); |
1052 | 1052 |
1053 for (b = first_bloc; b; b = b->next) | 1053 for (b = first_bloc; b; b = b->next) |
1054 { | 1054 { |
1055 assert (b->prev == pb); | 1055 assert (b->prev == pb); |
1056 assert ((POINTER) MEM_ROUNDUP (b->data) == b->data); | 1056 assert ((POINTER) MEM_ROUNDUP (b->data) == b->data); |
1057 assert ((SIZE) MEM_ROUNDUP (b->size) == b->size); | 1057 assert ((SIZE) MEM_ROUNDUP (b->size) == b->size); |
1058 | 1058 |
1059 ph = 0; | 1059 ph = 0; |
1060 for (h = first_heap; h; h = h->next) | 1060 for (h = first_heap; h; h = h->next) |
1061 { | 1061 { |
1062 if (h->bloc_start <= b->data && b->data + b->size <= h->end) | 1062 if (h->bloc_start <= b->data && b->data + b->size <= h->end) |
1063 break; | 1063 break; |
1064 ph = h; | 1064 ph = h; |
1065 } | 1065 } |
1066 | 1066 |
1067 assert (h); | 1067 assert (h); |
1068 | 1068 |
1069 if (pb && pb->data + pb->size != b->data) | 1069 if (pb && pb->data + pb->size != b->data) |
1070 { | 1070 { |
1071 assert (ph && b->data == h->bloc_start); | 1071 assert (ph && b->data == h->bloc_start); |
1072 while (ph) | 1072 while (ph) |
1073 { | 1073 { |
1074 if (ph->bloc_start <= pb->data | 1074 if (ph->bloc_start <= pb->data |
1075 && pb->data + pb->size <= ph->end) | 1075 && pb->data + pb->size <= ph->end) |
1076 { | 1076 { |
1077 assert (pb->data + pb->size + b->size > ph->end); | 1077 assert (pb->data + pb->size + b->size > ph->end); |
1078 break; | 1078 break; |
1079 } | 1079 } |
1080 else | 1080 else |
1081 { | 1081 { |
1082 assert (ph->bloc_start + b->size > ph->end); | 1082 assert (ph->bloc_start + b->size > ph->end); |
1083 } | 1083 } |
1084 ph = ph->prev; | 1084 ph = ph->prev; |
1085 } | 1085 } |
1086 } | 1086 } |
1087 pb = b; | 1087 pb = b; |
1088 } | 1088 } |
1089 | 1089 |
1090 assert (last_bloc == pb); | 1090 assert (last_bloc == pb); |
1091 | 1091 |
1092 if (last_bloc) | 1092 if (last_bloc) |
1093 assert (last_bloc->data + last_bloc->size == break_value); | 1093 assert (last_bloc->data + last_bloc->size == break_value); |
1094 else | 1094 else |
1095 assert (first_heap->bloc_start == break_value); | 1095 assert (first_heap->bloc_start == break_value); |
1096 } | 1096 } |
1097 #endif /* DEBUG */ | 1097 #endif /* DEBUG */ |