mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-04 07:40:42 +00:00
Bug 851981: Make loop iterator in mozalloc_handle_oom a size_t instead of an int, to fix build warning for signed/unsigned comparison. r=bsmedberg
This commit is contained in:
parent
9f022df7cf
commit
513bfe54a9
@ -11,6 +11,7 @@
|
||||
|
||||
#include "mozilla/mozalloc_abort.h"
|
||||
#include "mozilla/mozalloc_oom.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
|
||||
static mozalloc_oom_abort_handler gAbortHandler;
|
||||
|
||||
@ -27,7 +28,7 @@ void
|
||||
mozalloc_handle_oom(size_t size)
|
||||
{
|
||||
char oomMsg[] = OOM_MSG_LEADER OOM_MSG_DIGITS OOM_MSG_TRAILER;
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
// NB: this is handle_oom() stage 1, which simply aborts on OOM.
|
||||
// we might proceed to a stage 2 in which an attempt is made to
|
||||
@ -36,6 +37,9 @@ mozalloc_handle_oom(size_t size)
|
||||
if (gAbortHandler)
|
||||
gAbortHandler(size);
|
||||
|
||||
MOZ_STATIC_ASSERT(OOM_MSG_FIRST_DIGIT_OFFSET > 0,
|
||||
"Loop below will never terminate (i can't go below 0)");
|
||||
|
||||
// Insert size into the diagnostic message using only primitive operations
|
||||
for (i = OOM_MSG_LAST_DIGIT_OFFSET;
|
||||
size && i >= OOM_MSG_FIRST_DIGIT_OFFSET; i--) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user