[lrslib] 02/12: Make some symbols private.
David Bremner
bremner at debian.org
Sun Aug 11 12:16:01 UTC 2013
This is an automated email from the git hooks/post-receive script.
bremner pushed a commit to branch master
in repository lrslib.
commit 922b8e046d9044a418349c345112c3bd527e091e
Author: David Bremner <bremner at debian.org>
Date: Sun Aug 11 11:03:12 2013 +0200
Make some symbols private.
These symbols are not intended to be used by clients of lrslib.
- make temp1, temp2, temp3 static
- make pushQ ptimes and get_time static
- make dict_count, dict_limit, cache_tries, cache_misses static
- convert cache_dict, check_cache, save_basis to static
- make signal handling routines private
- make get_time static
- make new_lrs_dic static
- remove declaration of ptimes from lrsgmp.h
---
lrsgmp.c | 2 +-
lrsgmp.h | 5 -----
lrslib.c | 49 +++++++++++++++++++++++++++++++++++++------------
lrslib.h | 22 ----------------------
lrslong.h | 5 -----
lrsmp.h | 5 -----
6 files changed, 38 insertions(+), 50 deletions(-)
diff --git a/lrsgmp.c b/lrsgmp.c
index 3816422..691c74e 100755
--- a/lrsgmp.c
+++ b/lrsgmp.c
@@ -19,7 +19,7 @@ long digits;
long record_digits;
/* these are allocated once and used as temporary storage where needed */
-lrs_mp temp1,temp2,temp3;
+static lrs_mp temp1,temp2,temp3;
#define MAXINPUT 1000 /*max length of any input rational */
diff --git a/lrsgmp.h b/lrsgmp.h
index 32c455f..60928c8 100755
--- a/lrsgmp.h
+++ b/lrsgmp.h
@@ -120,11 +120,6 @@
#define errcheck(s,e) if ((long)(e)==-1L){ perror(s);exit(1);}
#endif
-#ifndef OMIT_TIMES
-void ptimes ();
-#endif
-
-
#define CALLOC(n,s) xcalloc(n,s,__LINE__,__FILE__)
/*************/
diff --git a/lrslib.c b/lrslib.c
index c818499..be8575f 100755
--- a/lrslib.c
+++ b/lrslib.c
@@ -24,6 +24,7 @@
#include <string.h>
#include "lrslib.h"
+
/* Globals; these need to be here, rather than lrslib.h, so they are
not multiply defined. */
@@ -31,7 +32,8 @@ FILE *lrs_cfp; /* output file for checkpoint information */
FILE *lrs_ifp; /* input file pointer */
FILE *lrs_ofp; /* output file pointer */
-unsigned long dict_count, dict_limit, cache_tries, cache_misses;
+
+static unsigned long dict_count, dict_limit, cache_tries, cache_misses;
/* Variables and functions global to this file only */
static long lrs_checkpoint_seconds = 0;
@@ -41,9 +43,32 @@ static long lrs_global_count = 0; /* Track how many lrs_dat records are
static lrs_dat_p *lrs_global_list[MAX_LRS_GLOBALS + 1];
+static lrs_dic *new_lrs_dic (long m, long d, long m_A);
+
+
+static void cache_dict (lrs_dic ** D_p, lrs_dat * global, long i, long j);
+static long check_cache (lrs_dic ** D_p, lrs_dat * global, long *i_p, long *j_p);
+static void save_basis (lrs_dic * D, lrs_dat * Q);
static void lrs_dump_state ();
+static void pushQ (lrs_dat * global, long m, long d, long m_A);
+
+#ifdef TIMES
+static void ptimes ();
+static double get_time();
+#endif
+
+
+/*******************************/
+/* signals handling */
+/*******************************/
+#ifdef SIGNALS
+static void checkpoint ();
+static void die_gracefully ();
+static void setup_signals ();
+static void timecheck ();
+#endif
/*******************************/
/* functions for external use */
@@ -3699,7 +3724,7 @@ pimat (lrs_dic * P, long r, long s, lrs_mp Nt, char name[])
/* From here mostly Bremner's handiwork */
-void
+static void
cache_dict (lrs_dic ** D_p, lrs_dat * global, long i, long j)
{
@@ -3785,7 +3810,7 @@ copy_dict (lrs_dat * global, lrs_dic * dest, lrs_dic * src)
#define TRACE(s)
#endif
-void
+static void
pushQ (lrs_dat * global, long m, long d ,long m_A)
{
@@ -3877,7 +3902,7 @@ lrs_dic *p;
#define NULLRETURN(e) if (!(e)) return NULL;
-lrs_dic *
+static lrs_dic *
new_lrs_dic (long m, long d, long m_A)
{
lrs_dic *p;
@@ -3979,7 +4004,7 @@ lrs_free_dat ( lrs_dat *Q )
}
-long
+static long
check_cache (lrs_dic ** D_p, lrs_dat * global, long *i_p, long *j_p)
{
/* assign local variables to structures */
@@ -4131,7 +4156,7 @@ lrs_alloc_dic (lrs_dat * Q)
It is also used to make sure that in case of overflow, we
have a valid cobasis to restart from.
*/
-void
+static void
save_basis (lrs_dic * P, lrs_dat * Q)
{
int i;
@@ -4240,7 +4265,7 @@ print_basis (FILE * fp, lrs_dat * global)
INT (ctrl-C) ditto
HUP ditto
*/
-void
+static void
setup_signals ()
{
errcheck ("signal", signal (SIGTERM, die_gracefully));
@@ -4250,7 +4275,7 @@ setup_signals ()
errcheck ("signal", signal (SIGUSR1, checkpoint));
}
-void
+static void
timecheck ()
{
lrs_dump_state ();
@@ -4258,14 +4283,14 @@ timecheck ()
alarm (lrs_checkpoint_seconds);
}
-void
+static void
checkpoint ()
{
lrs_dump_state ();
errcheck ("signal", signal (SIGUSR1, checkpoint));
}
-void
+static void
die_gracefully ()
{
lrs_dump_state ();
@@ -4283,7 +4308,7 @@ die_gracefully ()
#include <sys/resource.h>
#define double_time(t) ((double)(t.tv_sec)+(double)(t.tv_usec)/1000000)
-void
+static void
ptimes ()
{
struct rusage rusage;
@@ -4296,7 +4321,7 @@ ptimes ()
}
-double get_time()
+static double get_time()
{
struct rusage rusage;
getrusage (RUSAGE_SELF, &rusage);
diff --git a/lrslib.h b/lrslib.h
index 6c131b5..47e5df1 100755
--- a/lrslib.h
+++ b/lrslib.h
@@ -43,12 +43,6 @@
#define errcheck(s,e) if ((long)(e)==-1L){ perror(s);exit(1);}
#endif
-#ifdef TIMES
-void ptimes ();
-double get_time();
-#endif
-
-
#define CALLOC(n,s) xcalloc(n,s,__LINE__,__FILE__)
/* make this include file includable in a C++ file
@@ -208,7 +202,6 @@ lrs_dat, lrs_dat_p;
extern FILE *lrs_cfp; /* output file for checkpoint information */
-extern unsigned long dict_count, dict_limit, cache_tries, cache_misses;
extern lrs_dic *PBnew; /* we will save Bob's dictionary in getabasis */
@@ -314,27 +307,12 @@ long checkindex (lrs_dic * P, lrs_dat * Q, long index); /* index=0 non-red.,1 r
void lrs_free_dic ( lrs_dic *P, lrs_dat *Q);
void lrs_free_dat ( lrs_dat *Q);
-void cache_dict (lrs_dic ** D_p, lrs_dat * global, long i, long j);
-long check_cache (lrs_dic ** D_p, lrs_dat * global, long *i_p, long *j_p);
void copy_dict (lrs_dat * global, lrs_dic * dest, lrs_dic * src);
-void pushQ (lrs_dat * global, long m, long d, long m_A);
-void save_basis (lrs_dic * D, lrs_dat * Q);
lrs_dic *alloc_memory (lrs_dat * Q);
lrs_dic * lrs_getdic(lrs_dat *Q);
-lrs_dic *new_lrs_dic (long m, long d, long m_A);
lrs_dic *resize (lrs_dic * P, lrs_dat * Q);
-
-/*******************************/
-/* signals handling */
-/*******************************/
-
-void checkpoint ();
-void die_gracefully ();
-void setup_signals ();
-void timecheck ();
-
/*******************************/
/* utilities */
/*******************************/
diff --git a/lrslong.h b/lrslong.h
index af16731..53c598a 100755
--- a/lrslong.h
+++ b/lrslong.h
@@ -126,11 +126,6 @@
#define errcheck(s,e) if ((long)(e)==-1L){ perror(s);exit(1);}
#endif
-#ifndef OMIT_TIMES
-void ptimes ();
-#endif
-
-
#define CALLOC(n,s) xcalloc(n,s,__LINE__,__FILE__)
/*************/
diff --git a/lrsmp.h b/lrsmp.h
index 14b79ef..eccf3f5 100755
--- a/lrsmp.h
+++ b/lrsmp.h
@@ -119,11 +119,6 @@
#define errcheck(s,e) if ((long)(e)==-1L){ perror(s);exit(1);}
#endif
-#ifdef TIMES
-void ptimes ();
-#endif
-
-
#define CALLOC(n,s) xcalloc(n,s,__LINE__,__FILE__)
/*************/
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/lrslib.git
More information about the debian-science-commits
mailing list