remove pointer to long conversions - part 1 of 3 (trunk only)

P64 (Win64) has a 64 bit pointer size, but a 32 bit long size.
Remove some code that forced pointers into a long int, and
vice versa where information could be lost.

This part deals with light source functions and their
arguments mostly, and switches some arguments
from type genericptr_t to 'anything'.
This commit is contained in:
nethack.allison
2006-07-08 18:24:01 +00:00
parent dbc3abb226
commit 699330928d
8 changed files with 102 additions and 47 deletions

View File

@@ -737,6 +737,11 @@ E void NDECL(drinksink);
/* ### hack.c ### */
E anything *FDECL(uint_to_any, (unsigned));
E anything *FDECL(long_to_any, (long));
E anything *FDECL(monst_to_any, (struct monst *));
E anything *FDECL(obj_to_any, (struct obj *));
E void FDECL(zero_anything, (ANY_P *));
E boolean FDECL(revive_nasty, (int,int,const char*));
E void FDECL(movobj, (struct obj *,XCHAR_P,XCHAR_P));
E boolean FDECL(may_dig, (XCHAR_P,XCHAR_P));
@@ -893,8 +898,8 @@ E int NDECL(dosuspend);
/* ### light.c ### */
E void FDECL(new_light_source, (XCHAR_P, XCHAR_P, int, int, genericptr_t));
E void FDECL(del_light_source, (int, genericptr_t));
E void FDECL(new_light_source, (XCHAR_P, XCHAR_P, int, int, ANY_P *));
E void FDECL(del_light_source, (int, ANY_P *));
E void FDECL(do_light_sources, (char **));
E struct monst *FDECL(find_mid, (unsigned, unsigned));
E void FDECL(save_light_sources, (int, int, int));

View File

@@ -43,7 +43,7 @@ typedef struct ls_t {
short range; /* source's current range */
short flags;
short type; /* type of light source */
genericptr_t id; /* source's identifier */
anything id; /* source's identifier */
} light_source;
#endif /* LEV_H */

View File

@@ -11,6 +11,7 @@ typedef int winid; /* a window identifier */
typedef union any {
genericptr_t a_void;
struct obj *a_obj;
struct monst *a_monst;
int a_int;
char a_char;
schar a_schar;