ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/func.c
(Generate patch)

Comparing ray/src/rt/func.c (file contents):
Revision 2.31 by greg, Tue Mar 22 03:56:17 2016 UTC vs.
Revision 2.32 by greg, Wed Apr 27 21:11:32 2016 UTC

# Line 37 | Line 37 | static double  l_erf(char *), l_erfc(char *), l_arg(ch
37  
38  
39   void
40 < initfunc()      /* initialize function evaluation */
40 > initfunc(void)  /* initialize function evaluation */
41   {
42          if (!rayinitcal[0])     /* already done? */
43                  return;
# Line 67 | Line 67 | initfunc()     /* initialize function evaluation */
67   void
68   set_eparams(char *prms)
69   {
70 <        static char     *last_params = NULL;
70 >        static char     *last_params;
71 >        static int      lplen = 0;
72 >        int             len;
73          char            vname[RMAXWORD];
74          double          value;
75          char            *cpd;
76                                          /* check if already set */
77 <        if ((prms == NULL) | (prms == last_params))
77 >        if (prms == NULL || !*prms)
78                  return;
79 <        if (last_params != NULL && !strcmp(prms, last_params))
79 >        if (lplen && !strcmp(prms, last_params))
80                  return;
81 <        last_params = prms;             /* assign each variable */
81 >        len = strlen(prms);             /* record new settings */
82 >        if ((lplen != 0) & (lplen <= len)) {
83 >                free(last_params);
84 >                lplen = 0;
85 >        }
86 >        if (!lplen) {
87 >                lplen = len + 100;
88 >                last_params = (char *)malloc(lplen);
89 >                if (last_params == NULL)
90 >                        error(SYSTEM, "out of memory in set_eparams()");
91 >        }
92 >        strcpy(last_params, prms);
93 >                                        /* assign each variable */
94          while (*prms) {
95                  if (isspace(*prms)) {
96                          ++prms; continue;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines