summaryrefslogtreecommitdiff
path: root/malloc.c
diff options
context:
space:
mode:
authorRobin Barker <RMBarker@cpan.org>1999-09-07 13:30:18 +0100
committerJarkko Hietaniemi <jhi@iki.fi>1999-09-07 12:49:15 +0000
commit427181846486e3aa5034a647dc1922377185f4c0 (patch)
tree77214104959f745247da88a35a1ff858eede7f44 /malloc.c
parentf8d4b9aa3df7268ea9f1bdecfb17864f5f71ae93 (diff)
downloadperl-427181846486e3aa5034a647dc1922377185f4c0.tar.gz
Fix pointer casts.
To: perl5-porters@perl.org Subject: [ID 19990907.004] [PATCH perl5.005_61] compiler warnings with -Duse64bits Message-Id: <199909071130.MAA11435@tempest.npl.co.uk> p4raw-id: //depot/cfgperl@4100
Diffstat (limited to 'malloc.c')
-rw-r--r--malloc.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/malloc.c b/malloc.c
index a3344ae2cf..908d7a7d85 100644
--- a/malloc.c
+++ b/malloc.c
@@ -516,9 +516,9 @@ static u_short buck_size[MAX_BUCKET_BY_TABLE + 1] =
# define MAX_PACKED (MAX_PACKED_POW2 * BUCKETS_PER_POW2 + BUCKET_POW2_SHIFT)
# define MAX_POW2_ALGO ((1<<(MAX_PACKED_POW2 + 1)) - M_OVERHEAD)
# define TWOK_MASK ((1<<LOG_OF_MIN_ARENA) - 1)
-# define TWOK_MASKED(x) ((u_bigint)(x) & ~TWOK_MASK)
-# define TWOK_SHIFT(x) ((u_bigint)(x) & TWOK_MASK)
-# define OV_INDEXp(block) ((u_char*)(TWOK_MASKED(block)))
+# define TWOK_MASKED(x) ((u_bigint)PTR_CAST(x) & ~TWOK_MASK)
+# define TWOK_SHIFT(x) ((u_bigint)PTR_CAST(x) & TWOK_MASK)
+# define OV_INDEXp(block) ((u_char*)PTR_CAST(TWOK_MASKED(block)))
# define OV_INDEX(block) (*OV_INDEXp(block))
# define OV_MAGIC(block,bucket) (*(OV_INDEXp(block) + \
(TWOK_SHIFT(block)>> \
@@ -781,7 +781,7 @@ emergency_sbrk(MEM_SIZE size)
/* Got it, now detach SvPV: */
pv = SvPV(sv, n_a);
/* Check alignment: */
- if (((UV)(pv - sizeof(union overhead))) & (NEEDED_ALIGNMENT - 1)) {
+ if (((UV)PTR_CAST (pv - sizeof(union overhead))) & (NEEDED_ALIGNMENT - 1)) {
PerlIO_puts(PerlIO_stderr(),"Bad alignment of $^M!\n");
return (char *)-1; /* die die die */
}
@@ -924,7 +924,7 @@ Perl_malloc(register size_t nbytes)
/* remove from linked list */
#if defined(RCHECK)
- if (((UV)p) & (MEM_ALIGNBYTES - 1))
+ if (((UV)PTR_CAST p) & (MEM_ALIGNBYTES - 1))
PerlIO_printf(PerlIO_stderr(), "Corrupt malloc ptr 0x%lx at 0x%lx\n",
(unsigned long)*((int*)p),(unsigned long)p);
#endif
@@ -1121,8 +1121,8 @@ getpages(int needed, int *nblksp, int bucket)
# ifndef I286 /* The sbrk(0) call on the I286 always returns the next segment */
/* WANTED_ALIGNMENT may be more than NEEDED_ALIGNMENT, but this may
improve performance of memory access. */
- if ((UV)cp & (WANTED_ALIGNMENT - 1)) { /* Not aligned. */
- slack = WANTED_ALIGNMENT - ((UV)cp & (WANTED_ALIGNMENT - 1));
+ if ((UV)PTR_CAST cp & (WANTED_ALIGNMENT - 1)) { /* Not aligned. */
+ slack = WANTED_ALIGNMENT - ((UV)PTR_CAST cp & (WANTED_ALIGNMENT - 1));
add += slack;
}
# endif
@@ -1183,16 +1183,16 @@ getpages(int needed, int *nblksp, int bucket)
*/
# if NEEDED_ALIGNMENT > MEM_ALIGNBYTES
- if ((UV)ovp & (NEEDED_ALIGNMENT - 1))
+ if ((UV)PTR_CAST ovp & (NEEDED_ALIGNMENT - 1))
fatalcroak("Misalignment of sbrk()\n");
else
# endif
#ifndef I286 /* Again, this should always be ok on an 80286 */
- if ((UV)ovp & (MEM_ALIGNBYTES - 1)) {
+ if ((UV)PTR_CAST ovp & (MEM_ALIGNBYTES - 1)) {
DEBUG_m(PerlIO_printf(Perl_debug_log,
"fixing sbrk(): %d bytes off machine alignement\n",
- (int)((UV)ovp & (MEM_ALIGNBYTES - 1))));
- ovp = (union overhead *)(((UV)ovp + MEM_ALIGNBYTES) &
+ (int)((UV)PTR_CAST ovp & (MEM_ALIGNBYTES - 1))));
+ ovp = (union overhead *)PTR_CAST (((UV)PTR_CAST ovp + MEM_ALIGNBYTES) &
(MEM_ALIGNBYTES - 1));
(*nblksp)--;
# if defined(DEBUGGING_MSTATS)