diff --git a/src/apply_low.h b/src/apply_low.h index 8f2dbe0a6e9e8c2c6c2bd8c653abc087233544de..3722f6b22ce66da107af4dd4d9868635d765eca7 100644 --- a/src/apply_low.h +++ b/src/apply_low.h @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: apply_low.h,v 1.18 2003/03/15 17:37:35 grubba Exp $ +|| $Id: apply_low.h,v 1.19 2003/06/30 17:06:08 mast Exp $ */ { @@ -159,8 +159,7 @@ char buf[50]; init_buf(); - sprintf(buf, "%lx->", - DO_NOT_WARN((long)(((char *)o)-((char *)0)))); + sprintf(buf, "%lx->", DO_NOT_WARN((long) PTR_TO_INT (o))); my_strcat(buf); my_strcat(function->name->str); do_trace_call(args); diff --git a/src/backend.cmod b/src/backend.cmod index 21d4741a8ba4c177fc05c76eb9658f511e3a70f5..bfa18d00bafeb9bc74a60472ea934d8ea367eb22 100644 --- a/src/backend.cmod +++ b/src/backend.cmod @@ -2,11 +2,11 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: backend.cmod,v 1.42 2003/04/28 00:32:42 mast Exp $ +|| $Id: backend.cmod,v 1.43 2003/06/30 17:06:08 mast Exp $ */ #include "global.h" -RCSID("$Id: backend.cmod,v 1.42 2003/04/28 00:32:42 mast Exp $"); +RCSID("$Id: backend.cmod,v 1.43 2003/06/30 17:06:08 mast Exp $"); #include "fdlib.h" #include "backend.h" #include <errno.h> @@ -947,7 +947,7 @@ PIKECLASS Backend if(my_timercmp(& CALL(0)->tv, < , &next_timeout)) next_timeout = CALL(0)->tv; - call_callback(& me->backend_callbacks, (void *)0); + call_callback(& me->backend_callbacks, NULL); copy_selectors(& me->active_set, &me->set); @@ -1522,7 +1522,7 @@ PIKECLASS Backend for(e=0;e<me->num_pending_calls;e++) { call_out *c=CALL(e); - hval=(size_t)(((char *)c->args)-(char *)0); + hval=PTR_TO_INT(c->args); #define LINK(X,c) \ hval%=me->hash_size; \ @@ -1548,7 +1548,7 @@ PIKECLASS Backend new->pos=me->num_pending_calls; { - hval=(size_t)(((char *)args)-(char *)0); + hval=PTR_TO_INT(args); LINK(arr,new); hval=hash_svalue(args->item); LINK(fun,new); @@ -1726,7 +1726,7 @@ PIKECLASS Backend if(fun->type == T_ARRAY) { - hval=(size_t)(((char *)fun->u.array)-(char *)0); + hval=PTR_TO_INT(fun->u.array); hval%=me->hash_size; for(c=me->call_hash[hval].arr;c;c=c->next_arr) { diff --git a/src/block_alloc.h b/src/block_alloc.h index f44685f7fac31872984744c688309f0e140deab7..a50a01e8aa8fb027fbccf7a1ac48ef4b9eac8df9 100644 --- a/src/block_alloc.h +++ b/src/block_alloc.h @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: block_alloc.h,v 1.67 2003/03/17 13:57:39 grubba Exp $ +|| $Id: block_alloc.h,v 1.68 2003/06/30 17:06:08 mast Exp $ */ #undef PRE_INIT_BLOCK @@ -384,7 +384,7 @@ static inline struct DATA * \ struct DATA *PIKE_CONCAT(find_,DATA)(void *ptr) \ { \ struct DATA *p; \ - PIKE_HASH_T hval = (PIKE_HASH_T)(((char *)ptr)-(char *)0); \ + PIKE_HASH_T hval = (PIKE_HASH_T)PTR_TO_INT(ptr); \ DO_IF_RUN_UNLOCKED(mt_lock(&PIKE_CONCAT(DATA,_mutex))); \ if(!PIKE_CONCAT(DATA,_hash_table_size)) { \ DO_IF_RUN_UNLOCKED(mt_unlock(&PIKE_CONCAT(DATA,_mutex))); \ @@ -416,7 +416,7 @@ static inline struct DATA * \ static struct DATA *PIKE_CONCAT(just_find_,DATA)(void *ptr) \ { \ struct DATA *p; \ - PIKE_HASH_T hval = (PIKE_HASH_T)(((char *)ptr)-(char *)0); \ + PIKE_HASH_T hval = (PIKE_HASH_T)PTR_TO_INT(ptr); \ DO_IF_RUN_UNLOCKED(mt_lock(&PIKE_CONCAT(DATA,_mutex))); \ if(!PIKE_CONCAT(DATA,_hash_table_size)) { \ DO_IF_RUN_UNLOCKED(mt_unlock(&PIKE_CONCAT(DATA,_mutex))); \ @@ -433,7 +433,7 @@ static struct DATA *PIKE_CONCAT(just_find_,DATA)(void *ptr) \ struct DATA *PIKE_CONCAT(make_,DATA)(void *ptr) \ { \ struct DATA *p; \ - PIKE_HASH_T hval = (PIKE_HASH_T)(((char *)ptr)-(char *)0); \ + PIKE_HASH_T hval = (PIKE_HASH_T)PTR_TO_INT(ptr); \ DO_IF_RUN_UNLOCKED(mt_lock(&PIKE_CONCAT(DATA,_mutex))); \ hval %= (PIKE_HASH_T)PIKE_CONCAT(DATA,_hash_table_size); \ p=PIKE_CONCAT3(make_,DATA,_unlocked)(ptr,hval); \ @@ -444,7 +444,7 @@ struct DATA *PIKE_CONCAT(make_,DATA)(void *ptr) \ struct DATA *PIKE_CONCAT(get_,DATA)(void *ptr) \ { \ struct DATA *p; \ - PIKE_HASH_T hval = (size_t)(((char *)ptr)-(char *)0); \ + PIKE_HASH_T hval = (PIKE_HASH_T)PTR_TO_INT(ptr); \ DO_IF_RUN_UNLOCKED(mt_lock(&PIKE_CONCAT(DATA,_mutex))); \ hval %= (PIKE_HASH_T)PIKE_CONCAT(DATA,_hash_table_size); \ if(!(p=PIKE_CONCAT3(really_low_find_,DATA,_unlocked)(ptr, hval))) \ @@ -456,7 +456,7 @@ struct DATA *PIKE_CONCAT(get_,DATA)(void *ptr) \ int PIKE_CONCAT3(check_,DATA,_semafore)(void *ptr) \ { \ struct DATA *p; \ - PIKE_HASH_T hval = (PIKE_HASH_T)(((char *)ptr)-(char *)0); \ + PIKE_HASH_T hval = (PIKE_HASH_T)PTR_TO_INT(ptr); \ DO_IF_RUN_UNLOCKED(mt_lock(&PIKE_CONCAT(DATA,_mutex))); \ hval %= (PIKE_HASH_T)PIKE_CONCAT(DATA,_hash_table_size); \ if((p=PIKE_CONCAT3(really_low_find_,DATA,_unlocked)(ptr, hval))) \ @@ -473,7 +473,7 @@ int PIKE_CONCAT3(check_,DATA,_semafore)(void *ptr) \ void PIKE_CONCAT(move_,DATA)(struct DATA *block, void *new_ptr) \ { \ PIKE_HASH_T hval = \ - (PIKE_HASH_T)(((char *)block->PTR_HASH_ALLOC_DATA)-(char *)0); \ + (PIKE_HASH_T)PTR_TO_INT(block->PTR_HASH_ALLOC_DATA); \ DO_IF_RUN_UNLOCKED(mt_lock(&PIKE_CONCAT(DATA,_mutex))); \ hval %= (PIKE_HASH_T)PIKE_CONCAT(DATA,_hash_table_size); \ if (!PIKE_CONCAT3(really_low_find_,DATA,_unlocked)( \ @@ -485,7 +485,7 @@ void PIKE_CONCAT(move_,DATA)(struct DATA *block, void *new_ptr) \ ); \ PIKE_CONCAT(DATA,_hash_table)[hval] = block->BLOCK_ALLOC_NEXT; \ block->PTR_HASH_ALLOC_DATA = new_ptr; \ - hval = (PIKE_HASH_T)(((char *)new_ptr)-(char *)0) % \ + hval = (PIKE_HASH_T)PTR_TO_INT(new_ptr) % \ (PIKE_HASH_T)PIKE_CONCAT(DATA,_hash_table_size); \ block->BLOCK_ALLOC_NEXT = PIKE_CONCAT(DATA,_hash_table)[hval]; \ PIKE_CONCAT(DATA,_hash_table)[hval] = block; \ @@ -495,7 +495,7 @@ void PIKE_CONCAT(move_,DATA)(struct DATA *block, void *new_ptr) \ int PIKE_CONCAT(remove_,DATA)(void *ptr) \ { \ struct DATA *p; \ - PIKE_HASH_T hval = (PIKE_HASH_T)(((char *)ptr)-(char *)0); \ + PIKE_HASH_T hval = (PIKE_HASH_T)PTR_TO_INT(ptr); \ DO_IF_RUN_UNLOCKED(mt_lock(&PIKE_CONCAT(DATA,_mutex))); \ if(!PIKE_CONCAT(DATA,_hash_table)) \ { \ @@ -605,7 +605,7 @@ static void PIKE_CONCAT(DATA,_rehash)() \ while((p=old_hash[e])) \ { \ old_hash[e]=p->BLOCK_ALLOC_NEXT; \ - hval = (PIKE_HASH_T)(((char *)p->PTR_HASH_ALLOC_DATA)-(char *)0); \ + hval = (PIKE_HASH_T)PTR_TO_INT(p->PTR_HASH_ALLOC_DATA); \ hval %= (PIKE_HASH_T)PIKE_CONCAT(DATA,_hash_table_size); \ p->BLOCK_ALLOC_NEXT=PIKE_CONCAT(DATA,_hash_table)[hval]; \ PIKE_CONCAT(DATA,_hash_table)[hval]=p; \ @@ -631,7 +631,7 @@ struct DATA *PIKE_CONCAT3(make_,DATA,_unlocked)(void *ptr, \ PIKE_CONCAT(DATA,_hash_table_size)) \ { \ PIKE_CONCAT(DATA,_rehash)(); \ - hval = (PIKE_HASH_T)(((char *)ptr)-(char *)0); \ + hval = (PIKE_HASH_T)PTR_TO_INT(ptr); \ hval %= (PIKE_HASH_T)PIKE_CONCAT(DATA,_hash_table_size); \ } \ \ diff --git a/src/builtin_functions.c b/src/builtin_functions.c index 4f95433ca6a4aa3e4abe1ec059b38402642ba3da..fefd397294671a6083130f668e64bd840ab5300f 100644 --- a/src/builtin_functions.c +++ b/src/builtin_functions.c @@ -2,11 +2,11 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: builtin_functions.c,v 1.496 2003/06/24 20:27:19 nilsson Exp $ +|| $Id: builtin_functions.c,v 1.497 2003/06/30 17:06:08 mast Exp $ */ #include "global.h" -RCSID("$Id: builtin_functions.c,v 1.496 2003/06/24 20:27:19 nilsson Exp $"); +RCSID("$Id: builtin_functions.c,v 1.497 2003/06/30 17:06:08 mast Exp $"); #include "interpret.h" #include "svalue.h" #include "pike_macros.h" @@ -2289,7 +2289,7 @@ static node *fix_overloaded_type(node *n, int lfun, const char *deftype, int def /* FIXME: Ought to handle or-nodes here. */ if(t && (t->type == T_OBJECT)) { - struct program *p = id_to_program(((char *)t->cdr)-(char *)0); + struct program *p = id_to_program(CDR_TO_INT(t)); if(p) { int fun=FIND_LFUN(p, lfun); @@ -5859,7 +5859,7 @@ PMOD_EXPORT void f__memory_usage(INT32 args) } #endif - call_callback(&memory_usage_callback, (void *)0); + call_callback(&memory_usage_callback, NULL); f_aggregate_mapping(DO_NOT_WARN(Pike_sp - ss)); } diff --git a/src/cyclic.c b/src/cyclic.c index bfffa6de6fcd7efbbd39822532946a9bbdb0dde1..ff11ce8c9974f83305f07bbe3ac97b0ce24919e2 100644 --- a/src/cyclic.c +++ b/src/cyclic.c @@ -2,13 +2,13 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: cyclic.c,v 1.10 2003/01/06 17:20:59 grubba Exp $ +|| $Id: cyclic.c,v 1.11 2003/06/30 17:06:08 mast Exp $ */ #include "global.h" #include "cyclic.h" -RCSID("$Id: cyclic.c,v 1.10 2003/01/06 17:20:59 grubba Exp $"); +RCSID("$Id: cyclic.c,v 1.11 2003/06/30 17:06:08 mast Exp $"); #define CYCLIC_HASH_SIZE 4711 @@ -18,13 +18,13 @@ static void low_unlink_cyclic(CYCLIC *c) { size_t h; CYCLIC **p; - h=((char *)c->id)-(char *)0; + h=PTR_TO_INT(c->id); h*=33; - h|=((char *)c->a)-(char *)0; + h|=PTR_TO_INT(c->a); h*=33; - h|=((char *)c->b)-(char *)0; + h|=PTR_TO_INT(c->b); h*=33; - h|=((char *)c->th)-(char *)0; + h|=PTR_TO_INT(c->th); h*=33; h%=CYCLIC_HASH_SIZE; @@ -58,13 +58,13 @@ void *begin_cyclic(CYCLIC *c, void *ret=0; CYCLIC *p; - h=((char *)id)-(char *)0; + h=PTR_TO_INT(id); h*=33; - h|=((char *)a)-(char *)0; + h|=PTR_TO_INT(a); h*=33; - h|=((char *)b)-(char *)0; + h|=PTR_TO_INT(b); h*=33; - h|=((char *)th)-(char *)0; + h|=PTR_TO_INT(th); h*=33; h%=CYCLIC_HASH_SIZE; diff --git a/src/encode.c b/src/encode.c index f41d0d2818177bee55e8a9821c33805c249de2d3..396c10615289db6f2432fe12b8ff245957e9cfc7 100644 --- a/src/encode.c +++ b/src/encode.c @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: encode.c,v 1.189 2003/06/12 18:42:56 mast Exp $ +|| $Id: encode.c,v 1.190 2003/06/30 17:06:08 mast Exp $ */ #include "global.h" @@ -27,7 +27,7 @@ #include "bignum.h" #include "pikecode.h" -RCSID("$Id: encode.c,v 1.189 2003/06/12 18:42:56 mast Exp $"); +RCSID("$Id: encode.c,v 1.190 2003/06/30 17:06:08 mast Exp $"); /* #define ENCODE_DEBUG */ @@ -296,7 +296,7 @@ static void encode_type(struct pike_type *t, struct encode_data *data) case T_ASSIGN: { - ptrdiff_t marker = ((char *)t->car)-(char *)0; + ptrdiff_t marker = CAR_TO_INT(t); if ((marker < 0) || (marker > 9)) { Pike_fatal("Bad assign marker: %ld\n", (long)marker); @@ -337,12 +337,12 @@ static void encode_type(struct pike_type *t, struct encode_data *data) { ptrdiff_t val; - val = ((char *)t->car)-(char *)0; + val = CAR_TO_INT(t); addchar((val >> 24)&0xff); addchar((val >> 16)&0xff); addchar((val >> 8)&0xff); addchar(val & 0xff); - val = ((char *)t->cdr)-(char *)0; + val = CDR_TO_INT(t); addchar((val >> 24)&0xff); addchar((val >> 16)&0xff); addchar((val >> 8)&0xff); @@ -370,11 +370,11 @@ static void encode_type(struct pike_type *t, struct encode_data *data) case T_OBJECT: { - addchar(((char *)t->car)-(char *)0); + addchar(CAR_TO_INT(t)); if(t->cdr) { - ptrdiff_t id = ((char *)t->cdr)-(char *)0; + ptrdiff_t id = CAR_TO_INT(t); if( id >= PROG_DYNAMIC_ID_START ) { struct program *p=id_to_program(id); @@ -3018,7 +3018,7 @@ static void decode_value2(struct decode_data *data) } else { placeholder->storage=p->storage_needed ? (char *)xalloc(p->storage_needed) : - (char *)0; + (char *)NULL; call_c_initializers(placeholder); } } @@ -3039,7 +3039,7 @@ static void decode_value2(struct decode_data *data) { /* Logic for the PROGRAM_FINISHED flag: * The purpose of this code is to make sure that the PROGRAM_FINISHED - * flat is not set on the program until all inherited programs also + * flag is not set on the program until all inherited programs also * have that flag. -Hubbe */ for(d=1;d<p->num_inherits;d++) diff --git a/src/fdlib.c b/src/fdlib.c index 501662592d342211b3bbec16f13277bbe948580f..2e2565c86285f2ad4a91267836798adf504f7fad 100644 --- a/src/fdlib.c +++ b/src/fdlib.c @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: fdlib.c,v 1.62 2003/05/04 14:36:39 nilsson Exp $ +|| $Id: fdlib.c,v 1.63 2003/06/30 17:06:08 mast Exp $ */ #include "global.h" @@ -10,7 +10,7 @@ #include "pike_error.h" #include <math.h> -RCSID("$Id: fdlib.c,v 1.62 2003/05/04 14:36:39 nilsson Exp $"); +RCSID("$Id: fdlib.c,v 1.63 2003/06/30 17:06:08 mast Exp $"); #ifdef HAVE_WINSOCK_H @@ -1603,7 +1603,7 @@ void fd_waitor_remove_customer(fd_waitor *x, FD customer) CloseHandle(x->customers[pos]); - fd_mapper_store(customer, x->fd_to_pos_key, (void *)0); + fd_mapper_store(customer, x->fd_to_pos_key, NULL); x->occupied--; if(x->occupied != pos) { diff --git a/src/fsort_template.h b/src/fsort_template.h index 5fd647e44d7ebc70f597a53d2901458be98f69c1..f47bdd064c037704500ca52207e4c63bb986d388 100644 --- a/src/fsort_template.h +++ b/src/fsort_template.h @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: fsort_template.h,v 1.15 2003/04/26 16:12:53 mast Exp $ +|| $Id: fsort_template.h,v 1.16 2003/06/30 17:06:08 mast Exp $ */ #ifdef SORT_BY_INDEX @@ -33,7 +33,7 @@ #define INC(X) X=STEP(X,1) #define DEC(X) X=STEP(X,-1) -#define SIZE (((char *)STEP((PTYPE)0,1))-((char *)0)) +#define SIZE PTR_TO_INT(STEP((PTYPE)0,1)) #define PARENT(X) (((X)-1)>>1) #define CHILD1(X) (((X)<<1)+1) diff --git a/src/gc.c b/src/gc.c index b89cdf969f4226967482028834328ce3beb60d6c..52e53c9368d2d7adb2230f75a2ea4cc4d0da3ee5 100644 --- a/src/gc.c +++ b/src/gc.c @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: gc.c,v 1.219 2003/06/05 21:52:03 mast Exp $ +|| $Id: gc.c,v 1.220 2003/06/30 17:06:08 mast Exp $ */ #include "global.h" @@ -33,7 +33,7 @@ struct callback *gc_evaluator_callback=0; #include "block_alloc.h" -RCSID("$Id: gc.c,v 1.219 2003/06/05 21:52:03 mast Exp $"); +RCSID("$Id: gc.c,v 1.220 2003/06/30 17:06:08 mast Exp $"); int gc_enabled = 1; @@ -1434,7 +1434,7 @@ void locate_references(void *a) #endif found_where=0; - call_callback(& gc_callbacks, (void *)0); + call_callback(& gc_callbacks, NULL); found_where=orig_found_where; check_for=orig_check_for; @@ -2617,7 +2617,7 @@ size_t do_gc(void *ignored, int explicit_call) /* These callbacks are mainly for the check pass, but can also * do things that are normally associated with the mark pass */ - call_callback(& gc_callbacks, (void *)0); + call_callback(& gc_callbacks, NULL); GC_VERBOSE_DO(fprintf(stderr, "| check: %u references in %d things, " "counted %"PRINTSIZET"u weak refs\n", diff --git a/src/interpret.c b/src/interpret.c index 3f624ac633ee1c24c21873266c13cdc41a5d5865..6e471b27927832bd84c2e59d944b6494aa1d1597 100644 --- a/src/interpret.c +++ b/src/interpret.c @@ -2,11 +2,11 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: interpret.c,v 1.306 2003/06/07 13:28:39 grubba Exp $ +|| $Id: interpret.c,v 1.307 2003/06/30 17:06:09 mast Exp $ */ #include "global.h" -RCSID("$Id: interpret.c,v 1.306 2003/06/07 13:28:39 grubba Exp $"); +RCSID("$Id: interpret.c,v 1.307 2003/06/30 17:06:09 mast Exp $"); #include "interpret.h" #include "object.h" #include "program.h" @@ -1529,7 +1529,7 @@ int low_mega_apply(enum apply_type type, INT32 args, void *arg1, void *arg2) case APPLY_LOW: o = (struct object *)arg1; - fun = ((char *)arg2) - (char *)0; + fun = PTR_TO_INT(arg2); if(o->prog == pike_trampoline_program && fun == QUICK_FIND_LFUN(pike_trampoline_program, LFUN_CALL)) { diff --git a/src/interpret.h b/src/interpret.h index 32bde2ddda636a1b803c050a6747bb3db5d33ec8..214d4faff73e3db4a16afa11ef9d321719b84f4f 100644 --- a/src/interpret.h +++ b/src/interpret.h @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: interpret.h,v 1.141 2003/04/27 17:43:15 mast Exp $ +|| $Id: interpret.h,v 1.142 2003/06/30 17:06:09 mast Exp $ */ #ifndef INTERPRET_H @@ -546,7 +546,7 @@ PMOD_EXPORT extern unsigned long evaluator_callback_calls; #define check_threads_etc() do { \ DO_IF_INTERNAL_PROFILING (evaluator_callback_calls++); \ - call_callback(& evaluator_callbacks, (void *)0); \ + call_callback(& evaluator_callbacks, NULL); \ }while(0) #ifdef PIKE_DEBUG diff --git a/src/interpret_functions.h b/src/interpret_functions.h index b925f2ca862a37a97f8aa7f14f2846af3497910b..66c1230236a59e1c938d9dbe7545ac3bfd6b11d7 100644 --- a/src/interpret_functions.h +++ b/src/interpret_functions.h @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: interpret_functions.h,v 1.150 2003/04/27 17:52:42 mast Exp $ +|| $Id: interpret_functions.h,v 1.151 2003/06/30 17:06:09 mast Exp $ */ /* @@ -1018,13 +1018,8 @@ OPCODE0_TAIL(F_CLEANUP_SYNCH_MARK, "cleanup synch mark", 0, { OPCODE0(F_POP_SYNCH_MARK, "pop synch mark", 0, { if (d_flag) { if (Pike_mark_sp <= Pike_interpreter.mark_stack) { - Pike_fatal("Mark stack out of synch - 0x%08lx <= 0x%08lx.\n", - DO_NOT_WARN((unsigned long) - (((char *)Pike_mark_sp)- - (char *)0)), - DO_NOT_WARN((unsigned long) - (((char *)Pike_interpreter.mark_stack)- - (char *)0))); + Pike_fatal("Mark stack out of synch - %p <= %p.\n", + Pike_mark_sp, Pike_interpreter.mark_stack); } else if (*--Pike_mark_sp != Pike_sp) { ptrdiff_t should = *Pike_mark_sp - Pike_interpreter.evaluator_stack; ptrdiff_t is = Pike_sp - Pike_interpreter.evaluator_stack; @@ -1243,7 +1238,7 @@ OPCODE1(F_SWITCH, "switch", 0, { tmp=switch_lookup(Pike_fp->context.prog-> constants[arg1].sval.u.array,Pike_sp-1); addr = DO_IF_ELSE_COMPUTED_GOTO(addr, (PIKE_OPCODE_T *) - DO_ALIGN(((char *)addr)-(char *)0, + DO_ALIGN(PTR_TO_INT(addr), ((ptrdiff_t)sizeof(INT32)))); addr = (PIKE_OPCODE_T *)(((INT32 *)addr) + (tmp>=0 ? 1+tmp*2 : 2*~tmp)); if(*(INT32*)addr < 0) fast_check_threads_etc(7); @@ -1262,7 +1257,7 @@ OPCODE1(F_SWITCH_ON_INDEX, "switch on index", 0, { constants[arg1].sval.u.array,Pike_sp-1); pop_n_elems(3); addr = DO_IF_ELSE_COMPUTED_GOTO(addr, (PIKE_OPCODE_T *) - DO_ALIGN(((char *)addr)-(char *)0, + DO_ALIGN(PTR_TO_INT(addr), ((ptrdiff_t)sizeof(INT32)))); addr = (PIKE_OPCODE_T *)(((INT32 *)addr) + (tmp>=0 ? 1+tmp*2 : 2*~tmp)); if(*(INT32*)addr < 0) fast_check_threads_etc(7); @@ -1275,7 +1270,7 @@ OPCODE2(F_SWITCH_ON_LOCAL, "switch on local", 0, { tmp=switch_lookup(Pike_fp->context.prog-> constants[arg2].sval.u.array,Pike_fp->locals + arg1); addr = DO_IF_ELSE_COMPUTED_GOTO(addr, (PIKE_OPCODE_T *) - DO_ALIGN(((char *)addr)-(char *)0, + DO_ALIGN(PTR_TO_INT(addr), ((ptrdiff_t)sizeof(INT32)))); addr = (PIKE_OPCODE_T *)(((INT32 *)addr) + (tmp>=0 ? 1+tmp*2 : 2*~tmp)); if(*(INT32*)addr < 0) fast_check_threads_etc(7); diff --git a/src/las.c b/src/las.c index 131228ed1dd818d74d1bfe3b873fbcceccb78814..fcbe2e3b9939b413df60bdb5c95ec5b0822ce01c 100644 --- a/src/las.c +++ b/src/las.c @@ -2,11 +2,11 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: las.c,v 1.335 2003/04/02 19:24:20 nilsson Exp $ +|| $Id: las.c,v 1.336 2003/06/30 17:06:09 mast Exp $ */ #include "global.h" -RCSID("$Id: las.c,v 1.335 2003/04/02 19:24:20 nilsson Exp $"); +RCSID("$Id: las.c,v 1.336 2003/06/30 17:06:09 mast Exp $"); #include "language.h" #include "interpret.h" @@ -1892,7 +1892,7 @@ node *index_node(node *n, char *node_name, struct pike_string *id) { ptrdiff_t c; DECLARE_CYCLIC(); - c = ((char *)BEGIN_CYCLIC(Pike_sp[-1].u.refs, id))-(char *)0; + c = PTR_TO_INT(BEGIN_CYCLIC(Pike_sp[-1].u.refs, id)); if(c>1) { my_yyerror("Recursive module dependency in '%s'.",id->str); diff --git a/src/main.c b/src/main.c index 9071a61c08a32ce9225ae3266b1e459e17626874..f027788f3572693e2a3500b15f272c2bc6f6e424 100644 --- a/src/main.c +++ b/src/main.c @@ -2,11 +2,11 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: main.c,v 1.176 2003/06/05 21:50:16 mast Exp $ +|| $Id: main.c,v 1.177 2003/06/30 17:06:09 mast Exp $ */ #include "global.h" -RCSID("$Id: main.c,v 1.176 2003/06/05 21:50:16 mast Exp $"); +RCSID("$Id: main.c,v 1.177 2003/06/30 17:06:09 mast Exp $"); #include "fdlib.h" #include "backend.h" #include "module.h" @@ -550,12 +550,10 @@ int dbm_main(int argc, char **argv) */ #if STACK_DIRECTION < 0 /* Equvivalent with |= 0xffff */ - Pike_interpreter.stack_top += (~(((char *)Pike_interpreter.stack_top)- - (char *)0)) & 0xffff; + Pike_interpreter.stack_top += ~(PTR_TO_INT(Pike_interpreter.stack_top)) & 0xffff; #else /* STACK_DIRECTION >= 0 */ /* Equvivalent with &= ~0xffff */ - Pike_interpreter.stack_top -= (((char *)Pike_interpreter.stack_top)- - (char *)0) & 0xffff; + Pike_interpreter.stack_top -= PTR_TO_INT(Pike_interpreter.stack_top) & 0xffff; #endif /* STACK_DIRECTION < 0 */ #ifdef PROFILING @@ -774,7 +772,7 @@ int dbm_main(int argc, char **argv) DECLSPEC(noreturn) void pike_do_exit(int num) ATTRIBUTE((noreturn)) { - call_callback(&exit_callbacks, (void *)0); + call_callback(&exit_callbacks, NULL); free_callback_list(&exit_callbacks); exit_modules(); diff --git a/src/mapping.c b/src/mapping.c index 67f2c315e0c53ed4edacc224edce4915d139b15e..f0c396d732226f43d6329c7f4832ee85834c9619 100644 --- a/src/mapping.c +++ b/src/mapping.c @@ -2,11 +2,11 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: mapping.c,v 1.167 2003/06/02 16:35:34 mast Exp $ +|| $Id: mapping.c,v 1.168 2003/06/30 17:06:09 mast Exp $ */ #include "global.h" -RCSID("$Id: mapping.c,v 1.167 2003/06/02 16:35:34 mast Exp $"); +RCSID("$Id: mapping.c,v 1.168 2003/06/30 17:06:09 mast Exp $"); #include "main.h" #include "object.h" #include "mapping.h" @@ -40,11 +40,8 @@ static struct mapping *gc_mark_mapping_pos = 0; free_mapping_data(M); \ }while(0) - #define MAPPING_DATA_SIZE(HSIZE, KEYPAIRS) \ - (((char *)(MD_KEYPAIRS(0, HSIZE) + KEYPAIRS))-(char *)0) - - + PTR_TO_INT(MD_KEYPAIRS(0, HSIZE) + KEYPAIRS) #undef EXIT_BLOCK #define EXIT_BLOCK(m) do{ \ diff --git a/src/mapping.h b/src/mapping.h index efdee7a9e5e714a74467cd936736a3aed002d3f6..8c7dd52d4c6439d3a55a9fd7f64dc5858cc0e427 100644 --- a/src/mapping.h +++ b/src/mapping.h @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: mapping.h,v 1.49 2003/03/30 16:15:10 mast Exp $ +|| $Id: mapping.h,v 1.50 2003/06/30 17:06:09 mast Exp $ */ #ifndef MAPPING_H @@ -62,7 +62,9 @@ extern struct mapping *gc_internal_mapping; #define mapping_get_flags(m) ((m)->data->flags) #define MD_KEYPAIRS(MD, HSIZE) \ - ( (struct keypair *)DO_ALIGN( ((char *)(((struct mapping_data *)(MD))->hash + HSIZE))-(char *)0, ALIGNOF(struct keypair)) ) + ( (struct keypair *) \ + DO_ALIGN( PTR_TO_INT(((struct mapping_data *)(MD))->hash + HSIZE), \ + ALIGNOF(struct keypair)) ) #ifndef PIKE_MAPPING_KEYPAIR_LOOP #define NEW_MAPPING_LOOP(md) \ diff --git a/src/modules/Oracle/oracle.c b/src/modules/Oracle/oracle.c index 737f3f5ce25c223181d912001a2bc4fb202da6ca..2aa68749f12e8b2f78d24d1c5bdfe094719b5978 100644 --- a/src/modules/Oracle/oracle.c +++ b/src/modules/Oracle/oracle.c @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: oracle.c,v 1.77 2003/02/23 17:42:01 grubba Exp $ +|| $Id: oracle.c,v 1.78 2003/06/30 17:11:20 mast Exp $ */ /* @@ -54,7 +54,7 @@ #include <math.h> -RCSID("$Id: oracle.c,v 1.77 2003/02/23 17:42:01 grubba Exp $"); +RCSID("$Id: oracle.c,v 1.78 2003/06/30 17:11:20 mast Exp $"); /* User-changable defines: */ @@ -887,7 +887,7 @@ static void f_fetch_fields(INT32 args) rc=OCIAttrGet((void *)column_parameter, OCI_DTYPE_PARAM, &type, - (ub4*)0, + (ub4*)NULL, OCI_ATTR_DATA_TYPE, dbcon->error_handle); @@ -896,7 +896,7 @@ static void f_fetch_fields(INT32 args) rc=OCIAttrGet((void *)column_parameter, OCI_DTYPE_PARAM, &size, - (ub4*)0, + (ub4*)NULL, OCI_ATTR_DATA_SIZE, dbcon->error_handle); @@ -905,7 +905,7 @@ static void f_fetch_fields(INT32 args) rc=OCIAttrGet((void *)column_parameter, OCI_DTYPE_PARAM, &scale, - (ub4*)0, + (ub4*)NULL, OCI_ATTR_SCALE, dbcon->error_handle); @@ -1004,7 +1004,7 @@ static void f_fetch_fields(INT32 args) (dvoid **) &info->data.lob, (ub4)OCI_DTYPE_LOB, (size_t) 0, - (dvoid **) 0))) + (dvoid **) NULL))) { #ifdef ORACLE_DEBUG fprintf(stderr,"OCIDescriptorAlloc failed!\n"); @@ -1208,7 +1208,7 @@ static void push_inout_value(struct inout *inout, 1, (dvoid *) bufp, loblen, - (dvoid *)0, + (dvoid *)NULL, (sb4 (*)(dvoid *, CONST dvoid *, ub4, ub1)) 0, (ub2) 0, (ub1) SQLCS_IMPLICIT)) != OCI_SUCCESS) diff --git a/src/modules/_Charset/misc.c b/src/modules/_Charset/misc.c index a8fe4f584c25eda0598643464d87f8c555d916f0..5cb8d454b26702582105c01c0bbd0e4527ad65d7 100644 --- a/src/modules/_Charset/misc.c +++ b/src/modules/_Charset/misc.c @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: misc.c,v 1.13 2003/04/06 14:37:31 nilsson Exp $ +|| $Id: misc.c,v 1.14 2003/06/30 17:11:19 mast Exp $ */ #include "global.h" @@ -2077,5 +2077,5 @@ p_wchar1 const *misc_charset_lookup(char *name, int *rlo, int *rhi) else lo=mid+1; } - return (p_wchar1 *)0; + return (p_wchar1 *)NULL; } diff --git a/src/multiset.c b/src/multiset.c index 54d3c001d296feb83718335a5ec2af1f34ca676e..3593e359b1faf1df68e2500a561745a9cfa54541 100644 --- a/src/multiset.c +++ b/src/multiset.c @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: multiset.c,v 1.73 2003/05/12 12:17:49 nilsson Exp $ +|| $Id: multiset.c,v 1.74 2003/06/30 17:06:09 mast Exp $ */ #include "global.h" @@ -14,7 +14,7 @@ * Created by Martin Stjernholm 2001-05-07 */ -RCSID("$Id: multiset.c,v 1.73 2003/05/12 12:17:49 nilsson Exp $"); +RCSID("$Id: multiset.c,v 1.74 2003/06/30 17:06:09 mast Exp $"); #include "builtin_functions.h" #include "gc.h" @@ -153,8 +153,7 @@ PMOD_EXPORT const char msg_multiset_no_node_refs[] = #define NODE_AT(MSD, TYPE, POS) ((struct TYPE *) &(MSD)->nodes + (POS)) #define NODE_OFFSET(TYPE, POS) \ - ((size_t)(((char *)NODE_AT ((struct multiset_data *) NULL, TYPE, POS))- \ - (char *)0)) + PTR_TO_INT (NODE_AT ((struct multiset_data *) NULL, TYPE, POS)) #define SHIFT_PTR(PTR, FROM, TO) ((char *) (PTR) - (char *) (FROM) + (char *) (TO)) #define SHIFT_NODEPTR(NODEPTR, FROM_MSD, TO_MSD) \ @@ -4232,8 +4231,8 @@ static void check_low_msnode (struct multiset_data *msd, Pike_fatal ("Node outside storage for multiset.\n"); if ((char *) node - (char *) msd->nodes != (msd->flags & MULTISET_INDVAL ? - (&node->iv - &msd->nodes->iv) * (ptrdiff_t) ((struct msnode_indval *) NULL + 1) : - (&node->i - &msd->nodes->i) * (ptrdiff_t) ((struct msnode_ind *) NULL + 1))) + (&node->iv - &msd->nodes->iv) * sizeof (struct msnode_indval) : + (&node->i - &msd->nodes->i) * sizeof (struct msnode_ind))) Pike_fatal ("Unaligned node in storage for multiset.\n"); switch (node->i.ind.type) { @@ -5291,7 +5290,7 @@ void test_multiset (void) #include "gc.h" #include "security.h" -RCSID("$Id: multiset.c,v 1.73 2003/05/12 12:17:49 nilsson Exp $"); +RCSID("$Id: multiset.c,v 1.74 2003/06/30 17:06:09 mast Exp $"); struct multiset *first_multiset; diff --git a/src/object.c b/src/object.c index 154c2544c5edb42baf66365534243c9c49b18c38..b24b363057a4b3bcc2ad4caa0b3be9124dea57f5 100644 --- a/src/object.c +++ b/src/object.c @@ -2,11 +2,11 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: object.c,v 1.237 2003/06/03 18:00:07 mast Exp $ +|| $Id: object.c,v 1.238 2003/06/30 17:06:09 mast Exp $ */ #include "global.h" -RCSID("$Id: object.c,v 1.237 2003/06/03 18:00:07 mast Exp $"); +RCSID("$Id: object.c,v 1.238 2003/06/30 17:06:09 mast Exp $"); #include "object.h" #include "dynamic_buffer.h" #include "interpret.h" @@ -106,7 +106,7 @@ PMOD_EXPORT struct object *low_clone(struct program *p) #endif /* PROFILING */ o=alloc_object(); - o->storage=p->storage_needed ? (char *)xalloc(p->storage_needed) : (char *)0; + o->storage=p->storage_needed ? (char *)xalloc(p->storage_needed) : (char *)NULL; GC_ALLOC(o); diff --git a/src/object.h b/src/object.h index 067c60fb54323cd721e536670fef6a9cda50f783..654c8cc6819548dd2cd76c0a9e7536e3e4243931 100644 --- a/src/object.h +++ b/src/object.h @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: object.h,v 1.78 2003/02/15 16:02:05 grubba Exp $ +|| $Id: object.h,v 1.79 2003/06/30 17:06:09 mast Exp $ */ #ifndef OBJECT_H @@ -127,7 +127,7 @@ void check_all_objects(void); #endif #ifdef PIKE_DEBUG -#define master() ( get_master() ? get_master() : ( Pike_fatal("Couldn't load master object at %s:%d.\n",__FILE__,__LINE__), (struct object *)0) ) +#define master() ( get_master() ? get_master() : ( Pike_fatal("Couldn't load master object at %s:%d.\n",__FILE__,__LINE__), (struct object *)NULL) ) #else #define master() debug_master() #endif diff --git a/src/pike_macros.h b/src/pike_macros.h index d23477e9530823d10fd2eefa5f41cb5bf8c257f8..3b55eac67725c4d8265e8fdc0dc7f2df0a140c53 100644 --- a/src/pike_macros.h +++ b/src/pike_macros.h @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: pike_macros.h,v 1.36 2003/06/30 16:43:02 mast Exp $ +|| $Id: pike_macros.h,v 1.37 2003/06/30 17:06:09 mast Exp $ */ #ifndef MACROS_H @@ -16,14 +16,14 @@ #include "pike_memory.h" -#define PTR_TO_INT(PTR) ((size_t) ((char *) (PTR) - (char *) 0)) +#define PTR_TO_INT(PTR) ((size_t) ((char *) (PTR) - (char *) NULL)) #define OFFSETOF(str_type, field) \ - PTR_TO_INT(& (((struct str_type *)0)->field)) + PTR_TO_INT(& (((struct str_type *)NULL)->field)) #define BASEOF(ptr, str_type, field) \ ((struct str_type *)((char*)ptr - OFFSETOF(str_type, field))) #define ALIGNOF(X) OFFSETOF({ char ignored_; X fooo_;}, fooo_) -/* #define ALIGNOF(X) PTR_TO_INT(&(((struct { char ignored_ ; X fooo_; } *)0)->fooo_)) */ +/* #define ALIGNOF(X) PTR_TO_INT(&(((struct { char ignored_ ; X fooo_; } *)NULL)->fooo_)) */ #define NELEM(a) (sizeof (a) / sizeof ((a)[0])) #define ALLOC_STRUCT(X) ( (struct X *)xalloc(sizeof(struct X)) ) diff --git a/src/pike_memory.c b/src/pike_memory.c index fbc878f6ef7e55da1295c6a7113ce11d16dbfef3..b2e8b5080d5195386ebfde4c03a9097d39f38b38 100644 --- a/src/pike_memory.c +++ b/src/pike_memory.c @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: pike_memory.c,v 1.145 2003/04/02 19:22:43 mast Exp $ +|| $Id: pike_memory.c,v 1.146 2003/06/30 17:06:09 mast Exp $ */ #include "global.h" @@ -11,7 +11,7 @@ #include "pike_macros.h" #include "gc.h" -RCSID("$Id: pike_memory.c,v 1.145 2003/04/02 19:22:43 mast Exp $"); +RCSID("$Id: pike_memory.c,v 1.146 2003/06/30 17:06:09 mast Exp $"); /* strdup() is used by several modules, so let's provide it */ #ifndef HAVE_STRDUP @@ -45,13 +45,13 @@ long pcharp_strlen(PCHARP a) INLINE p_wchar1 *MEMCHR1(p_wchar1 *p, p_wchar2 c, ptrdiff_t e) { while(--e >= 0) if(*(p++) == (p_wchar1)c) return p-1; - return (p_wchar1 *)0; + return (p_wchar1 *)NULL; } INLINE p_wchar2 *MEMCHR2(p_wchar2 *p, p_wchar2 c, ptrdiff_t e) { while(--e >= 0) if(*(p++) == (p_wchar2)c) return p-1; - return (p_wchar2 *)0; + return (p_wchar2 *)NULL; } void swap(char *a, char *b, size_t size) diff --git a/src/pike_search.c b/src/pike_search.c index a852f74aea38370a6a8cac04bf83587ec2ec94a3..d8978a5f654a8c2351def7b19331e22d6a396db3 100644 --- a/src/pike_search.c +++ b/src/pike_search.c @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: pike_search.c,v 1.15 2003/04/07 17:28:55 nilsson Exp $ +|| $Id: pike_search.c,v 1.16 2003/06/30 17:06:10 mast Exp $ */ /* New memory searcher functions */ @@ -84,7 +84,7 @@ void free_mem_searcher(void *m) ( ((PTR)[3] << 24) + ( (PTR)[2] << 16 ) +( (PTR)[1] << 8 ) + (PTR)[0] ) #endif /* PIKE_BYTEORDER == 4321 */ -#define HUBBE_ALIGN0(q) q=(char *)((((char *)q)-(char *)0) & -sizeof(INT32)) +#define HUBBE_ALIGN0(q) q=(char *)(PTR_TO_INT(q) & -sizeof(INT32)) #define GET_4_ALIGNED_CHARS0(PTR) (*(INT32 *)(PTR)) #define GET_4_UNALIGNED_CHARS0(PTR) EXTRACT_INT(PTR) diff --git a/src/pike_search_engine2.c b/src/pike_search_engine2.c index 8667082f5686515d3ff5bdfd65368307fed012dc..4b772570ec96e8e5af54b5fff53825a16dc68f4f 100644 --- a/src/pike_search_engine2.c +++ b/src/pike_search_engine2.c @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: pike_search_engine2.c,v 1.8 2003/01/09 14:28:50 grubba Exp $ +|| $Id: pike_search_engine2.c,v 1.9 2003/06/30 17:06:10 mast Exp $ */ /* @@ -42,8 +42,7 @@ INLINE HCHAR *NameNH(memchr_search)(void *data, ptrdiff_t haystacklen) { return NameNH(MEMCHR)(haystack, - DO_NOT_WARN((NCHAR)(ptrdiff_t) - (((char *)data)-(char *)0)), + DO_NOT_WARN((NCHAR)(ptrdiff_t) PTR_TO_INT(data)), haystacklen); } diff --git a/src/pike_threadlib.h b/src/pike_threadlib.h index 2a0757f1836135b800be4a6238b10b37af750226..9ffb593e0017323a525fd3dc79d9b60d8d611e96 100644 --- a/src/pike_threadlib.h +++ b/src/pike_threadlib.h @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: pike_threadlib.h,v 1.46 2003/06/26 08:28:17 tomas Exp $ +|| $Id: pike_threadlib.h,v 1.47 2003/06/30 17:06:10 mast Exp $ */ #ifndef PIKE_THREADLIB_H @@ -826,7 +826,7 @@ PMOD_EXPORT extern int Pike_in_gc; #define low_th_init() #define th_cleanup() #define th_init_programs() -#define th_self() ((void*)0) +#define th_self() NULL #define co_wait(X,Y) #define co_signal(X) #define co_broadcast(X) diff --git a/src/pike_types.c b/src/pike_types.c index c736b1ed20c0911f246343e212c222f48db9426b..e7aa67f1e7d149187742c8ff1a476f214b644c3d 100644 --- a/src/pike_types.c +++ b/src/pike_types.c @@ -2,11 +2,11 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: pike_types.c,v 1.217 2003/06/12 18:57:16 nilsson Exp $ +|| $Id: pike_types.c,v 1.218 2003/06/30 17:06:10 mast Exp $ */ #include "global.h" -RCSID("$Id: pike_types.c,v 1.217 2003/06/12 18:57:16 nilsson Exp $"); +RCSID("$Id: pike_types.c,v 1.218 2003/06/30 17:06:10 mast Exp $"); #include <ctype.h> #include "svalue.h" #include "pike_types.h" @@ -321,8 +321,8 @@ static inline struct pike_type *debug_mk_type(unsigned INT32 type, { unsigned INT32 hash = DO_NOT_WARN((unsigned INT32) ((ptrdiff_t)type*0x10204081)^ - (0x8003*(((char *)car)-(char *)0))^ - ~(0x10001*(((char *)cdr)-(char *)0))); + (0x8003*PTR_TO_INT(car))^ + ~(0x10001*PTR_TO_INT(cdr))); unsigned INT32 index = hash % pike_type_hash_size; struct pike_type *t; @@ -812,8 +812,7 @@ void debug_push_finished_type_with_markers(struct pike_type *type, if (type->type == T_ASSIGN) { /* Strip assign */ #if 0 - fprintf(stderr, "Assign to marker %d.\n", - ((char *)type->car)-(char *)0); + fprintf(stderr, "Assign to marker %d.\n", CAR_TO_INT(type); #endif /* 0 */ type = type->cdr; goto recurse; @@ -1415,8 +1414,7 @@ void simple_describe_type(struct pike_type *s) break; case T_SCOPE: - fprintf(stderr, "scope(%ld, ", - (long)(((char *)s->car)-(char *)0)); + fprintf(stderr, "scope(%"PRINTSIZET"d, ", CAR_TO_INT(s)); simple_describe_type(s->cdr); fprintf(stderr, ")"); break; @@ -1428,14 +1426,13 @@ void simple_describe_type(struct pike_type *s) fprintf(stderr, ")"); break; case T_ASSIGN: - fprintf(stderr, "%ld = ", - (long)(((char *)s->car)-(char *)0)); + fprintf(stderr, "%"PRINTSIZET"d = ", CAR_TO_INT(s)); simple_describe_type(s->cdr); break; case T_INT: { - INT32 min = ((char *)s->car)-(char *)0; - INT32 max = ((char *)s->cdr)-(char *)0; + INT32 min = CAR_TO_INT(s); + INT32 max = CDR_TO_INT(s); fprintf(stderr, "int"); if(min!=MIN_INT32 || max!=MAX_INT32) fprintf(stderr, "(%ld..%ld)",(long)min,(long)max); @@ -1454,9 +1451,9 @@ void simple_describe_type(struct pike_type *s) fprintf(stderr, ")"); break; case T_OBJECT: - fprintf(stderr, "object(%s %ld)", + fprintf(stderr, "object(%s %"PRINTSIZET"d)", s->car?"is":"implements", - (long)(((char *)s->cdr)-(char *)0)); + CDR_TO_INT(s)); break; case T_FUNCTION: case T_MANY: @@ -1567,7 +1564,7 @@ static void low_describe_type(struct pike_type *t) case T_ASSIGN: my_putchar('('); - my_putchar('0' + (((char *)t->car)-(char *)0)); + my_putchar('0' + CAR_TO_INT(t)); my_putchar('='); my_describe_type(t->cdr); my_putchar(')'); @@ -1575,7 +1572,7 @@ static void low_describe_type(struct pike_type *t) case T_SCOPE: my_putchar('{'); - my_putchar(((char *)t->car)-(char *)0); + my_putchar(CAR_TO_INT(t)); my_putchar(','); my_describe_type(t->cdr); my_putchar('}'); @@ -1595,8 +1592,8 @@ static void low_describe_type(struct pike_type *t) case PIKE_T_UNKNOWN: my_strcat("unknown"); break; case T_INT: { - INT32 min=((char *)t->car)-(char *)0; - INT32 max=((char *)t->cdr)-(char *)0; + INT32 min=CAR_TO_INT(t); + INT32 max=CDR_TO_INT(t); my_strcat("int"); if(min!=MIN_INT32 || max!=MAX_INT32) @@ -1622,9 +1619,9 @@ static void low_describe_type(struct pike_type *t) if (t->cdr) { char buffer[100]; - sprintf(buffer,"object(%s %ld)", + sprintf(buffer,"object(%s %"PRINTSIZET"d)", t->car?"is":"implements", - (long)(((char *)t->cdr)-(char *)0)); + CDR_TO_INT(t)); my_strcat(buffer); }else{ my_strcat("object"); @@ -1917,10 +1914,10 @@ static void low_or_pike_types(struct pike_type *t1, } else if(t1->type == T_INT && t2->type == T_INT) { - INT32 min1 = ((char *)t1->car)-(char *)0; - INT32 max1 = ((char *)t1->cdr)-(char *)0; - INT32 min2 = ((char *)t2->car)-(char *)0; - INT32 max2 = ((char *)t2->cdr)-(char *)0; + INT32 min1 = CAR_TO_INT(t1); + INT32 max1 = CDR_TO_INT(t1); + INT32 min2 = CAR_TO_INT(t2); + INT32 max2 = CDR_TO_INT(t2); if ((max1 + 1 < min2) || (max2 + 1 < min1)) { /* No overlap. */ @@ -1940,18 +1937,18 @@ static void low_or_pike_types(struct pike_type *t1, if (t2->type == T_SCOPE) { low_or_pike_types(t1->cdr, t2->cdr, zero_implied); if (t1->car > t2->car) - push_scope_type(((char *)t1->car)-(char *)0); + push_scope_type(CAR_TO_INT(t1)); else - push_scope_type(((char *)t2->car)-(char *)0); + push_scope_type(CAR_TO_INT(t2)); } else { low_or_pike_types(t1->cdr, t2, zero_implied); - push_scope_type(((char *)t1->car)-(char *)0); + push_scope_type(CAR_TO_INT(t1)); } } else if (t2->type == T_SCOPE) { low_or_pike_types(t1, t2->cdr, zero_implied); - push_scope_type(((char *)t2->car)-(char *)0); + push_scope_type(CAR_TO_INT(t2)); push_type(T_SCOPE); } else @@ -1997,12 +1994,12 @@ static void even_lower_and_pike_types(struct pike_type *t1, if (t1->type == T_INT) { INT32 i1, i2; INT32 upper_bound, lower_bound; - i1 = ((char *)t1->cdr)-(char *)0; - i2 = ((char *)t2->cdr)-(char *)0; + i1 = CDR_TO_INT(t1); + i2 = CDR_TO_INT(t2); upper_bound = MINIMUM(i1,i2); - i1 = ((char *)t1->car)-(char *)0; - i2 = ((char *)t2->car)-(char *)0; + i1 = CAR_TO_INT(t1); + i2 = CAR_TO_INT(t2); lower_bound = MAXIMUM(i1,i2); if (upper_bound >= lower_bound) { @@ -2098,12 +2095,12 @@ static void low_and_pike_types(struct pike_type *t1, { INT32 i1,i2; INT32 upper_bound, lower_bound; - i1 = ((char *)t1->cdr)-(char *)0; - i2 = ((char *)t2->cdr)-(char *)0; + i1 = CDR_TO_INT(t1); + i2 = CDR_TO_INT(t2); upper_bound = MINIMUM(i1,i2); - i1 = ((char *)t1->car)-(char *)0; - i2 = ((char *)t2->car)-(char *)0; + i1 = CAR_TO_INT(t1); + i2 = CAR_TO_INT(t2); lower_bound = MAXIMUM(i1,i2); if (upper_bound >= lower_bound) { @@ -2119,18 +2116,18 @@ static void low_and_pike_types(struct pike_type *t1, if (t2->type == T_SCOPE) { low_and_pike_types(t1->cdr, t2->cdr); if (t1->car > t2->car) - push_scope_type(((char *)t1->car)-(char *)0); + push_scope_type(CAR_TO_INT(t1)); else - push_scope_type(((char *)t2->car)-(char *)0); + push_scope_type(CAR_TO_INT(t2)); } else { low_and_pike_types(t1->cdr, t2); - push_scope_type(((char *)t1->car)-(char *)0); + push_scope_type(CAR_TO_INT(t1)); } } else if (t2->type == T_SCOPE) { low_and_pike_types(t1, t2->cdr); - push_scope_type(((char *)t2->car)-(char *)0); + push_scope_type(CAR_TO_INT(t2)); } else if((t1->type == t2->type) && ((t1->type == T_STRING) || @@ -2176,7 +2173,7 @@ static struct pike_type *low_object_lfun_type(struct pike_type *t, short lfun) { struct program *p; int i; - p = id_to_program(((char *)t->cdr)-(char *)0); + p = id_to_program(CDR_TO_INT(t)); if(!p) return 0; i=FIND_LFUN(p, lfun); if(i==-1) return 0; @@ -2312,7 +2309,7 @@ static struct pike_type *low_match_types2(struct pike_type *a, ret = low_match_types(a->cdr, b, flags); if(ret && (b->type != T_VOID)) { - int m = ((char *)a->car)-(char *)0; + int m = CAR_TO_INT(a); struct pike_type *tmp; #ifdef PIKE_DEBUG @@ -2347,7 +2344,7 @@ static struct pike_type *low_match_types2(struct pike_type *a, } #endif #ifdef PIKE_DEBUG - if((((char *)a_markers[m]->type)-(char *)0) == m+'0') + if(PTR_TO_INT(a_markers[m]->type) == m+'0') Pike_fatal("Cyclic type!\n"); #endif } @@ -2406,7 +2403,7 @@ static struct pike_type *low_match_types2(struct pike_type *a, ret = low_match_types(a, b->cdr, flags); if(ret && (a->type != T_VOID)) { - int m = ((char *)b->car)-(char *)0; + int m = CAR_TO_INT(b); struct pike_type *tmp; type_stack_mark(); push_finished_type_with_markers(a, a_markers); @@ -2433,7 +2430,7 @@ static struct pike_type *low_match_types2(struct pike_type *a, } #endif #ifdef PIKE_DEBUG - if((((char *)b_markers[m]->type)-(char *)0) == m+'0') + if(PTR_TO_INT(b_markers[m]->type) == m+'0') Pike_fatal("Cyclic type!\n"); #endif } @@ -2549,16 +2546,14 @@ static struct pike_type *low_match_types2(struct pike_type *a, } case TWOT(T_INT, T_ZERO): { - if (((((char *)a->car)-(char *)0) > 0) || - ((((char *)a->cdr)-(char *)0) < 0)) { + if ((CAR_TO_INT(a) > 0) || (CDR_TO_INT(a) < 0)) { return 0; } return a; } case TWOT(T_ZERO, T_INT): { - if (((((char *)b->car)-(char *)0) > 0) || - ((((char *)b->cdr)-(char *)0) < 0)) { + if ((CAR_TO_INT(b) > 0) || (CDR_TO_INT(b) < 0)) { return 0; } return a; @@ -2659,8 +2654,8 @@ static struct pike_type *low_match_types2(struct pike_type *a, * (got "Prototype doesn't match for function foo" even though * there was no other prototype for that function). /mast */ struct program *ap,*bp; - ap = id_to_program(((char *)a->cdr)-(char *)0); - bp = id_to_program(((char *)b->cdr)-(char *)0); + ap = id_to_program(CDR_TO_INT(a)); + bp = id_to_program(CDR_TO_INT(b)); if (!is_compatible(ap, bp)) return 0; #endif break; @@ -2669,8 +2664,8 @@ static struct pike_type *low_match_types2(struct pike_type *a, { struct program *ap,*bp; - ap = id_to_program(((char *)a->cdr)-(char *)0); - bp = id_to_program(((char *)b->cdr)-(char *)0); + ap = id_to_program(CDR_TO_INT(a)); + bp = id_to_program(CDR_TO_INT(b)); if(!ap || !bp) break; @@ -2696,11 +2691,11 @@ static struct pike_type *low_match_types2(struct pike_type *a, case T_INT: { - INT32 amin = ((char *)a->car)-(char *)0; - INT32 amax = ((char *)a->cdr)-(char *)0; + INT32 amin = CAR_TO_INT(a); + INT32 amax = CDR_TO_INT(a); - INT32 bmin = ((char *)b->car)-(char *)0; - INT32 bmax = ((char *)b->cdr)-(char *)0; + INT32 bmin = CAR_TO_INT(b); + INT32 bmax = CDR_TO_INT(b); if(amin > bmax || bmin > amax) return 0; break; @@ -2863,7 +2858,7 @@ static int low_pike_types_le2(struct pike_type *a, struct pike_type *b, ret = low_pike_types_le(a->cdr, b, array_cnt, flags); if(ret && (b->type != T_VOID)) { - int m = ((char *)a->car)-(char *)0; + int m = CAR_TO_INT(a); struct pike_type *tmp; int i; type_stack_mark(); @@ -2947,7 +2942,7 @@ static int low_pike_types_le2(struct pike_type *a, struct pike_type *b, ret = low_pike_types_le(a, b->cdr, array_cnt, flags); if(ret && (a->type != T_VOID)) { - int m = ((char *)b->car)-(char *)0; + int m = CAR_TO_INT(b); struct pike_type *tmp; int i; type_stack_mark(); @@ -3216,8 +3211,8 @@ static int low_pike_types_le2(struct pike_type *a, struct pike_type *b, } { - struct program *ap = id_to_program(((char *)a->cdr)-(char *)0); - struct program *bp = id_to_program(((char *)b->cdr)-(char *)0); + struct program *ap = id_to_program(CDR_TO_INT(a)); + struct program *bp = id_to_program(CDR_TO_INT(b)); if (!ap || !bp) { /* Shouldn't happen... */ @@ -3232,11 +3227,11 @@ static int low_pike_types_le2(struct pike_type *a, struct pike_type *b, case T_INT: { - INT32 amin = ((char *)a->car)-(char *)0; - INT32 amax = ((char *)a->cdr)-(char *)0; + INT32 amin = CAR_TO_INT(a); + INT32 amax = CDR_TO_INT(a); - INT32 bmin = ((char *)b->car)-(char *)0; - INT32 bmax = ((char *)b->cdr)-(char *)0; + INT32 bmin = CAR_TO_INT(b); + INT32 bmax = CDR_TO_INT(b); if(amin < bmin || amax > bmax) return 0; break; @@ -3436,7 +3431,7 @@ static struct pike_type *debug_low_index_type(struct pike_type *t, { case T_OBJECT: { - p = id_to_program(((char *)t->cdr)-(char *)0); + p = id_to_program(CDR_TO_INT(t)); comefrom_int_index: if(p && n) @@ -3615,7 +3610,7 @@ static struct pike_type *debug_low_range_type(struct pike_type *t, { case T_OBJECT: { - p = id_to_program(((char *)t->cdr)-(char *)0); + p = id_to_program(CDR_TO_INT(t)); if(p) { @@ -3797,7 +3792,7 @@ static struct pike_type *debug_low_key_type(struct pike_type *t, node *n) { case T_OBJECT: { - struct program *p = id_to_program(((char *)t->cdr)-(char *)0); + struct program *p = id_to_program(CDR_TO_INT(t)); if(p && n) { if(n->token == F_ARROW) @@ -3906,7 +3901,7 @@ static int low_check_indexing(struct pike_type *type, case T_OBJECT: { - struct program *p = id_to_program(((char *)type->cdr)-(char *)0); + struct program *p = id_to_program(CDR_TO_INT(type)); if(p) { if(n->token == F_ARROW) @@ -4383,7 +4378,7 @@ static struct pike_type *low_object_type_to_program_type(struct pike_type *obj_t } sval.type = T_PROGRAM; if ((obj_t->type != T_OBJECT) || - (!(id = ((char *)obj_t->cdr)-(char *)0)) || + (!(id = CDR_TO_INT(obj_t))) || (!(sval.u.program = id_to_program(id))) || (!(sub = get_type_of_svalue(&sval)))) { if (res) { @@ -4446,7 +4441,7 @@ int type_may_overload(struct pike_type *type, int lfun) case T_OBJECT: { - struct program *p = id_to_program(((char *)type->cdr)-(char *)0); + struct program *p = id_to_program(CDR_TO_INT(type)); if(!p) return 1; return FIND_LFUN(p, lfun)!=-1; } @@ -4789,9 +4784,9 @@ static void low_type_to_string(struct pike_type *t) { INT32 i; my_putchar(T_OBJECT); - i = (INT32)(((char *)t->car)-(char *)0); + i = (INT32)CAR_TO_INT(t); my_putchar( i ); - i = (INT32)(((char *)t->cdr)-(char *)0); + i = (INT32)CDR_TO_INT(t); if( i > 65535 ) i = 0; /* Not constant between recompilations */ @@ -4806,12 +4801,12 @@ static void low_type_to_string(struct pike_type *t) { INT32 i; my_putchar(T_INT); - i = (INT32)(((char *)t->car)-(char *)0); + i = (INT32)CAR_TO_INT(t); my_putchar((i >> 24) & 0xff); my_putchar((i >> 16) & 0xff); my_putchar((i >> 8) & 0xff); my_putchar(i & 0xff); - i = (INT32)(((char *)t->cdr)-(char *)0); + i = (INT32)CDR_TO_INT(t); my_putchar((i >> 24) & 0xff); my_putchar((i >> 16) & 0xff); my_putchar((i >> 8) & 0xff); @@ -4834,7 +4829,7 @@ static void low_type_to_string(struct pike_type *t) case T_SCOPE: case T_ASSIGN: my_putchar(t->type); - my_putchar('0' + (((char *)t->car)-(char *)0)); + my_putchar('0' + CAR_TO_INT(t)); t = t->cdr; goto recurse; diff --git a/src/port.c b/src/port.c index c669c8a1103386331264181bfd18f883062809e6..38ccf9d6cfc0bda626a742ed2e808756c815916f 100644 --- a/src/port.c +++ b/src/port.c @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: port.c,v 1.71 2003/04/02 21:37:48 mast Exp $ +|| $Id: port.c,v 1.72 2003/06/30 17:06:10 mast Exp $ */ /* @@ -27,7 +27,7 @@ #include <float.h> #include <string.h> -RCSID("$Id: port.c,v 1.71 2003/04/02 21:37:48 mast Exp $"); +RCSID("$Id: port.c,v 1.72 2003/06/30 17:06:10 mast Exp $"); #ifdef sun time_t time PROT((time_t *)); @@ -160,7 +160,7 @@ long STRTOL(const char *str,char **ptr,int base) int c; int xx, neg = 0, add_limit, overflow = 0; - if (ptr != (char **)0) + if (ptr != (char **)NULL) *ptr = (char *)str; /* in case no number is formed */ if (base < 0 || base > MBASE) return (0); /* base is invalid -- should be a fatal error */ @@ -211,7 +211,7 @@ long STRTOL(const char *str,char **ptr,int base) val = base * val + xx; } - if (ptr != (char **)0) + if (ptr != (char **)NULL) *ptr = (char *)str; if (overflow) { errno = ERANGE; @@ -397,7 +397,7 @@ PMOD_EXPORT void *MEMCHR(const void *p,char c,size_t e) { const char *t = p; while(e--) if(*(t++)==c) return t-1; - return (char *)0; + return (char *)NULL; } #endif diff --git a/src/port.h b/src/port.h index 63644cd5a09c464931b4d2d5a858ccc2a2b14d24..14b1dd2cfe3ea067e9c666065976c7f19d249ef3 100644 --- a/src/port.h +++ b/src/port.h @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: port.h,v 1.50 2003/04/02 19:22:43 mast Exp $ +|| $Id: port.h,v 1.51 2003/06/30 17:06:10 mast Exp $ */ #ifndef PORT_H @@ -41,7 +41,7 @@ struct timeval; void GETTIMEOFDAY(struct timeval *t); #else # ifdef GETTIMEOFDAY_TAKES_TWO_ARGS -# define GETTIMEOFDAY(X) gettimeofday((X),(void *)0) +# define GETTIMEOFDAY(X) gettimeofday((X),NULL) # else # define GETTIMEOFDAY gettimeofday # endif diff --git a/src/signal_handler.c b/src/signal_handler.c index e5feed358daca44c49f6cfaa27a7b6ebd91b4432..b9ef62fe6625b91e7fb1bd278b3380c9c5b78854 100644 --- a/src/signal_handler.c +++ b/src/signal_handler.c @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: signal_handler.c,v 1.273 2003/05/23 10:58:17 grubba Exp $ +|| $Id: signal_handler.c,v 1.274 2003/06/30 17:06:10 mast Exp $ */ #include "global.h" @@ -26,7 +26,7 @@ #include "main.h" #include <signal.h> -RCSID("$Id: signal_handler.c,v 1.273 2003/05/23 10:58:17 grubba Exp $"); +RCSID("$Id: signal_handler.c,v 1.274 2003/06/30 17:06:10 mast Exp $"); #ifdef HAVE_PASSWD_H # include <passwd.h> @@ -1871,7 +1871,7 @@ static void f_proc_reg_index(INT32 args) } if ((val = ptrace(PTRACE_PEEKUSER, proc->pid, - ((long *)(((struct user *)0)->regs)) + regno, 0)) == -1) { + ((long *)(((struct user *)NULL)->regs)) + regno, 0)) == -1) { int err = errno; /* FIXME: Better diagnostics. */ if (errno) { diff --git a/src/svalue.c b/src/svalue.c index 5d0e593122d9e1ba25c2ed6f9781d58e2bb529e6..4e438f1d3ac6424632c0f96f7d63538a4ef26789 100644 --- a/src/svalue.c +++ b/src/svalue.c @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: svalue.c,v 1.167 2003/05/11 12:54:35 grubba Exp $ +|| $Id: svalue.c,v 1.168 2003/06/30 17:06:10 mast Exp $ */ #include "global.h" @@ -66,7 +66,7 @@ static int pike_isnan(double x) #endif /* HAVE__ISNAN */ #endif /* HAVE_ISNAN */ -RCSID("$Id: svalue.c,v 1.167 2003/05/11 12:54:35 grubba Exp $"); +RCSID("$Id: svalue.c,v 1.168 2003/06/30 17:06:10 mast Exp $"); struct svalue dest_ob_zero = { T_INT, 0, @@ -523,9 +523,9 @@ PMOD_EXPORT unsigned INT32 hash_svalue(const struct svalue *s) } default: #if SIZEOF_CHAR_P > 4 - q=DO_NOT_WARN((unsigned INT32)((((char *)s->u.refs)-(char *)0) >> 2)); + q=DO_NOT_WARN((unsigned INT32)(PTR_TO_INT(s->u.refs) >> 2)); #else - q=DO_NOT_WARN((unsigned INT32)(((char *)s->u.refs)-(char *)0)); + q=DO_NOT_WARN((unsigned INT32)(PTR_TO_INT(s->u.refs))); #endif break; case T_INT: q=s->u.integer; break; diff --git a/src/threads.c b/src/threads.c index f5e53635f1b73cd0e2aeaad338a72b795aab977b..d94de3bfb93374bdf7372f5787713dd1991362f1 100644 --- a/src/threads.c +++ b/src/threads.c @@ -2,12 +2,12 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: threads.c,v 1.218 2003/06/26 08:28:17 tomas Exp $ +|| $Id: threads.c,v 1.219 2003/06/30 17:06:10 mast Exp $ */ #ifndef CONFIGURE_TEST #include "global.h" -RCSID("$Id: threads.c,v 1.218 2003/06/26 08:28:17 tomas Exp $"); +RCSID("$Id: threads.c,v 1.219 2003/06/30 17:06:10 mast Exp $"); PMOD_EXPORT int num_threads = 1; PMOD_EXPORT int threads_disabled = 0; @@ -1458,7 +1458,7 @@ void f_thread_id__sprintf (INT32 args) return; } push_constant_text ("Thread.Thread("); - push_int64(((char *)THREAD_T_TO_PTR(THIS_THREAD->id))-(char *)0); + push_int64(PTR_TO_INT(THREAD_T_TO_PTR(THIS_THREAD->id))); push_constant_text (")"); f_add (3); } @@ -1473,7 +1473,7 @@ void f_thread_id__sprintf (INT32 args) void f_thread_id_id_number(INT32 args) { pop_n_elems(args); - push_int64(((char *)THREAD_T_TO_PTR(THIS_THREAD->id))-(char *)0); + push_int64(PTR_TO_INT(THREAD_T_TO_PTR(THIS_THREAD->id))); } /*! @decl mixed result()