equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
31 #else |
31 #else |
32 void mtrace(char c, void* ptr, size_t size); |
32 void mtrace(char c, void* ptr, size_t size); |
33 #endif |
33 #endif |
34 |
34 |
35 // overflow management |
35 // overflow management |
36 #define OVERFLOW ((size_t)-1) |
36 #define OVERFLOW ((uint)-1) |
37 #define PSIZE_MAX (OVERFLOW/2) /* normal size limit */ |
37 #define PSIZE_MAX (OVERFLOW/2) /* normal size limit */ |
38 |
38 |
39 inline size_t scale_size(size_t size, size_t scale) { |
39 inline size_t scale_size(size_t size, size_t scale) { |
40 return (size > PSIZE_MAX / scale) ? OVERFLOW : size * scale; |
40 return (size > PSIZE_MAX / scale) ? OVERFLOW : size * scale; |
41 } |
41 } |