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

Comparing ray/src/util/rcomb.c (file contents):
Revision 2.5 by greg, Tue Dec 19 20:38:38 2023 UTC vs.
Revision 2.8 by greg, Thu May 16 18:59:19 2024 UTC

# Line 9 | Line 9 | static const char RCSid[] = "$Id$";
9   #include <math.h>
10   #include "platform.h"
11   #include "rtio.h"
12 #include "resolu.h"
12   #include "rmatrix.h"
13   #include "calcomp.h"
14   #include "paths.h"
# Line 680 | Line 679 | resize_inparr(int n2alloc)
679   {
680          int     i;
681  
682 <        for (i = nmats; i > n2alloc; i--) {
682 >        if (n2alloc == nall)
683 >                return;
684 >        for (i = nall; i > n2alloc; i--) {
685                  rmx_reset(&mop[i].imx);
686                  if (mop[i].rmp != &mop[i].imx)
687                          rmx_free(mop[i].rmp);
# Line 690 | Line 691 | resize_inparr(int n2alloc)
691                  fputs("Out of memory in resize_inparr()\n", stderr);
692                  exit(1);
693          }
694 <        if (n2alloc > nmats)
695 <                memset(mop+nmats, 0, (n2alloc-nmats)*sizeof(ROPMAT));
694 >        if (n2alloc > nall)
695 >                memset(mop+nall, 0, (n2alloc-nall)*sizeof(ROPMAT));
696          nall = n2alloc;
697   }
698  
# Line 868 | Line 869 | main(int argc, char *argv[])
869                  fprintf(stderr, "%s: unsupported output format\n", argv[0]);
870                  return(1);
871          }
872 +        doptimize(1);                   /* optimize definitions */
873                                          /* process & write rows */
874          return(combine_input(&mop[nmats], stdout) ? 0 : 1);
875   stdin_error:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines