[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 1ffa2bc: Correct initialization of binary arra
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 1ffa2bc: Correct initialization of binary array to make profiles |
Date: |
Fri, 12 May 2017 20:08:44 -0400 (EDT) |
branch: master
commit 1ffa2bcf7e8eaef630e653775b9217773ed8ff33
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>
Correct initialization of binary array to make profiles
During the building of a profile, MakeProfiles creates a binary array the
size of the desired profile and marks every pixel that has not been created
so it doesn't inspect one pixel more than once while looking at the
neighbors.
Previously we were allocating this array and clearning it manually, but
recently, it was replaced with the allocation functions within
`data.h'. However, instead of `gal_data_calloc_array', I had mistakenly
used `gal_data_malloc_array'. So the space for this array was not
initialized and would create strangely looking profiles (depending on what
was there in memory before). This bug was reported by Rosa Calvi and is
corrected with this commit.
Also, the comments in the Emacs `.dir-locals.el' file were all aligned for
easier reading.
---
.dir-locals.el | 8 ++++----
bin/mkprof/mkprof.c | 3 ++-
bin/mkprof/oneprofile.c | 2 +-
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/.dir-locals.el b/.dir-locals.el
index 74fa422..af98cc8 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -11,10 +11,10 @@
((nil
(indent-tabs-mode . nil) ;; No tabs as indentation
- (fill-column . 75)) ;; 75-character wide lines
+ (fill-column . 75)) ;; 75-character wide lines
(c-mode
- (c-basic-offset . 2) ;; 2 spaces of indentation
- (c-file-style . "gnu")) ;; GNU style for braces
+ (c-basic-offset . 2) ;; 2 spaces of indentation
+ (c-file-style . "gnu")) ;; GNU style for braces
(makefile-mode
- (indent-tabs-mode . t)) ;; Real TABs are important in makefiles
+ (indent-tabs-mode . t)) ;; Real TABs are important in makefiles
)
diff --git a/bin/mkprof/mkprof.c b/bin/mkprof/mkprof.c
index 7db17e8..d768b1d 100644
--- a/bin/mkprof/mkprof.c
+++ b/bin/mkprof/mkprof.c
@@ -316,6 +316,7 @@ mkprof_build(void *inparam)
fbq=NULL;
mkp->ibq=NULL;
}
+
/* The mutex couldn't be locked and there are no more
objects for this thread to build (giving a chance for
this thread to add up its built profiles). So we have to
@@ -489,7 +490,7 @@ mkprof_write(struct mkprofparams *p)
if(!p->cp.quiet)
{
asprintf(&jobname, "row %zu complete, %zu left to go",
- ibq->id, num-complete);
+ ibq->id, num-complete);
gal_timing_report(NULL, jobname, 2);
free(jobname);
}
diff --git a/bin/mkprof/oneprofile.c b/bin/mkprof/oneprofile.c
index db84ac6..682d66a 100644
--- a/bin/mkprof/oneprofile.c
+++ b/bin/mkprof/oneprofile.c
@@ -253,7 +253,7 @@ makepixbypix(struct mkonthread *mkp)
{ img[p]=1; return; }
/* Allocate the byt array to not repeat completed pixels. */
- byt = gal_data_malloc_array(GAL_TYPE_UINT8, is0*is1);
+ byt = gal_data_calloc_array(GAL_TYPE_UINT8, is0*is1);
/* Start the queue: */
byt[p]=1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnuastro-commits] master 1ffa2bc: Correct initialization of binary array to make profiles,
Mohammad Akhlaghi <=