gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master e7d3511: Static attribute for non-exported lib


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master e7d3511: Static attribute for non-exported library functions
Date: Mon, 12 Sep 2016 13:00:13 +0000 (UTC)

branch: master
commit e7d35113cfb6454a340cb83ec73d780ea075d385
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    Static attribute for non-exported library functions
    
    The libraries contain some functions that are only internal to the
    library. They are not intended for outside usage, only to help in
    modularity of the library code. So a `static' attribute was added to them
    in the `.c' source files.
    
    Therefore, "1. No one will be able to use unintentionally a function from
    other module 2. In case of building a library the function will not be
    exposed as exported function, so it won't be visible to end-user and won't
    clutter up the list of exported functions." (quote from the bug report by
    Vladimir Markelov).
    
    This fixes bug #48610.
---
 lib/checkset.c                |    2 +-
 lib/fits.c                    |    2 +-
 lib/gnuastro/checkset.h       |    2 +-
 lib/gnuastro/mesh.h           |    2 +-
 lib/gnuastro/wcs.h            |    3 +++
 lib/mesh.c                    |   14 +++++++-------
 lib/mode.c                    |    8 ++++----
 lib/statistics.c              |    2 +-
 lib/txtarray.c                |    8 ++++----
 lib/wcs.c                     |    6 +++---
 src/arithmetic/arithmetic.c   |    2 +-
 src/convolve/convolve.c       |    2 +-
 src/noisechisel/ui.c          |    4 ++--
 src/subtractsky/subtractsky.c |    2 +-
 14 files changed, 31 insertions(+), 28 deletions(-)

diff --git a/lib/checkset.c b/lib/checkset.c
index 2795dfb..8c5c2c9 100644
--- a/lib/checkset.c
+++ b/lib/checkset.c
@@ -64,7 +64,7 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 /* See if a given string is a floating point number, if so, put it in
    the number.*/
 int
