Skip to content

Commit

Permalink
Merge pull request #86 from rmathar/master
Browse files Browse the repository at this point in the history
Using #pragma once to reduced CPP pollution with ifndef ... endif brackets
  • Loading branch information
ebertin authored Jan 19, 2025
2 parents a95ab4c + e0f98e3 commit 5e82a8d
Show file tree
Hide file tree
Showing 49 changed files with 52 additions and 79 deletions.
3 changes: 1 addition & 2 deletions src/assoc.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* assoc.h
*
Expand Down Expand Up @@ -26,9 +27,7 @@
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#ifndef _FITSWCS_H_
#include "fitswcs.h"
#endif

#define ASSOC_BUFINC 131072 /* Assoc buffer increment (bytes) */

Expand Down
3 changes: 1 addition & 2 deletions src/astrom.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* astrom.h
*
Expand Down Expand Up @@ -26,9 +27,7 @@
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#ifndef _FITSWCS_H_
#include "fitswcs.h"
#endif

/*----------------------------- Internal constants --------------------------*/

Expand Down
1 change: 1 addition & 0 deletions src/back.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* back.h
*
Expand Down
1 change: 1 addition & 0 deletions src/bpro.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* bpro.h
*
Expand Down
3 changes: 1 addition & 2 deletions src/check.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* check.h
*
Expand Down Expand Up @@ -26,9 +27,7 @@
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#ifndef _FITSCAT_H_
#include "fits/fitscat.h"
#endif

/*----------------------------- Internal constants --------------------------*/

Expand Down
1 change: 1 addition & 0 deletions src/clean.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* clean.h
*
Expand Down
1 change: 1 addition & 0 deletions src/define.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* define.h
*
Expand Down
6 changes: 1 addition & 5 deletions src/dgeo.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/**
* @file dgeo.h
* @brief Include file for dgeo.c.
Expand All @@ -24,12 +25,7 @@
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#ifndef _DGEO_H_
#define _DGEO_H_

//----------------------------- Internal constants ----------------------------
//------------------------------- functions -----------------------------------
extern int dgeo_copy(picstruct *dgeofield, PIXTYPE *destx, PIXTYPE *desty,
int w,int h, int ix,int iy);

#endif
1 change: 1 addition & 0 deletions src/extract.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* extract.h
*
Expand Down
7 changes: 2 additions & 5 deletions src/fft.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* fft.h
*
Expand Down Expand Up @@ -26,13 +27,9 @@
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#ifndef _FITSCAT_H_
#include "fits/fitscat.h"
#endif

#ifndef FFTW3_H
#include FFTW_H
#endif
#include <fftw3.h>

/*---------------------------- Internal constants ---------------------------*/

Expand Down
1 change: 1 addition & 0 deletions src/field.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* field.h
*
Expand Down
1 change: 1 addition & 0 deletions src/filter.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* filter.h
*
Expand Down
6 changes: 1 addition & 5 deletions src/fits/fitscat.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* fitscat.h
*
Expand Down Expand Up @@ -27,9 +28,6 @@
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#ifndef _FITSCAT_H_
#define _FITSCAT_H_

#include <stdio.h>

#ifdef HAVE_SYS_TYPES_H
Expand Down Expand Up @@ -345,5 +343,3 @@ extern FLAGTYPE *alloc_ibody(tabstruct *tab,
void (*func)(FLAGTYPE *ptr, int npix));

extern t_type ttypeof(char *str);

#endif
1 change: 1 addition & 0 deletions src/fits/fitscat_defs.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* fitscat_defs.h
*
Expand Down
6 changes: 1 addition & 5 deletions src/fitswcs.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* fitswcs.h
*
Expand Down Expand Up @@ -27,9 +28,6 @@
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#ifndef _FITSWCS_H_
#define _FITSWCS_H_

/*-------------------------------- macros -----------------------------------*/

