File: fix_wrong_initialisation_of_array.patch

package info (click to toggle)
phyml 3%3A3.3.20250515-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 8,096 kB
  • sloc: ansic: 93,774; makefile: 2,507; xml: 418; sh: 45
file content (26 lines) | stat: -rw-r--r-- 993 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Author: Andreas Tille <tille@debian.org>
        Thomas Schmitt <scdbackup@gmx.net>
Last-Update: 2017-06-24
Description: avoid initialisation an array with a scalar value
 Quoting James Cowgill <jcowgill@debian.org> on debian-mentors list:
 .
 You can't initialize an array with a scalar value (double[] != double).
 Also, using an array of fixed size 1 is a code smell (why use an array
 at all?)
 .
 The quick fix here is probably to wrap the values in curly braces to
 form a correct array initializer.

--- a/src/lk.c
+++ b/src/lk.c
@@ -2338,8 +2338,8 @@ void Update_PMat_At_Given_Edge(t_edge *b
       
       //
       len = MAX(0.0, b_fcus->l->v) * tree->mod->br_len_mult->v;
-      int p_matrices[1]     = b_fcus->Pij_rr_idx;
-      double branch_lens[1] = len;
+      int p_matrices[1]     = { b_fcus->Pij_rr_idx };
+      double branch_lens[1] = { len };
       int ret = beagleUpdateTransitionMatrices(tree->b_inst,0,p_matrices,NULL,NULL,branch_lens,1);
       if(ret<0)
         {