-strisdouble(char *string, double *out)
+gal_checkset_str_is_double(char *string, double *out)
 {
   char *tailptr;
   double tmp=*out;
diff --git a/lib/fits.c b/lib/fits.c
index a7ec02d..e5d93d4 100644
--- a/lib/fits.c
+++ b/lib/fits.c
@@ -1006,7 +1006,7 @@ gal_fits_num_hdus(char *filename, int *numhdu)
 /**************************************************************/
 /**********       Check FITS image HDUs:      ************/
 /**************************************************************/
-char *
+static char *
 hdutypestring(int hdutype)
 {
   switch(hdutype)
diff --git a/lib/gnuastro/checkset.h b/lib/gnuastro/checkset.h
index 719be01..a6e3d77 100644
--- a/lib/gnuastro/checkset.h
+++ b/lib/gnuastro/checkset.h
@@ -98,7 +98,7 @@ __BEGIN_C_DECLS  /* From C++ preparations */
  ************      Check and convert strings    *****************
  ****************************************************************/
 int
-strisdouble(char *string, double *out);
+gal_checkset_str_is_double(char *string, double *out);
 
 
 
diff --git a/lib/gnuastro/mesh.h b/lib/gnuastro/mesh.h
index d8b4c49..cb03510 100644
--- a/lib/gnuastro/mesh.h
+++ b/lib/gnuastro/mesh.h
@@ -179,7 +179,7 @@ size_t
 gal_mesh_img_xy_to_mesh_id(struct gal_mesh_params *mp, size_t x, size_t y);
 
 void
-gal_check_mesh_id(struct gal_mesh_params *mp, long **out);
+gal_mesh_check_mesh_id(struct gal_mesh_params *mp, long **out);
 
 void
 gal_mesh_check_garray(struct gal_mesh_params *mp, float **out1, float **out2);
diff --git a/lib/gnuastro/wcs.h b/lib/gnuastro/wcs.h
index 07be4ca..1041a8f 100644
--- a/lib/gnuastro/wcs.h
+++ b/lib/gnuastro/wcs.h
@@ -57,6 +57,9 @@ gal_wcs_radec_array_to_xy(struct wcsprm *wcs, double *radec, 
double *xy,
                           size_t number, size_t width);
 
 double
+gal_wcs_angular_distance(double r1, double d1, double r2, double d2);
+
+double
 gal_wcs_pixel_area_arcsec2(struct wcsprm *wcs);
 
 
diff --git a/lib/mesh.c b/lib/mesh.c
index 1aaa3a8..6760f72 100644
--- a/lib/mesh.c
+++ b/lib/mesh.c
@@ -380,7 +380,7 @@ gal_mesh_full_garray(struct gal_mesh_params *mp, int 
reverse)
 /*********************************************************************/
 /* Save the meshid of each pixel into an array the size of the image. */
 void
-gal_check_mesh_id(struct gal_mesh_params *mp, long **out)
+gal_mesh_check_mesh_id(struct gal_mesh_params *mp, long **out)
 {
   long i, *l, *lp;
   size_t row, start, *types=mp->types;
@@ -577,7 +577,7 @@ gal_mesh_value_file(struct gal_mesh_params *mp, char 
*filename,
    id of 1. In the actual function, the indexs are given in the order
    the types are found.
  */
-void
+static void
 fillmeshinfo(struct gal_mesh_params *mp, size_t chs0, size_t chs1,
              size_t lasts0, size_t lasts1)
 {
@@ -1005,7 +1005,7 @@ gal_mesh_operate_on_mesh(struct gal_mesh_params *mp,
 /*********************************************************************/
 /********************         Interpolate         ********************/
 /*********************************************************************/
-void
+static void
 preparemeshinterparrays(struct gal_mesh_params *mp)
 {
   size_t bs0=mp->gs0, bs1=mp->gs1;
@@ -1092,7 +1092,7 @@ preparemeshinterparrays(struct gal_mesh_params *mp)
    the differences. But here we are not dealing with subpixel
    distances, so manhattan distance is fine. It also avoids the square
    root function which is much slower. */
-float
+static float
 manhattandistance(long ind, long xc, long yc, long s1)
 {
   return labs(ind%s1 - xc) + labs(ind/s1 - yc);
@@ -1104,7 +1104,7 @@ manhattandistance(long ind, long xc, long yc, long s1)
 /* Some of the variables have different names than the gal_mesh_params
    structure because they are to be fed into the
    GAL_NEIGHBORS_FILL_4_ALLIMG macro. */
-void *
+static void *
 meshinterponthread(void *inparams)
 {
   struct gal_mesh_thread_params *mtp=(struct gal_mesh_thread_params *)inparams;
@@ -1457,7 +1457,7 @@ gal_mesh_smooth(struct gal_mesh_params *mp)
 /*********************************************************************/
 /********************      Convolve in mesh       ********************/
 /*********************************************************************/
-void*
+static void*
 meshspatialconvonthreads(void *inparam)
 {
   struct gal_mesh_thread_params *mtp = (struct gal_mesh_thread_params 
*)inparam;
@@ -1678,7 +1678,7 @@ gal_mesh_spatial_convolve_on_mesh(struct gal_mesh_params 
*mp, float **conv)
    re-convolve is very similar to the method explained below in
    gal_mesh_change_to_full_convolution, where it is explained how to count
    the number of pixels that should be re-convolved. */
-void
+static void
 corrconvindexs(struct gal_mesh_params *mp, size_t **indexs,
                size_t *numpix, size_t *thrdcols)
 {
diff --git a/lib/mode.c b/lib/mode.c
index 432bd6e..b5f67e1 100644
--- a/lib/mode.c
+++ b/lib/mode.c
@@ -72,7 +72,7 @@ the functions below.
 /* This is used for the plots, it will allocate an array and put the
    mirrored array values in it. `mi` is the index the mirror is to
    be placed on.  */
-void
+static void
 makemirrored(float *in, size_t mi, float **outmirror, size_t *outsize)
 {
   size_t i, size;
@@ -275,7 +275,7 @@ gal_mode_make_mirror_plots(float *sorted, size_t size, 
size_t mirrorindex,
   `j`. So, if we keep the previous `j` in `prevj` then, all we have to
   do is to start incrementing `j` from `prevj`. This will really help
   in speeding up the job :-D. Only for the first element, `prevj=0`.*/
-size_t
+static size_t
 mirrormaxdiff(float *a, size_t size, size_t m,
               size_t numcheck, size_t interval, size_t stdm)
 {
@@ -361,7 +361,7 @@ mirrormaxdiff(float *a, size_t size, size_t m,
 
    We need a fourth point to be placed between. With this configuration,
    the probing point is located at: */
-size_t
+static size_t
 modegoldenselection(struct gal_mode_params *mp)
 {
   size_t di, dd;
@@ -473,7 +473,7 @@ modegoldenselection(struct gal_mode_params *mp)
    the symmetricity of the mode can be quantified as: (b-m)/(m-a). For
    a completly symmetric mode, this should be 1. Note that the search
    for `b` only goes to the 95% of the distribution.  */
-void
+static void
 modesymmetricity(float *a, size_t size, size_t mi, float errorstdm,
                  float *sym)
 {
diff --git a/lib/statistics.c b/lib/statistics.c
index 96d694c..21e0aa8 100644
--- a/lib/statistics.c
+++ b/lib/statistics.c
@@ -438,7 +438,7 @@ gal_statistics_float_sum_num(float *in, size_t *size)
 
 
 
-double
+static double
 doublesumnum(double *in, size_t *size)
 {
   double *fpt;
diff --git a/lib/txtarray.c b/lib/txtarray.c
index d5f11de..279d252 100644
--- a/lib/txtarray.c
+++ b/lib/txtarray.c
@@ -45,7 +45,7 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 /**********************************************************************/
 /*****************       Read a text table        *********************/
 /**********************************************************************/
-void
+static void
 txttablesize(char *filename, size_t *outs0, size_t *outs1)
 {
   FILE *fp;
@@ -111,7 +111,7 @@ txttablesize(char *filename, size_t *outs0, size_t *outs1)
 
 
 
-void
+static void
 savetolog(FILE **log, char *filename, size_t lineno, size_t s0,
           size_t s1, char *token)
 {
@@ -142,7 +142,7 @@ savetolog(FILE **log, char *filename, size_t lineno, size_t 
s0,
 
 
 /* Macro functions: */
-double
+static double
 convertandsave(char *token, size_t lineno, char *filename, FILE *log,
                size_t ts0, size_t ts1)
 {
@@ -165,7 +165,7 @@ convertandsave(char *token, size_t lineno, char *filename, 
FILE *log,
 
 
 
-void
+static void
 filltable(char *filename, double *array, size_t s0, size_t s1)
 {
   FILE *fp, *log=NULL;
diff --git a/lib/wcs.c b/lib/wcs.c
index fd20e3b..e569f0c 100644
--- a/lib/wcs.c
+++ b/lib/wcs.c
@@ -128,7 +128,7 @@ gal_wcs_radec_array_to_xy(struct wcsprm *wcs, double 
*radec, double *xy,
    sin^2(distance)/2=sin^2( (d1-d2)/2 )+cos(d1)*cos(d2)*sin^2( (r1-r2)/2 )
 */
 double
-angulardistance(double r1, double d1, double r2, double d2)
+gal_wcs_angular_distance(double r1, double d1, double r2, double d2)
 {
   double a=sin( (d1-d2)/2 );
   double b=sin( (r1-r2)/2 );
@@ -167,8 +167,8 @@ gal_wcs_pixel_area_arcsec2(struct wcsprm *wcs)
   */
 
   /* Get the area in stradians. */
-  st= ( angulardistance(radec[0], radec[1], radec[2], radec[3]) *
-        angulardistance(radec[0], radec[1], radec[4], radec[5]) );
+  st= ( gal_wcs_angular_distance(radec[0], radec[1], radec[2], radec[3]) *
+        gal_wcs_angular_distance(radec[0], radec[1], radec[4], radec[5]) );
 
   /* Convert the stradians to arcsec^2:
 
diff --git a/src/arithmetic/arithmetic.c b/src/arithmetic/arithmetic.c
index 9b17066..c51dc60 100644
--- a/src/arithmetic/arithmetic.c
+++ b/src/arithmetic/arithmetic.c
@@ -1052,7 +1052,7 @@ reversepolish(struct imgarithparams *p)
          specified operation on them. */
       if(gal_fits_name_is_fits(token->v))
         add_operand(p, token->v, NOOPTNUMBER, NOOPTARRAY);
-      else if(strisdouble(token->v, &number))
+      else if(gal_checkset_str_is_double(token->v, &number))
         add_operand(p, NOOPTFILENAME, number, NOOPTARRAY);
       else
         {
diff --git a/src/convolve/convolve.c b/src/convolve/convolve.c
index d376861..020cda8 100644
--- a/src/convolve/convolve.c
+++ b/src/convolve/convolve.c
@@ -767,7 +767,7 @@ convolve(struct convolveparams *p)
       gal_mesh_make_mesh(mp);
       if(p->meshname)
         {
-          gal_check_mesh_id(mp, &meshindexs);
+          gal_mesh_check_mesh_id(mp, &meshindexs);
           gal_fits_array_to_file(p->meshname, "Input", FLOAT_IMG,
                                  p->mp.img, mp->s0, mp->s1,
                                  p->anyblank, p->wcs, NULL,
diff --git a/src/noisechisel/ui.c b/src/noisechisel/ui.c
index 96efd9b..dd8d052 100644
--- a/src/noisechisel/ui.c
+++ b/src/noisechisel/ui.c
@@ -957,12 +957,12 @@ preparearrays(struct noisechiselparams *p)
       gal_fits_array_to_file(p->meshname, "Input", FLOAT_IMG,
                              smp->img, s0, s1, p->anyblank, p->wcs,
                              NULL, SPACK_STRING);
-      gal_check_mesh_id(smp, &meshindexs);
+      gal_mesh_check_mesh_id(smp, &meshindexs);
       gal_fits_array_to_file(p->meshname, "SmallMeshIndexs",
                              LONG_IMG, meshindexs, s0, s1, 0, p->wcs,
                              NULL, SPACK_STRING);
       free(meshindexs);
-      gal_check_mesh_id(lmp, &meshindexs);
+      gal_mesh_check_mesh_id(lmp, &meshindexs);
       gal_fits_array_to_file(p->meshname, "LargeMeshIndexs", LONG_IMG,
                              meshindexs, s0, s1, 0, p->wcs,
                              NULL, SPACK_STRING);
diff --git a/src/subtractsky/subtractsky.c b/src/subtractsky/subtractsky.c
index 77e44b1..2c8402c 100644
--- a/src/subtractsky/subtractsky.c
+++ b/src/subtractsky/subtractsky.c
@@ -158,7 +158,7 @@ subtractsky(struct subtractskyparams *p)
   gal_mesh_make_mesh(mp);
   if(p->meshname)
     {
-      gal_check_mesh_id(mp, &meshindexs);
+      gal_mesh_check_mesh_id(mp, &meshindexs);
       gal_fits_array_to_file(p->meshname, "Input", FLOAT_IMG,
                              p->mp.img, s0, s1, p->anyblank, p->wcs,
                              NULL, SPACK_STRING);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]