[m-rev.] diff: fix GC_mercury_write_size_map
Peter Wang
novalazy at gmail.com
Tue Jul 12 10:52:40 AEST 2011
Branches: main, 11.07
Fix problems in GC_mercury_write_size_map identified by clang.
boehm_gc/misc.c:
Fix potential non-terminating loop due to unsigned variables.
Fix potentially mismatched format specifier.
diff --git a/boehm_gc/misc.c b/boehm_gc/misc.c
index 088ba83..a423195 100644
--- a/boehm_gc/misc.c
+++ b/boehm_gc/misc.c
@@ -1690,8 +1690,8 @@ GC_API int GC_CALL GC_get_force_unmap_on_gcollect(void)
GC_API void GC_CALL GC_mercury_write_size_map(FILE *fp)
{
- size_t bytes;
- size_t limit;
+ ssize_t bytes;
+ ssize_t limit;
for (limit = MAXOBJBYTES; limit >= 0; limit--) {
if (GC_size_map[limit] != 0) {
@@ -1700,6 +1700,6 @@ GC_API void GC_CALL GC_mercury_write_size_map(FILE *fp)
}
for (bytes = 1; bytes <= limit; bytes += BYTES_PER_WORD) {
- fprintf(fp, " %u", GRANULES_TO_WORDS(GC_size_map[bytes]));
+ fprintf(fp, " %d", (int)GRANULES_TO_WORDS(GC_size_map[bytes]));
}
}
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list