Skip to content

Commit

Permalink
Cleans up source
Browse files Browse the repository at this point in the history
This primary purpose of this commit is to make some minor changes to the
code to clean it up a bit. Notable changes are as follows:
* The macro `__OPENMP__` is replaced by `_OPENMP`. `__OPENMP__` was an
  artifact from the old build system, which defined such a macro when
  the build was configured with OpenMP support. According to the [OpenMP
  specification](https://www.openmp.org/specifications/) Section
  [2.2](https://www.openmp.org/spec-html/5.1/openmpse10.html#x38-370002.2) "the
  `_OPENMP` macro name is defined to have the decimal value *yyyymm*
  where *yyyy* and *mm* are the year and month designations of the
  version of the OpenMP API that the implementation supports." As such,
  it should be the preferred way to check for OpenMP support during
  compilation.
* The preprocessor condition `defined(__WITHPCRE__)` is replaced by
  `defined(USE_PCRE) && defined(HAVE_PCREPOSIX_H)`. `__WITHPCRE__` was an
  artifact from the old build system, which was defined during configuration if
  the build system user requested PCRE support. This functionality has been
  replaced by the macro name `USE_PCRE` to be consistent with the other feature
  availability checks done in the core CMake logic and the condition has been
  extended to not only check for the request (`USE_PCRE`), but also the
  availability of the necessary header file, namely `pcreposix.h` indicated by
  the macro name `HAVE_PCREPOSIX_H` being defined during CMake configuration.
  • Loading branch information
jiverson002 committed Jan 24, 2021
1 parent 26a94c3 commit fd87121
Show file tree
Hide file tree
Showing 38 changed files with 70 additions and 69 deletions.
2 changes: 1 addition & 1 deletion apps/cmpnbrs.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
\version \verbatim $Id: m2mnbrs.c 17699 2014-09-27 18:05:31Z karypis $ \endverbatim
*/

#include <GKlib.h>
#include "GKlib.h"

/*************************************************************************/
/*! Data structures for the code */
Expand Down
2 changes: 1 addition & 1 deletion apps/csrcnv.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
\version \verbatim $Id: csrcnv.c 15314 2013-10-05 16:50:50Z karypis $ \endverbatim
*/

#include <GKlib.h>
#include "GKlib.h"

/*************************************************************************/
/*! Data structures for the code */
Expand Down
2 changes: 1 addition & 1 deletion apps/fis.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
\version \verbatim $Id: fis.c 11075 2011-11-11 22:31:52Z karypis $ \endverbatim
*/

#include <GKlib.h>
#include "GKlib.h"

/*************************************************************************/
/*! Data structures for the code */
Expand Down
2 changes: 1 addition & 1 deletion apps/gkgraph.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
\version \verbatim $Id: gkgraph.c 17700 2014-09-27 18:10:02Z karypis $ \endverbatim
*/

#include <GKlib.h>
#include "GKlib.h"


/*************************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion apps/gkrw.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
\version \verbatim $Id$ \endverbatim
*/

#include <GKlib.h>
#include "GKlib.h"

/*************************************************************************/
/*! Data structures for the code */
Expand Down
2 changes: 1 addition & 1 deletion apps/gksort.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
\version\verbatim $Id: gksort.c 11058 2011-11-10 00:02:50Z karypis $ \endverbatim
*/

#include <GKlib.h>
#include "GKlib.h"

#define N 10000

Expand Down
2 changes: 1 addition & 1 deletion apps/gkuniq.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
\author George
*/

#include <GKlib.h>
#include "GKlib.h"

/*************************************************************************/
/*! Data structures for the code */
Expand Down
2 changes: 1 addition & 1 deletion apps/grKx.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
\version \verbatim $Id: grKx.c 17699 2014-09-27 18:05:31Z karypis $ \endverbatim
*/

#include <GKlib.h>
#include "GKlib.h"

/*************************************************************************/
/*! Data structures for the code */
Expand Down
2 changes: 1 addition & 1 deletion apps/m2mnbrs.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
\version \verbatim $Id: m2mnbrs.c 17699 2014-09-27 18:05:31Z karypis $ \endverbatim
*/

#include <GKlib.h>
#include "GKlib.h"

/*************************************************************************/
/*! Data structures for the code */
Expand Down
2 changes: 1 addition & 1 deletion apps/splatt2svd.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
\author George
*/

#include <GKlib.h>
#include "GKlib.h"


int main(int argc, char *argv[])
Expand Down
2 changes: 1 addition & 1 deletion apps/strings.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
\version\verbatim $Id: strings.c 10711 2011-08-31 22:23:04Z karypis $ \endverbatim
*/

#include <GKlib.h>
#include "GKlib.h"


/*************************************************************************/
Expand Down
42 changes: 20 additions & 22 deletions include/GKlib/GKlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,41 +43,39 @@
#include <assert.h>
#include <sys/stat.h>

#if defined(__WITHPCRE__)
#if defined(USE_PCRE) && defined(HAVE_PCREPOSIX_H)
#include <pcreposix.h>
#elif defined(HAVE_REGEX_H)
#include <regex.h>
#else
#if defined(USE_GKREGEX)
#include "gkregex.h"
#else
#include <regex.h>
#endif /* defined(USE_GKREGEX) */
#endif /* defined(__WITHPCRE__) */
#include "gkregex.h"
#endif



#if defined(__OPENMP__)
#if defined(_OPENMP)
#include <omp.h>
#endif




#include <gk_types.h>
#include <gk_struct.h>
#include <gk_externs.h>
#include <gk_defs.h>
#include <gk_macros.h>
#include <gk_getopt.h>
#include "gk_types.h"
#include "gk_struct.h"
#include "gk_externs.h"
#include "gk_defs.h"
#include "gk_macros.h"
#include "gk_getopt.h"

#include <gk_mksort.h>
#include <gk_mkblas.h>
#include <gk_mkmemory.h>
#include <gk_mkpqueue.h>
#include <gk_mkpqueue2.h>
#include <gk_mkrandom.h>
#include <gk_mkutils.h>
#include "gk_mksort.h"
#include "gk_mkblas.h"
#include "gk_mkmemory.h"
#include "gk_mkpqueue.h"
#include "gk_mkpqueue2.h"
#include "gk_mkrandom.h"
#include "gk_mkutils.h"

#include <gk_proto.h>
#include "gk_proto.h"


#endif /* GKlib.h */
Expand Down
16 changes: 8 additions & 8 deletions include/GKlib/gk_getopt.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ struct gk_option {
};

/* Names for the values of the `has_arg' field of `struct gk_option'. */
#define no_argument 0
#define required_argument 1
#define optional_argument 2
#define no_argument 0
#define required_argument 1
#define optional_argument 2


/* Function prototypes */
extern int gk_getopt(int __argc, char **__argv, char *__shortopts);
extern int gk_getopt_long(int __argc, char **__argv, char *__shortopts,
struct gk_option *__longopts, int *__longind);
extern int gk_getopt_long_only (int __argc, char **__argv,
char *__shortopts, struct gk_option *__longopts, int *__longind);
extern int gk_getopt(int argc, char **argv, char *shortopts);
extern int gk_getopt_long(int argc, char **argv, char *shortopts,
struct gk_option *longopts, int *longind);
extern int gk_getopt_long_only (int argc, char **argv,
char *shortopts, struct gk_option *longopts, int *longind);



Expand Down
3 changes: 3 additions & 0 deletions include/GKlib/gk_mkpqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@ int FPRFX ## CheckHeap(PQT *queue)\
heap = queue->heap;\
locator = queue->locator;\
nnodes = queue->nnodes;\
\
/* silence unused-but-set-variable */\
(void)heap;\
\
if (nnodes == 0)\
return 1;\
Expand Down
4 changes: 2 additions & 2 deletions include/GKlib/gk_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ uint32_t gk_randint32(void);
/*-------------------------------------------------------------
* OpenMP fake functions
*-------------------------------------------------------------*/
#if !defined(__OPENMP__)
#if !defined(_OPENMP)
void omp_set_num_threads(int num_threads);
int omp_get_num_threads(void);
int omp_get_max_threads(void);
Expand All @@ -300,7 +300,7 @@ void omp_set_dynamic(int num_threads);
int omp_get_dynamic(void);
void omp_set_nested(int nested);
int omp_get_nested(void);
#endif /* __OPENMP__ */
#endif /* _OPENMP */


/*-------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/blas.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ which is used for code generation.
\version\verbatim $Id: blas.c 14330 2013-05-18 12:15:15Z karypis $ \endverbatim
*/

#include <GKlib.h>
#include "GKlib.h"



Expand Down
2 changes: 1 addition & 1 deletion src/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
\version $Id: cache.c 21991 2018-04-16 03:08:12Z karypis $
*/

#include <GKlib.h>
#include "GKlib.h"


/*************************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion src/csr.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* \version\verbatim $Id: csr.c 21044 2017-05-24 22:50:32Z karypis $ \endverbatim
*/

#include <GKlib.h>
#include "GKlib.h"

#define OMPMINOPS 50000

Expand Down
2 changes: 1 addition & 1 deletion src/error.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This file contains functions dealing with error reporting and termination
#define _GK_ERROR_C_ /* this is needed to properly declare the gk_jub* variables
as an extern function in GKlib.h */

#include <GKlib.h>
#include "GKlib.h"


/* These are the jmp_buf for the graceful exit in case of severe errors.
Expand Down
2 changes: 1 addition & 1 deletion src/evaluate.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
\version\verbatim $Id: evaluate.c 13328 2012-12-31 14:57:40Z karypis $ \endverbatim
*/

#include <GKlib.h>
#include "GKlib.h"

/**********************************************************************
* This function computes the max accuracy score of a ranked list,
Expand Down
2 changes: 1 addition & 1 deletion src/fkvkselect.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/


#include <GKlib.h>
#include "GKlib.h"

/* Byte-wise swap two items of size SIZE. */
#define QSSWAP(a, b, stmp) do { stmp = (a); (a) = (b); (b) = stmp; } while (0)
Expand Down
2 changes: 1 addition & 1 deletion src/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ the filesystem in a portable way.
*/


#include <GKlib.h>
#include "GKlib.h"



Expand Down
2 changes: 1 addition & 1 deletion src/getopt.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ So, do read the documentation here.
/*************************************************************************/


#include <GKlib.h>
#include "GKlib.h"

/*************************************************************************/
/* Local function prototypes */
Expand Down
2 changes: 1 addition & 1 deletion src/gk_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/


#include <GKlib.h>
#include "GKlib.h"


/*************************************************************************
Expand Down
4 changes: 2 additions & 2 deletions src/graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* \version\verbatim $Id: graph.c 22415 2019-09-05 16:55:00Z karypis $ \endverbatim
*/

#include <GKlib.h>
#include "GKlib.h"

#define OMPMINOPS 50000

Expand Down Expand Up @@ -294,7 +294,7 @@ gk_graph_t *gk_graph_Read(char *filename, int format, int hasvals,
fpin = gk_fopen(filename, "r", "gk_graph_Read: fpin");

if (format == GK_GRAPH_FMT_HIJV) { /* read and ignore the #rows/#cols values */
if (fscanf(fpin, "%"SCNd64" %"SCNd64, &i, &i) != 2)
if (fscanf(fpin, "%zu %zu", &i, &i) != 2)
gk_errexit(SIGERR, "Error: Failed to read the header line.\n");
}

Expand Down
2 changes: 1 addition & 1 deletion src/htable.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
*/

#include <GKlib.h>
#include "GKlib.h"

/******************************************************************************
* This function creates the hash-table
Expand Down
2 changes: 1 addition & 1 deletion src/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This file contains various functions that perform I/O.
#undef _GNU_SOURCE
#endif

#include <GKlib.h>
#include "GKlib.h"

/*************************************************************************
* This function opens a file
Expand Down
2 changes: 1 addition & 1 deletion src/itemsets.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* \version\verbatim $Id: itemsets.c 19240 2015-10-22 12:41:19Z karypis $ \endverbatim
*/

#include <GKlib.h>
#include "GKlib.h"

/*-------------------------------------------------------------*/
/*! Data structures for use within this module */
Expand Down
2 changes: 1 addition & 1 deletion src/mcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
\version $Id: mcore.c 13953 2013-03-30 16:20:07Z karypis $
*/

#include <GKlib.h>
#include "GKlib.h"


/*************************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion src/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ can be used to define other memory allocation routines.
*/


#include <GKlib.h>
#include "GKlib.h"

/* This is for the global mcore that tracks all heap allocations */
static __thread gk_mcore_t *gkmcore = NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/pqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The priority queues are generated using the GK_MKPQUEUE macro.
\version\verbatim $Id: pqueue.c 10711 2011-08-31 22:23:04Z karypis $ \endverbatim
*/

#include <GKlib.h>
#include "GKlib.h"


/*************************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion src/random.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
\version\verbatim $Id: random.c 18796 2015-06-02 11:39:45Z karypis $ \endverbatim
*/

#include <GKlib.h>
#include "GKlib.h"


/*************************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion src/rw.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* \version\verbatim $Id: rw.c 11078 2011-11-12 00:20:44Z karypis $ \endverbatim
*/

#include <GKlib.h>
#include "GKlib.h"


/*************************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion src/seq.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/


#include <GKlib.h>
#include "GKlib.h"



Expand Down
Loading

0 comments on commit fd87121

Please sign in to comment.