=================================================================== RCS file: /home/cvs/OpenXM_contrib/gnuplot/Attic/util.c,v retrieving revision 1.1.1.2 retrieving revision 1.1.1.3 diff -u -p -r1.1.1.2 -r1.1.1.3 --- OpenXM_contrib/gnuplot/Attic/util.c 2000/01/22 14:16:02 1.1.1.2 +++ OpenXM_contrib/gnuplot/Attic/util.c 2003/09/15 07:09:27 1.1.1.3 @@ -1,5 +1,5 @@ #ifndef lint -static char *RCSid = "$Id: util.c,v 1.1.1.2 2000/01/22 14:16:02 maekawa Exp $"; +static char *RCSid = "$Id: util.c,v 1.1.1.3 2003/09/15 07:09:27 ohara Exp $"; #endif /* GNUPLOT - util.c */ @@ -308,7 +308,28 @@ int start, end; } +/* Our own version of strdup() + * Make copy of string into gp_alloc'd memory + * As with all conforming str*() functions, + * it is the caller's responsibility to pass + * valid parameters! + */ +char * +gp_strdup(s) +char *s; +{ + char *d; +#ifndef HAVE_STRDUP + d = gp_alloc(strlen(s) + 1, "gp_strdup"); + if (d) + memcpy (d, s, strlen(s) + 1); +#else + d = strdup(s); +#endif + return d; +} + void convert(val_ptr, t_num) struct value *val_ptr; int t_num; @@ -413,13 +434,13 @@ struct value *val; { switch (val->type) { case INTGR: - return ((val->v.int_val >= 0) ? 0.0 : Pi); + return ((val->v.int_val >= 0) ? 0.0 : M_PI); case CMPLX: if (val->v.cmplx_val.imag == 0.0) { if (val->v.cmplx_val.real >= 0.0) return (0.0); else - return (Pi); + return (M_PI); } return (atan2(val->v.cmplx_val.imag, val->v.cmplx_val.real));