Skip to content

Commit 27a686f

Browse files
committed
Fix uninitialized variables in Union loggers
1 parent 014ccf2 commit 27a686f

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

mcstas-comps/union/Union_logger_1D.comp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ INITIALIZE
452452
sprintf(this_storage.Detector_1D.Filename,"%s",filename);
453453

454454
// detect variable type and set axis accordingly
455-
int variable_identifier; // 1 time, 2 |q|, ...
455+
int variable_identifier = 0; // 1 time, 2 |q|, ... set to 0 as placeholder to make linter play nice
456456
if (strcmp(variable,"time") == 0) {
457457
variable_identifier = 1;
458458
sprintf(this_storage.Detector_1D.string_axis,"time [s]");

mcstas-comps/union/Union_logger_2DQ.comp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ INITIALIZE
515515
printf("ERROR, Union logger 2DQ named \"%s\" has an invalid Q_direction_1 string, it should be \"x\",\"y\" or \"z\".\n",NAME_CURRENT_COMP);
516516
exit(1);
517517
}
518-
char temp_string[2];
518+
char temp_string[2] = "UN"; // UN stands for unset. Courtesy of linter play
519519
if (strcmp(Q_direction_2,"x") == 0 || strcmp(Q_direction_2,"X") == 0) {
520520
this_storage.dim_2_choice = 0;
521521
sprintf(this_storage.Detector_2D.string_axis_2,"Q_x [A^-1]");

mcstas-comps/union/Union_logger_2D_space.comp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ INITIALIZE
556556
exit(1);
557557
}
558558

559-
char temp_string[2];
559+
char temp_string[2] = "UN"; // UN stands for unset. Courtesy of linter play
560560
if (strcmp(D_direction_2,"x") == 0 || strcmp(D_direction_2,"X") == 0) {
561561
this_storage.dim_2_choice = 0;
562562
sprintf(this_storage.Detector_2D.string_axis_2,"x [m]");

mcstas-comps/union/Union_logger_3D_space.comp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ INITIALIZE
642642
exit(1);
643643
}
644644

645-
char temp_string[2];
645+
char temp_string[2] = "UN"; // UN stands for unset, courtesy of linter play
646646
if (strcmp(D_direction_2,"x") == 0 || strcmp(D_direction_2,"X") == 0) {
647647
this_storage.dim_2_choice = 0;
648648
sprintf(this_storage.Detector_3D.string_axis_2,"x [m]");

0 commit comments

Comments
 (0)