| 1 |
– |
/* Copyright (c) 1997 Regents of the University of California */ |
| 2 |
– |
|
| 1 |
|
#ifndef lint |
| 2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
| 2 |
> |
static const char RCSid[] = "$Id$"; |
| 3 |
|
#endif |
| 6 |
– |
|
| 4 |
|
/* |
| 5 |
|
* 3D warping routines. |
| 6 |
|
*/ |
| 7 |
|
|
| 8 |
|
#include <stdio.h> |
| 9 |
+ |
#include <stdlib.h> |
| 10 |
|
#include <math.h> |
| 11 |
|
#include "fvect.h" |
| 12 |
|
#include "warp3d.h" |
| 23 |
|
|
| 24 |
|
#define AHUNK 24 /* number of points to allocate at a time */ |
| 25 |
|
|
| 28 |
– |
#ifndef malloc |
| 29 |
– |
extern char *malloc(), *realloc(); |
| 30 |
– |
#endif |
| 31 |
– |
extern void free(); |
| 26 |
|
|
| 33 |
– |
|
| 27 |
|
double |
| 28 |
|
wpdist2(p1, p2) /* compute square of distance between points */ |
| 29 |
|
register W3VEC p1, p2; |
| 284 |
|
W3VCPY(wp->ulim, pti); |
| 285 |
|
} else { |
| 286 |
|
if (wp->npts % AHUNK == 0) { /* allocate another hunk */ |
| 287 |
< |
na = (W3VEC *)realloc((char *)wp->ip, |
| 287 |
> |
na = (W3VEC *)realloc((void *)wp->ip, |
| 288 |
|
(wp->npts+AHUNK)*sizeof(W3VEC)); |
| 289 |
|
if (na == NULL) return(0); |
| 290 |
|
wp->ip = na; |
| 291 |
< |
na = (W3VEC *)realloc((char *)wp->ov, |
| 291 |
> |
na = (W3VEC *)realloc((void *)wp->ov, |
| 292 |
|
(wp->npts+AHUNK)*sizeof(W3VEC)); |
| 293 |
|
if (na == NULL) return(0); |
| 294 |
|
wp->ov = na; |
| 321 |
|
register WARP3D *wp; |
| 322 |
|
{ |
| 323 |
|
done3dgrid(&wp->grid); |
| 324 |
< |
free((char *)wp->ip); |
| 325 |
< |
free((char *)wp->ov); |
| 326 |
< |
free((char *)wp); |
| 324 |
> |
free((void *)wp->ip); |
| 325 |
> |
free((void *)wp->ov); |
| 326 |
> |
free((void *)wp); |
| 327 |
|
} |
| 328 |
|
|
| 329 |
|
|
| 330 |
< |
long |
| 330 |
> |
unsigned long |
| 331 |
|
gridhash(gp) /* hash a grid point index */ |
| 332 |
|
GNDX gp; |
| 333 |
|
{ |