[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 38c8343: Arithmetic's isblank operator size co
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 38c8343: Arithmetic's isblank operator size corrected |
Date: |
Tue, 6 Sep 2016 13:18:18 +0000 (UTC) |
branch: master
commit 38c8343e4c56f78b8528f3b8be49911bcd4d0052
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>
Arithmetic's isblank operator size corrected
The `size' variable in Arithmetic's `opisblank' function was mistakenly set
at definition time, not after popping the operands. So `size' would be
given a value of 0 and the `isblank' operator was not doing anything! This
has been corrected now.
While I was developing, size was in its correct place but I hadn't added
the comment that is above it. So after implementing `isblank' and testing
it immediately before the commit, (having forgot the comment's main
argument) I took the setting of the value of size in the definition (before
popping). This shows how important this comment is, even though it is very
repetative in all the functions! While you are thinking on other issues,
you simply forget and these comments are necessary to remind you!
---
src/arithmetic/arithmetic.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/arithmetic/arithmetic.c b/src/arithmetic/arithmetic.c
index b8883c0..8311db2 100644
--- a/src/arithmetic/arithmetic.c
+++ b/src/arithmetic/arithmetic.c
@@ -844,13 +844,18 @@ conditionals(struct imgarithparams *p, char *operator)
void
opisblank(struct imgarithparams *p)
{
- size_t size=p->s0*p->s1;
+ size_t size;
char *operator="isblank";
double *f, *ff, fnum, *farr;
/* Pop out the number of operands needed. */
pop_operand(p, &fnum, &farr, operator);
+ /* Set the total number of pixels, note that we can't do this in the
+ definition of the variable because p->s0 and p->s1 will be set in
+ pop_operand for the first image. */
+ size=p->s0*p->s1;
+
/* Do the operation: */
if(farr) /* Operand is array. */
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnuastro-commits] master 38c8343: Arithmetic's isblank operator size corrected,
Mohammad Akhlaghi <=