/*----------------------------- Internal constants --------------------------*/
Expand Down Expand Up @@ -168,5 +166,3 @@ extern void b2j(double yearobs, double alphain, double deltain,
range_wcs(wcsstruct *wcs),
wipe_wcs(tabstruct *tab),
write_wcs(tabstruct *tab, wcsstruct *wcs);

#endif
1 change: 1 addition & 0 deletions src/flag.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* flag.h
*
Expand Down
1 change: 1 addition & 0 deletions src/globals.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* globals.h
*
Expand Down
1 change: 1 addition & 0 deletions src/growth.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* growth.h
*
Expand Down
3 changes: 1 addition & 2 deletions src/header.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* header.h
*
Expand Down Expand Up @@ -26,9 +27,7 @@
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#ifndef _FITSCAT_H_
#include "fits/fitscat.h"
#endif

/*------------------------------- functions ---------------------------------*/
extern int read_aschead(char *filename, int frameno,
Expand Down
1 change: 1 addition & 0 deletions src/image.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* image.h
*
Expand Down
1 change: 1 addition & 0 deletions src/interpolate.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* interpolate.h
*
Expand Down
1 change: 1 addition & 0 deletions src/key.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* key.h
*
Expand Down
1 change: 1 addition & 0 deletions src/ldactoasc.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* ldactoasc.h
*
Expand Down
6 changes: 1 addition & 5 deletions src/levmar/compiler.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* compiler.h
*
Expand Down Expand Up @@ -44,9 +45,6 @@
//
/////////////////////////////////////////////////////////////////////////////////

#ifndef _COMPILER_H_
#define _COMPILER_H_

/* note: intel's icc defines both __ICC & __INTEL_COMPILER.
* Also, some compilers other than gcc define __GNUC__,
* therefore gcc should be checked last
Expand Down Expand Up @@ -77,5 +75,3 @@
#else
#define LM_ISINF(x) isinf(x) // other than MSVC, ICC, GCC, let's hope this will work
#endif

#endif /* _COMPILER_H_ */
6 changes: 1 addition & 5 deletions src/levmar/levmar.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* levmar.h
*
Expand Down Expand Up @@ -46,9 +47,6 @@
////////////////////////////////////////////////////////////////////////////////////
*/

#ifndef _LEVMAR_H_
#define _LEVMAR_H_

/* Added by EB */
#ifdef HAVE_CONFIG_H
#include "config.h"
Expand Down Expand Up @@ -431,5 +429,3 @@ extern int slevmar_outlid(float *r, int n, float thresh, float ls[2], char *outl
#ifdef __cplusplus
}
#endif

#endif /* _LEVMAR_H_ */
6 changes: 1 addition & 5 deletions src/levmar/lm.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* lm.h
*
Expand Down Expand Up @@ -25,14 +26,9 @@
* Last modified: 09/07/2012
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#ifndef _DEPR_LM_H_
#define _DEPR_LM_H_

#ifdef _MSC_VER
#pragma message("lm.h is deprecated, please use levmar.h instead!")
#else
#error lm.h is deprecated, please use levmar.h instead!
#endif /* _MSC_VER */

#endif /* _DEPR_LM_H_ */

6 changes: 1 addition & 5 deletions src/levmar/misc.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* misc.h
*
Expand Down Expand Up @@ -44,9 +45,6 @@
//
/////////////////////////////////////////////////////////////////////////////////

#ifndef _MISC_H_
#define _MISC_H_

/* common suffix for LAPACK subroutines. Define empty in case of no prefix. */
#define LM_LAPACK_SUFFIX _
//#define LM_LAPACK_SUFFIX // define empty
Expand Down Expand Up @@ -137,5 +135,3 @@ extern int dlevmar_chol(double *C, double *W, int m);
#ifdef __cplusplus
}
#endif

#endif /* _MISC_H_ */
1 change: 1 addition & 0 deletions src/neurro.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* neurro.h
*
Expand Down
1 change: 1 addition & 0 deletions src/param.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* param.h
*
Expand Down
1 change: 1 addition & 0 deletions src/paramprofit.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* paramprofit.h
*
Expand Down
9 changes: 1 addition & 8 deletions src/pattern.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* pattern.h
*
Expand Down Expand Up @@ -26,12 +27,7 @@
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#ifndef _PROFIT_H_
#include "profit.h"
#endif

#ifndef _PATTERN_H_
#define _PATTERN_H_

/*-------------------------------- flags ------------------------------------*/
/*-------------------------------- macros -----------------------------------*/
Expand Down Expand Up @@ -87,6 +83,3 @@ void pattern_compmodarg(patternstruct *pattern,profitstruct *profit),
pattern_create(patternstruct *pattern, profitstruct *profit),
pattern_end(patternstruct *pattern),
pattern_fit(patternstruct *pattern, profitstruct *profit);

#endif

1 change: 1 addition & 0 deletions src/photom.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* photom.h
*
Expand Down
1 change: 1 addition & 0 deletions src/plist.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* plist.h
*
Expand Down
3 changes: 1 addition & 2 deletions src/preflist.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* preflist.h
*
Expand Down Expand Up @@ -28,9 +29,7 @@

#include "key.h"

#ifndef _XML_H_
#include "xml.h"
#endif

#ifdef USE_THREADS
#define THREADS_PREFMAX THREADS_NMAX
Expand Down
9 changes: 1 addition & 8 deletions src/prefs.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
/*
* prefs.h
*
Expand Down Expand Up @@ -26,16 +27,9 @@
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#ifndef _PROFIT_H_
#include "profit.h"
#endif

#ifndef _PATTERN_H_
#include "pattern.h"
#endif

#ifndef _PREFS_H_
#define _PREFS_H_

/*----------------------------- Internal constants --------------------------*/

Expand Down Expand Up @@ -265,4 +259,3 @@ extern void dumpprefs(int state),
preprefs(void),
readprefs(char *filename,char **argkey,char **argval,int narg),
useprefs(void);
#endif
Loading

0 comments on commit 5e82a8d

Please sign in to comment.