Initialising 2D array with 0s

As usual, cppcheck pointed to it.

posemath/gomath.c:1785:3: error: Uninitialized variable: stg [uninitvar]
  go_matrix_init(N, Nspace, 4, 4);
  ^
posemath/gomath.c:1785:3: error: Uninitialized variable: stgcpy [uninitvar]
  go_matrix_init(N, Nspace, 4, 4);
  ^

Adapted suggestion by @rene-dev in https://github.com/LinuxCNC/linuxcnc/pull/1605
This commit is contained in:
Steffen Moeller 2022-02-13 16:27:52 +01:00
parent ae34398779
commit ab9e75c693

View file

@ -19,6 +19,7 @@
/* for debugging */
extern int printf(const char * fmt, ...);
#include <stddef.h> /* NULL */
#include <string.h> /* memset */
#include "rtapi_math.h"
#include <float.h>
@ -1765,6 +1766,8 @@ int go_cart_cart_pose(const go_cart * v1, const go_cart * v2,
go_real eigenval;
int retval;
memset(&Nspace,0,sizeof(Nspace));
Sxx = Sxy = Sxz = 0.0;
Syx = Syy = Syz = 0.0;
Szx = Szy = Szz = 0.0;