From de9fbc4335a5d2e3896381403f4b1b5b19dcf444 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 5 Dec 2017 12:16:20 +0100 Subject: const-cleanliness (and a bit of error checking) --- src/scaling.c | 28 +++++++++++++++++++--------- src/scaling.h | 2 +- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/scaling.c b/src/scaling.c index ea2a47bd..97503b89 100644 --- a/src/scaling.c +++ b/src/scaling.c @@ -459,10 +459,11 @@ void scale_all(Crystal **crystals, int n_crystals, int nthreads, } -int linear_scale(RefList *list1, const RefList *list2, double *G) +/* Calculates G, by which list2 should be multiplied to fit list1 */ +int linear_scale(const RefList *list1, const RefList *list2, double *G) { - Reflection *refl1; - Reflection *refl2; + const Reflection *refl1; + const Reflection *refl2; RefListIterator *iter; int max_n = 256; int n = 0; @@ -482,9 +483,9 @@ int linear_scale(RefList *list1, const RefList *list2, double *G) } int nb = 0; - for ( refl1 = first_refl(list1, &iter); + for ( refl1 = first_refl_const(list1, &iter); refl1 != NULL; - refl1 = next_refl(refl1, iter) ) + refl1 = next_refl_const(refl1, iter) ) { signed int h, k, l; double Ih1, Ih2; @@ -542,15 +543,24 @@ int linear_scale(RefList *list1, const RefList *list2, double *G) void scale_all_to_reference(Crystal **crystals, int n_crystals, - RefList *reference) + const RefList *reference) { int i; for ( i=0; i