diff options
author | Bruce Momjian <bruce@momjian.us> | 1997-08-19 21:40:56 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 1997-08-19 21:40:56 +0000 |
commit | 1d8bbfd2e7cfb72cbe4d5c5d4fa650a28dedac0b (patch) | |
tree | 8d3a5dac9207f22c3afb8afb563d54f88774deb3 /src/backend/utils | |
parent | b992e200b8872ecb6652ec85111995f8d4c5aee0 (diff) | |
download | postgresql-1d8bbfd2e7cfb72cbe4d5c5d4fa650a28dedac0b.tar.gz postgresql-1d8bbfd2e7cfb72cbe4d5c5d4fa650a28dedac0b.zip |
Make functions static where possible, enclose unused functions in #ifdef NOT_USED.
Diffstat (limited to 'src/backend/utils')
30 files changed, 334 insertions, 173 deletions
diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c index c292dfe9995..33580a95125 100644 --- a/src/backend/utils/adt/acl.c +++ b/src/backend/utils/adt/acl.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.12 1997/08/12 20:15:54 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.13 1997/08/19 21:34:10 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -24,6 +24,7 @@ static char *getid(char *s, char *n); static int32 aclitemeq(AclItem *a1, AclItem *a2); static int32 aclitemgt(AclItem *a1, AclItem *a2); +static char *aclparse(char *s, AclItem *aip, unsigned *modechg); #define ACL_IDTYPE_GID_KEYWORD "group" #define ACL_IDTYPE_UID_KEYWORD "user" @@ -81,7 +82,7 @@ getid(char *s, char *n) * UID/GID, id type identifier and mode type values. * - loads 'modechg' with the mode change flag. */ -char * +static char * aclparse(char *s, AclItem *aip, unsigned *modechg) { HeapTuple htp; diff --git a/src/backend/utils/adt/arrayfuncs.c b/src/backend/utils/adt/arrayfuncs.c index 98849b22c91..48a78366b01 100644 --- a/src/backend/utils/adt/arrayfuncs.c +++ b/src/backend/utils/adt/arrayfuncs.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.14 1997/08/18 02:14:54 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.15 1997/08/19 21:34:18 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -68,7 +68,9 @@ static void _LOArrayRange(int st[], int endp[], int bsize, int srcfd, static void _ReadArray (int st[], int endp[], int bsize, int srcfd, int destfd, ArrayType *array, int isDestLO, bool *isNull); static ArrayCastAndSet(char *src, bool typbyval, int typlen, char *dest); - +static SanityCheckInput(int ndim, int n, int dim[], int lb[], int indx[]); +static int array_read(char *destptr, int eltsize, int nitems, char *srcptr); +static char *array_seek(char *ptr, int eltsize, int nitems); /*--------------------------------------------------------------------- * array_in : @@ -1189,7 +1191,7 @@ _AdvanceBy1word(char *str, char **word) } #endif -int +static int SanityCheckInput(int ndim, int n, int dim[], int lb[], int indx[]) { int i; @@ -1261,7 +1263,7 @@ _ArrayClipCount(int stI[], int endpI[], ArrayType *array) return count; } -char * +static char * array_seek(char *ptr, int eltsize, int nitems) { int i; @@ -1273,7 +1275,7 @@ array_seek(char *ptr, int eltsize, int nitems) return(ptr); } -int +static int array_read(char *destptr, int eltsize, int nitems, char *srcptr) { int i, inc, tmp; diff --git a/src/backend/utils/adt/chunk.c b/src/backend/utils/adt/chunk.c index 91773a8a7d5..3d9aec0d9e4 100644 --- a/src/backend/utils/adt/chunk.c +++ b/src/backend/utils/adt/chunk.c @@ -6,7 +6,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/chunk.c,v 1.5 1997/03/02 01:34:37 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/chunk.c,v 1.6 1997/08/19 21:34:27 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -57,6 +57,8 @@ static void read_chunk(int chunk_no[], int C[], char a_chunk[], int srcfd, static int write_chunk(struct varlena * a_chunk, int ofile); static int seek_and_read(int pos, int size, char buff[], int fp, int from); #endif +static int GetChunkSize(FILE *fd, int ndim, int dim[MAXDIM], int baseSize, + int d[MAXDIM]); /*------------------------------------------------------------------------ * _ChunkArray --- @@ -119,7 +121,7 @@ int cfd = 0; * returns the dimensions of the chunk in "d" *----------------------------------------------------------------------- */ -int +static int GetChunkSize(FILE *fd, int ndim, int dim[MAXDIM], diff --git a/src/backend/utils/adt/date.c b/src/backend/utils/adt/date.c index 70fc35cb694..e785bdb2bc8 100644 --- a/src/backend/utils/adt/date.c +++ b/src/backend/utils/adt/date.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.12 1997/08/12 22:54:26 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.13 1997/08/19 21:34:30 momjian Exp $ * * NOTES * This code is actually (almost) unused. @@ -92,7 +92,7 @@ static int sec_tab[] = { * Function prototypes -- internal to this file only */ -void reltime2tm(int32 time, struct tm *tm); +static void reltime2tm(int32 time, struct tm *tm); #if FALSE static int correct_unit(char unit[], int *unptr); @@ -178,7 +178,7 @@ char *reltimeout(int32 time) #define TMODULO(t,q,u) {q = (t / u); \ if (q != 0) t -= (q * u);} -void +static void reltime2tm(int32 time, struct tm *tm) { TMODULO(time, tm->tm_year, 31536000); diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c index 2cf7324275b..171805e59d6 100644 --- a/src/backend/utils/adt/datetime.c +++ b/src/backend/utils/adt/datetime.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.10 1997/07/01 00:22:40 thomas Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.11 1997/08/19 21:34:32 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -25,6 +25,9 @@ #include "utils/datetime.h" #include "access/xact.h" +static int date2tm(DateADT dateVal, int *tzp, struct tm *tm, double *fsec, char **tzn); + + static int day_tab[2][12] = { {31,28,31,30,31,30,31,31,30,31,30,31}, {31,29,31,30,31,30,31,31,30,31,30,31} }; @@ -140,8 +143,6 @@ date_out(DateADT date) return(result); } /* date_out() */ -int date2tm(DateADT dateVal, int *tzp, struct tm *tm, double *fsec, char **tzn); - bool date_eq(DateADT dateVal1, DateADT dateVal2) { @@ -330,7 +331,7 @@ abstime_date(AbsoluteTime abstime) * that everything is GMT. So, convert to GMT, rotate to local time, * and then convert again to try to get the time zones correct. */ -int +static int date2tm(DateADT dateVal, int *tzp, struct tm *tm, double *fsec, char **tzn) { struct tm *tx; diff --git a/src/backend/utils/adt/datum.c b/src/backend/utils/adt/datum.c index 20bc38cc1a1..493843071cd 100644 --- a/src/backend/utils/adt/datum.c +++ b/src/backend/utils/adt/datum.c @@ -6,7 +6,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/datum.c,v 1.4 1996/12/14 07:56:05 vadim Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/datum.c,v 1.5 1997/08/19 21:34:33 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -131,6 +131,7 @@ datumCopy(Datum value, Oid type, bool byVal, Size len) * ONLY datums created by "datumCopy" can be freed! *------------------------------------------------------------------------- */ +#ifdef NOT_USED void datumFree(Datum value, Oid type, bool byVal, Size len) { @@ -148,6 +149,7 @@ datumFree(Datum value, Oid type, bool byVal, Size len) pfree(s); } } +#endif /*------------------------------------------------------------------------- * datumIsEqual diff --git a/src/backend/utils/adt/dt.c b/src/backend/utils/adt/dt.c index 1e205033e31..1fbca2d82c7 100644 --- a/src/backend/utils/adt/dt.c +++ b/src/backend/utils/adt/dt.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.31 1997/07/29 16:09:38 thomas Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.32 1997/08/19 21:34:34 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -31,6 +31,24 @@ #endif #include "utils/builtins.h" +static int DecodeDate(char *str, int fmask, int *tmask, struct tm *tm); +static int DecodeNumber( int flen, char *field, + int fmask, int *tmask, struct tm *tm, double *fsec); +static int DecodeNumberField( int len, char *str, + int fmask, int *tmask, struct tm *tm, double *fsec); +static int DecodeSpecial(int field, char *lowtoken, int *val); +static int DecodeTime(char *str, int fmask, int *tmask, + struct tm *tm, double *fsec); +static int DecodeTimezone( char *str, int *tzp); +static int DecodeUnits(int field, char *lowtoken, int *val); +static int EncodeSpecialDateTime(DateTime dt, char *str); +static datetkn *datebsearch(char *key, datetkn *base, unsigned int nel); +static DateTime dt2local( DateTime dt, int timezone); +static void dt2time(DateTime dt, int *hour, int *min, double *sec); +static int j2day( int jd); +static int timespan2tm(TimeSpan span, struct tm *tm, float8 *fsec); +static int tm2timespan(struct tm *tm, double fsec, TimeSpan *span); + #define USE_DATE_CACHE 1 #define ROUND_ALL 0 @@ -50,7 +68,7 @@ char *days[] = {"Sunday", "Monday", "Tuesday", "Wednesday", #define TMODULO(t,q,u) {q = ((t < 0)? ceil(t / u): floor(t / u)); \ if (q != 0) t -= rint(q * u);} -void GetEpochTime( struct tm *tm); +static void GetEpochTime( struct tm *tm); #define UTIME_MINYEAR (1901) #define UTIME_MINMONTH (12) @@ -265,6 +283,7 @@ datetime_finite(DateTime *datetime) } /* datetime_finite() */ +#ifdef NOT_USED bool timespan_finite(TimeSpan *timespan) { @@ -273,13 +292,13 @@ timespan_finite(TimeSpan *timespan) return(! TIMESPAN_NOT_FINITE(*timespan)); } /* timespan_finite() */ - +#endif /*---------------------------------------------------------- * Relational operators for datetime. *---------------------------------------------------------*/ -void +static void GetEpochTime( struct tm *tm) { struct tm *t0; @@ -1115,6 +1134,7 @@ timespan_text(TimeSpan *timespan) * Text type may not be null terminated, so copy to temporary string * then call the standard input routine. */ +#ifdef NOT_USED TimeSpan * text_timespan(text *str) { @@ -1134,7 +1154,7 @@ text_timespan(text *str) return(result); } /* text_timespan() */ - +#endif /* datetime_trunc() * Extract specified field from datetime. @@ -2005,7 +2025,7 @@ j2date( int jd, int *year, int *month, int *day) return; } /* j2date() */ -int +static int j2day( int date) { int day; @@ -2188,7 +2208,7 @@ printf( "tm2datetime- time is %f %02d:%02d:%02d %f\n", time, tm->tm_hour, tm->tm /* timespan2tm() * Convert a timespan data type to a tm structure. */ -int +static int timespan2tm(TimeSpan span, struct tm *tm, float8 *fsec) { double time; @@ -2222,7 +2242,7 @@ printf( "timespan2tm- %d %f = %04d-%02d-%02d %02d:%02d:%02d %.2f\n", span.month, return 0; } /* timespan2tm() */ -int +static int tm2timespan( struct tm *tm, double fsec, TimeSpan *span) { span->month = ((tm->tm_year*12)+tm->tm_mon); @@ -2238,7 +2258,7 @@ printf( "tm2timespan- %d %f = %04d-%02d-%02d %02d:%02d:%02d %.2f\n", span->month } /* tm2timespan() */ -DateTime +static DateTime dt2local(DateTime dt, int tz) { dt -= tz; @@ -2252,7 +2272,7 @@ time2t(const int hour, const int min, const double sec) return((((hour*60)+min)*60)+sec); } /* time2t() */ -void +static void dt2time(DateTime jd, int *hour, int *min, double *sec) { double time; @@ -2748,7 +2768,7 @@ printf( " %02d:%02d:%02d (%f)\n", tm->tm_hour, tm->tm_min, tm->tm_sec, *fsec); * Decode date string which includes delimiters. * Insist on a complete set of fields. */ -int +static int DecodeDate(char *str, int fmask, int *tmask, struct tm *tm) { double fsec; @@ -2835,7 +2855,7 @@ printf( "DecodeDate- illegal field %s value is %d\n", field[i], val); * Only check the lower limit on hours, since this same code * can be used to represent time spans. */ -int +static int DecodeTime(char *str, int fmask, int *tmask, struct tm *tm, double *fsec) { char *cp; @@ -2879,7 +2899,7 @@ DecodeTime(char *str, int fmask, int *tmask, struct tm *tm, double *fsec) /* DecodeNumber() * Interpret numeric field as a date value in context. */ -int +static int DecodeNumber( int flen, char *str, int fmask, int *tmask, struct tm *tm, double *fsec) { int val; @@ -2985,7 +3005,7 @@ printf( "DecodeNumber- (2) match %d (%s) as year\n", val, str); /* DecodeNumberField() * Interpret numeric string as a concatenated date field. */ -int +static int DecodeNumberField( int len, char *str, int fmask, int *tmask, struct tm *tm, double *fsec) { char *cp; @@ -3058,7 +3078,8 @@ printf( "DecodeNumberField- %s is time field fmask=%08x tmask=%08x\n", str, fmas /* DecodeTimezone() * Interpret string as a numeric timezone. */ -int DecodeTimezone( char *str, int *tzp) +static int +DecodeTimezone( char *str, int *tzp) { int tz; int hr, min; @@ -3095,7 +3116,7 @@ int DecodeTimezone( char *str, int *tzp) * Implement a cache lookup since it is likely that dates * will be related in format. */ -int +static int DecodeSpecial(int field, char *lowtoken, int *val) { int type; @@ -3351,7 +3372,7 @@ printf( " %02d:%02d:%02d\n", tm->tm_hour, tm->tm_min, tm->tm_sec); * Decode text string using lookup table. * This routine supports time interval decoding. */ -int +static int DecodeUnits(int field, char *lowtoken, int *val) { int type; @@ -3388,7 +3409,7 @@ DecodeUnits(int field, char *lowtoken, int *val) * Binary search -- from Knuth (6.2.1) Algorithm B. Special case like this * is WAY faster than the generic bsearch(). */ -datetkn * +static datetkn * datebsearch(char *key, datetkn *base, unsigned int nel) { register datetkn *last = base + nel - 1, *position; @@ -3414,7 +3435,8 @@ datebsearch(char *key, datetkn *base, unsigned int nel) /* EncodeSpecialDateTime() * Convert reserved datetime data type to string. */ -int EncodeSpecialDateTime(DateTime dt, char *str) +static int +EncodeSpecialDateTime(DateTime dt, char *str) { if (DATETIME_IS_RESERVED(dt)) { if (DATETIME_IS_INVALID(dt)) { diff --git a/src/backend/utils/adt/geo_ops.c b/src/backend/utils/adt/geo_ops.c index feea5559c06..0c06e45bef4 100644 --- a/src/backend/utils/adt/geo_ops.c +++ b/src/backend/utils/adt/geo_ops.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.14 1997/08/12 22:54:29 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.15 1997/08/19 21:34:39 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -28,8 +28,39 @@ #define PI 3.1415926536 #endif -int point_inside( Point *p, int npts, Point plist[]); -int lseg_crossing( double x, double y, double px, double py); +static int point_inside( Point *p, int npts, Point plist[]); +static int lseg_crossing( double x, double y, double px, double py); +static BOX *box_construct(double x1, double x2, double y1, double y2); +static BOX *box_copy(BOX *box); +static BOX *box_fill(BOX *result, double x1, double x2, double y1, double y2); +static double box_ht(BOX *box); +static double box_wd(BOX *box); +static double circle_ar(CIRCLE *circle); +static CIRCLE *circle_copy(CIRCLE *circle); +static LINE *line_construct_pm(Point *pt, double m); +static bool line_horizontal(LINE *line); +static Point *line_interpt(LINE *l1, LINE *l2); +static bool line_intersect(LINE *l1, LINE *l2); +static bool line_parallel(LINE *l1, LINE *l2); +static bool line_vertical(LINE *line); +static double lseg_dt(LSEG *l1, LSEG *l2); +static void make_bound_box(POLYGON *poly); +static PATH *path_copy(PATH *path); +static bool plist_same(int npts, Point p1[], Point p2[]); +static Point *point_construct(double x, double y); +static Point *point_copy(Point *pt); +static int single_decode(char *str, float8 *x, char **ss); +static int single_encode(float8 x, char *str); +static int pair_decode(char *str, float8 *x, float8 *y, char **s); +static int pair_encode(float8 x, float8 y, char *str); +static int pair_count(char *s, char delim); +static int path_decode(int opentype, int npts, char *str, int *isopen, char **ss, Point *p); +static char *path_encode( bool closed, int npts, Point *pt); +static void statlseg_construct(LSEG *lseg, Point *pt1, Point *pt2); +static double box_ar(BOX *box); +static Point *interpt_sl(LSEG *lseg, LINE *line); +static LINE *line_construct_pp(Point *pt1, Point *pt2); + /* * Delimiters for input and output strings. @@ -77,16 +108,7 @@ static int digits8 = P_MAXDIG; * and restore that order for text output - tgl 97/01/16 */ -int single_decode(char *str, float8 *x, char **ss); -int single_encode(float8 x, char *str); -int pair_decode(char *str, float8 *x, float8 *y, char **s); -int pair_encode(float8 x, float8 y, char *str); -int pair_count(char *s, char delim); -int path_decode(int opentype, int npts, char *str, int *isopen, char **ss, Point *p); - -char *path_encode( bool closed, int npts, Point *pt); - -int single_decode(char *str, float8 *x, char **s) +static int single_decode(char *str, float8 *x, char **s) { char *cp; @@ -106,13 +128,13 @@ fprintf( stderr, "single_decode- (%x) try decoding %s to %g\n", (cp-str), str, * return(TRUE); } /* single_decode() */ -int single_encode(float8 x, char *str) +static int single_encode(float8 x, char *str) { sprintf(str, "%.*g", digits8, x); return(TRUE); } /* single_encode() */ -int pair_decode(char *str, float8 *x, float8 *y, char **s) +static int pair_decode(char *str, float8 *x, float8 *y, char **s) { int has_delim; char *cp; @@ -142,13 +164,13 @@ int pair_decode(char *str, float8 *x, float8 *y, char **s) return(TRUE); } -int pair_encode(float8 x, float8 y, char *str) +static int pair_encode(float8 x, float8 y, char *str) { sprintf(str, "%.*g,%.*g", digits8, x, digits8, y); return(TRUE); } -int path_decode(int opentype, int npts, char *str, int *isopen, char **ss, Point *p) +static int path_decode(int opentype, int npts, char *str, int *isopen, char **ss, Point *p) { int depth = 0; char *s, *cp; @@ -200,7 +222,7 @@ int path_decode(int opentype, int npts, char *str, int *isopen, char **ss, Point return(TRUE); } /* path_decode() */ -char *path_encode( bool closed, int npts, Point *pt) +static char *path_encode( bool closed, int npts, Point *pt) { char *result = PALLOC(npts*(P_MAXLEN+3)+2); @@ -251,7 +273,7 @@ char *path_encode( bool closed, int npts, Point *pt) * '(1,3,2,4)' * require an odd number of delim characters in the string *-------------------------------------------------------------*/ -int pair_count(char *s, char delim) +static int pair_count(char *s, char delim) { int ndelim = 0; @@ -321,7 +343,7 @@ char *box_out(BOX *box) /* box_construct - fill in a new box. */ -BOX *box_construct(double x1, double x2, double y1, double y2) +static BOX *box_construct(double x1, double x2, double y1, double y2) { BOX *result = PALLOCTYPE(BOX); @@ -331,7 +353,7 @@ BOX *box_construct(double x1, double x2, double y1, double y2) /* box_fill - fill in a static box */ -BOX *box_fill(BOX *result, double x1, double x2, double y1, double y2) +static BOX *box_fill(BOX *result, double x1, double x2, double y1, double y2) { if (x1 > x2) { result->high.x = x1; @@ -354,7 +376,7 @@ BOX *box_fill(BOX *result, double x1, double x2, double y1, double y2) /* box_copy - copy a box */ -BOX *box_copy(BOX *box) +static BOX *box_copy(BOX *box) { BOX *result = PALLOCTYPE(BOX); @@ -563,7 +585,7 @@ Point *box_center(BOX *box) /* box_ar - returns the area of the box. */ -double box_ar(BOX *box) +static double box_ar(BOX *box) { return( box_wd(box) * box_ht(box) ); } @@ -572,7 +594,7 @@ double box_ar(BOX *box) /* box_wd - returns the width (length) of the box * (horizontal magnitude). */ -double box_wd(BOX *box) +static double box_wd(BOX *box) { return( box->high.x - box->low.x ); } @@ -581,7 +603,7 @@ double box_wd(BOX *box) /* box_ht - returns the height of the box * (vertical magnitude). */ -double box_ht(BOX *box) +static double box_ht(BOX *box) { return( box->high.y - box->low.y ); } @@ -590,7 +612,8 @@ double box_ht(BOX *box) /* box_dt - returns the distance between the * center points of two boxes. */ -double box_dt(BOX *box1, BOX *box2) +#ifdef NOT_USED +static double box_dt(BOX *box1, BOX *box2) { double result; Point *a, *b; @@ -603,6 +626,7 @@ double box_dt(BOX *box1, BOX *box2) PFREE(b); return(result); } +#endif /*---------------------------------------------------------- * Funky operations. @@ -661,7 +685,7 @@ LSEG *box_diagonal(BOX *box) * Internal form: Ax+By+C=0 *---------------------------------------------------------*/ -LINE * /* point-slope */ +static LINE * /* point-slope */ line_construct_pm(Point *pt, double m) { LINE *result = PALLOCTYPE(LINE); @@ -677,7 +701,7 @@ line_construct_pm(Point *pt, double m) } /* line_construct_pm() */ -LINE * /* two points */ +static LINE * /* two points */ line_construct_pp(Point *pt1, Point *pt2) { LINE *result = PALLOCTYPE(LINE); @@ -724,12 +748,12 @@ printf( "line_construct_pp- line is neither vertical nor horizontal (diffs x=%.* * Relative position routines. *---------------------------------------------------------*/ -bool line_intersect(LINE *l1, LINE *l2) +static bool line_intersect(LINE *l1, LINE *l2) { return( ! line_parallel(l1, l2) ); } -bool line_parallel(LINE *l1, LINE *l2) +static bool line_parallel(LINE *l1, LINE *l2) { #if FALSE return( FPeq(l1->m, l2->m) ); @@ -741,6 +765,7 @@ bool line_parallel(LINE *l1, LINE *l2) return(FPeq(l2->A, l1->A*(l2->B / l1->B))); } /* line_parallel() */ +#ifdef NOT_USED bool line_perp(LINE *l1, LINE *l2) { #if FALSE @@ -757,8 +782,9 @@ bool line_perp(LINE *l1, LINE *l2) return( FPeq(((l1->A * l2->B) / (l1->B * l2->A)), -1.0) ); } /* line_perp() */ +#endif -bool line_vertical(LINE *line) +static bool line_vertical(LINE *line) { #if FALSE return( FPeq(line->A, -1.0) && FPzero(line->B) ); @@ -766,7 +792,7 @@ bool line_vertical(LINE *line) return( FPzero(line->B) ); } /* line_vertical() */ -bool line_horizontal(LINE *line) +static bool line_horizontal(LINE *line) { #if FALSE return( FPzero(line->m) ); @@ -774,7 +800,7 @@ bool line_horizontal(LINE *line) return( FPzero(line->A) ); } /* line_horizontal() */ - +#ifdef NOT_USED bool line_eq(LINE *l1, LINE *l2) { double k; @@ -792,7 +818,7 @@ bool line_eq(LINE *l1, LINE *l2) FPeq(l1->B, k * l2->B) && FPeq(l1->C, k * l2->C) ); } - +#endif /*---------------------------------------------------------- * Line arithmetic routines. @@ -821,7 +847,7 @@ line_distance(LINE *l1, LINE *l2) /* line_interpt() * Point where two lines l1, l2 intersect (if any) */ -Point * +static Point * line_interpt(LINE *l1, LINE *l2) { Point *result; @@ -985,8 +1011,6 @@ bool path_n_ge(PATH *p1, PATH *p2) * Conversion operators. *---------------------------------------------------------*/ -PATH *path_copy(PATH *path); - bool path_isclosed( PATH *path) { @@ -1155,7 +1179,7 @@ double *path_length(PATH *path) } /* path_length() */ - +#ifdef NOT_USED double path_ln(PATH *path) { double result; @@ -1167,6 +1191,7 @@ double path_ln(PATH *path) return(result); } /* path_ln() */ +#endif /*********************************************************************** ** @@ -1213,7 +1238,7 @@ point_out(Point *pt) } /* point_out() */ -Point *point_construct(double x, double y) +static Point *point_construct(double x, double y) { Point *result = PALLOCTYPE(Point); @@ -1223,7 +1248,7 @@ Point *point_construct(double x, double y) } -Point *point_copy(Point *pt) +static Point *point_copy(Point *pt) { Point *result; @@ -1392,7 +1417,7 @@ LSEG *lseg_construct(Point *pt1, Point *pt2) } /* like lseg_construct, but assume space already allocated */ -void statlseg_construct(LSEG *lseg, Point *pt1, Point *pt2) +static void statlseg_construct(LSEG *lseg, Point *pt1, Point *pt2) { lseg->p[0].x = pt1->x; lseg->p[0].y = pt1->y; @@ -1489,7 +1514,7 @@ double *lseg_distance(LSEG *l1, LSEG *l2) } /* distance between l1, l2 */ -double +static double lseg_dt(LSEG *l1, LSEG *l2) { double *d, result; @@ -1833,7 +1858,7 @@ printf( "dist_cpoly- segment %d distance is %f\n", (i+1), *d); * lines and boxes, since there are typically two. *-------------------------------------------------------------------*/ -Point *interpt_sl(LSEG *lseg, LINE *line) +static Point *interpt_sl(LSEG *lseg, LINE *line) { LINE *tmp; Point *p; @@ -2194,7 +2219,7 @@ bool inter_lb(LINE *line, BOX *box) /*--------------------------------------------------------------------- * Make the smallest bounding box for the given polygon. *---------------------------------------------------------------------*/ -void make_bound_box(POLYGON *poly) +static void make_bound_box(POLYGON *poly) { int i; double x1,y1,x2,y2; @@ -3286,9 +3311,7 @@ bool circle_ge(CIRCLE *circle1, CIRCLE *circle2) * actual value. *---------------------------------------------------------*/ -CIRCLE *circle_copy(CIRCLE *circle); - -CIRCLE * +static CIRCLE * circle_copy(CIRCLE *circle) { CIRCLE *result; @@ -3494,7 +3517,7 @@ Point *circle_center(CIRCLE *circle) /* circle_ar - returns the area of the circle. */ -double circle_ar(CIRCLE *circle) +static double circle_ar(CIRCLE *circle) { return(PI*(circle->radius*circle->radius)); } @@ -3503,6 +3526,7 @@ double circle_ar(CIRCLE *circle) /* circle_dt - returns the distance between the * center points of two circlees. */ +#ifdef NOT_USED double circle_dt(CIRCLE *circle1, CIRCLE *circle2) { double result; @@ -3511,7 +3535,7 @@ double circle_dt(CIRCLE *circle1, CIRCLE *circle2) return(result); } - +#endif /*---------------------------------------------------------- * Conversion operators. @@ -3657,7 +3681,7 @@ CIRCLE *poly_circle(POLYGON *poly) #define HIT_IT INT_MAX -int +static int point_inside( Point *p, int npts, Point plist[]) { double x0, y0; @@ -3716,7 +3740,7 @@ point_inside( Point *p, int npts, Point plist[]) * It returns HIT_IT if the segment contains (0,0) */ -int +static int lseg_crossing( double x, double y, double px, double py) { double z; @@ -3756,7 +3780,7 @@ lseg_crossing( double x, double y, double px, double py) } /* lseg_crossing() */ -bool +static bool plist_same(int npts, Point p1[], Point p2[]) { int i, ii, j; diff --git a/src/backend/utils/adt/geo_selfuncs.c b/src/backend/utils/adt/geo_selfuncs.c index 94070ea2ee6..f0f7bc48d5f 100644 --- a/src/backend/utils/adt/geo_selfuncs.c +++ b/src/backend/utils/adt/geo_selfuncs.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_selfuncs.c,v 1.2 1997/03/14 23:20:20 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_selfuncs.c,v 1.3 1997/08/19 21:34:40 momjian Exp $ * * XXX These are totally bogus. * @@ -65,6 +65,7 @@ areajoinsel(Oid opid, * below) a given box? */ +#ifdef NOT_USED float64 leftsel(Oid opid, Oid relid, @@ -78,7 +79,9 @@ leftsel(Oid opid, *result = 1.0 / 6.0; return(result); } +#endif +#ifdef NOT_USED float64 leftjoinsel(Oid opid, Oid relid, @@ -92,10 +95,12 @@ leftjoinsel(Oid opid, *result = 1.0 / 6.0; return(result); } +#endif /* * contsel -- How likely is a box to contain (be contained by) a given box? */ +#ifdef NOT_USED float64 contsel(Oid opid, Oid relid, @@ -109,7 +114,9 @@ contsel(Oid opid, *result = 1.0 / 10.0; return(result); } +#endif +#ifdef NOT_USED float64 contjoinsel(Oid opid, Oid relid, @@ -123,3 +130,4 @@ contjoinsel(Oid opid, *result = 1.0 / 10.0; return(result); } +#endif diff --git a/src/backend/utils/adt/like.c b/src/backend/utils/adt/like.c index b92bb814fbb..50b31514b2a 100644 --- a/src/backend/utils/adt/like.c +++ b/src/backend/utils/adt/like.c @@ -22,6 +22,8 @@ #include "utils/palloc.h" #include "utils/builtins.h" /* where the function declarations go */ +static int like(char *text, char *p); + /* * interface routines called by the function manager */ @@ -139,7 +141,7 @@ bool textnlike(struct varlena *s, struct varlena *p) } -/* $Revision: 1.5 $ +/* $Revision: 1.6 $ ** "like.c" A first attempt at a LIKE operator for Postgres95. ** ** Originally written by Rich $alz, mirror!rs, Wed Nov 26 19:03:17 EST 1986. @@ -214,7 +216,7 @@ DoMatch(register char *text, register char *p) /* ** User-level routine. Returns TRUE or FALSE. */ -int +static int like(char *text, char *p) { if (p[0] == '%' && p[1] == '\0') diff --git a/src/backend/utils/adt/nabstime.c b/src/backend/utils/adt/nabstime.c index 0c85cae8642..0e56a2816ee 100644 --- a/src/backend/utils/adt/nabstime.c +++ b/src/backend/utils/adt/nabstime.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.30 1997/08/12 22:54:32 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.31 1997/08/19 21:34:42 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -30,6 +30,7 @@ #include "utils/builtins.h" #include "access/xact.h" +static AbsoluteTime tm2abstime(struct tm *tm, int tz); #define MIN_DAYNUM -24856 /* December 13, 1901 */ #define MAX_DAYNUM 24854 /* January 18, 2038 */ @@ -170,7 +171,7 @@ printf( "datetime2tm- (localtime) %d.%02d.%02d %02d:%02d:%02d %s dst=%d\n", * Convert a tm structure to abstime. * Note that tm has full year (not 1900-based) and 1-based month. */ -AbsoluteTime +static AbsoluteTime tm2abstime( struct tm *tm, int tz) { int day, sec; diff --git a/src/backend/utils/adt/name.c b/src/backend/utils/adt/name.c index 6c48aa8bcd4..7ef599b3dee 100644 --- a/src/backend/utils/adt/name.c +++ b/src/backend/utils/adt/name.c @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/name.c,v 1.5 1997/08/18 20:53:41 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/name.c,v 1.6 1997/08/19 21:34:45 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -130,10 +130,12 @@ int namecpy(Name n1, Name n2) return(0); } +#ifdef NOT_USED int namecat(Name n1, Name n2) { return(namestrcat(n1, n2->data)); /* n2 can't be any longer than n1 */ } +#endif int namecmp(Name n1, Name n2) { @@ -149,6 +151,7 @@ namestrcpy(Name name, char *str) return(0); } +#ifdef NOT_USED int namestrcat(Name name, char *str) { int i; @@ -165,6 +168,7 @@ int namestrcat(Name name, char *str) } return(0); } +#endif int namestrcmp(Name name, char *str) @@ -182,6 +186,7 @@ namestrcmp(Name name, char *str) * PRIVATE ROUTINES * *****************************************************************************/ +#ifdef NOT_USED uint32 NameComputeLength(Name name) { @@ -195,3 +200,4 @@ NameComputeLength(Name name) } return (uint32)length; } +#endif diff --git a/src/backend/utils/adt/not_in.c b/src/backend/utils/adt/not_in.c index 5222f3d2986..a78e7dc31ce 100644 --- a/src/backend/utils/adt/not_in.c +++ b/src/backend/utils/adt/not_in.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.2 1996/11/06 06:49:53 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.3 1997/08/19 21:34:48 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -29,6 +29,8 @@ #include "access/relscan.h" #include "utils/builtins.h" /* where function decls go */ +static int my_varattno(Relation rd, char *a); + /* ---------------------------------------------------------------- * * ---------------------------------------------------------------- @@ -107,7 +109,7 @@ bool oidnotin(Oid the_oid, char *compare) * If varattno (in parser/catalog_utils.h) ever is added to * cinterface.a, this routine should go away */ -int my_varattno(Relation rd, char *a) +static int my_varattno(Relation rd, char *a) { int i; diff --git a/src/backend/utils/adt/numutils.c b/src/backend/utils/adt/numutils.c index 8e944de3fa6..7f14317a700 100644 --- a/src/backend/utils/adt/numutils.c +++ b/src/backend/utils/adt/numutils.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.12 1997/08/12 22:54:34 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.13 1997/08/19 21:34:51 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -134,6 +134,7 @@ ltoa(int32 l, char *a) ** stars ("*****") and returns zero. Normal return is the width ** of the output field (sometimes shorter than 'width'). */ +#ifdef NOT_USED int ftoa(double value, char *ascii, int width, int prec1, char format) { @@ -286,6 +287,7 @@ ftoa(double value, char *ascii, int width, int prec1, char format) return (avail); #endif /* !BSD44_derived */ } +#endif /* ** atof1 - ASCII TO FLOATING CONVERSION @@ -315,6 +317,7 @@ ftoa(double value, char *ascii, int width, int prec1, char format) ** Side Effects: ** clobbers *val. */ +#ifdef NOT_USED int atof1(char *str, double *val) { @@ -404,3 +407,4 @@ atof1(char *str, double *val) *val = v; return (0); } +#endif diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c index 91bfdfaca23..7c25cfd67b8 100644 --- a/src/backend/utils/adt/varlena.c +++ b/src/backend/utils/adt/varlena.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.17 1997/07/29 16:12:07 thomas Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.18 1997/08/19 21:34:54 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -81,6 +81,7 @@ byteain(char *inputText) * BUGS: Extremely unportable as things shoved can be string * representations of structs, etc. */ +#ifdef NOT_USED struct varlena * shove_bytes(unsigned char *stuff, int len) { @@ -93,7 +94,7 @@ shove_bytes(unsigned char *stuff, int len) len - sizeof(int32)); return(result); } - +#endif /* @@ -202,7 +203,7 @@ textout(struct varlena *vlena) * returns the actual length of a text* (which may be less than * the VARSIZE of the text*) */ - +#ifdef NOT_USED int textlen (text* t) { int i = 0; @@ -212,6 +213,7 @@ int textlen (text* t) i++; return i; } +#endif /* * textcat - diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c index 6cba6487512..10289e03231 100644 --- a/src/backend/utils/cache/catcache.c +++ b/src/backend/utils/cache/catcache.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.6 1996/12/04 03:06:09 bryanh Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.7 1997/08/19 21:34:58 momjian Exp $ * * Notes: * XXX This needs to use exception.h to handle recovery when @@ -34,6 +34,14 @@ #include "catalog/pg_type.h" /* for OID of int28 type */ #include "lib/dllist.h" +static void CatCacheRemoveCTup(CatCache *cache, Dlelem *e); +static Index CatalogCacheComputeHashIndex(struct catcache *cacheInP); +static Index CatalogCacheComputeTupleHashIndex(struct catcache *cacheInOutP, + Relation relation, HeapTuple tuple); +static void CatalogCacheInitializeCache(struct catcache *cache, + Relation relation); +static long comphash(long l, char *v); + /* ---------------- * variables, macros and other stuff * @@ -106,7 +114,7 @@ static long eqproc[] = { #define CatalogCacheInitializeCache_DEBUG2 #endif -void +static void CatalogCacheInitializeCache(struct catcache *cache, Relation relation) { @@ -249,12 +257,14 @@ CatalogCacheInitializeCache(struct catcache *cache, * XXX temporary function * -------------------------------- */ +#ifdef NOT_USED void CatalogCacheSetId(CatCache *cacheInOutP, int id) { Assert(id == InvalidCatalogCacheId || id >= 0); cacheInOutP->id = id; } +#endif /* ---------------- * comphash -- @@ -266,7 +276,7 @@ CatalogCacheSetId(CatCache *cacheInOutP, int id) * v is the attribute value ("Datum") * ---------------- */ -long +static long comphash(long l, register char *v) { long i; @@ -305,7 +315,7 @@ comphash(long l, register char *v) * CatalogCacheComputeHashIndex * -------------------------------- */ -Index +static Index CatalogCacheComputeHashIndex(struct catcache *cacheInP) { Index hashIndex; @@ -346,7 +356,7 @@ CatalogCacheComputeHashIndex(struct catcache *cacheInP) * CatalogCacheComputeTupleHashIndex * -------------------------------- */ -Index +static Index CatalogCacheComputeTupleHashIndex(struct catcache *cacheInOutP, Relation relation, HeapTuple tuple) @@ -410,7 +420,7 @@ CatalogCacheComputeTupleHashIndex(struct catcache *cacheInOutP, * CatCacheRemoveCTup * -------------------------------- */ -void +static void CatCacheRemoveCTup(CatCache *cache, Dlelem *elt) { CatCTup *ct; diff --git a/src/backend/utils/cache/inval.c b/src/backend/utils/cache/inval.c index bf1ae049606..4f52e4e5f4c 100644 --- a/src/backend/utils/cache/inval.c +++ b/src/backend/utils/cache/inval.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.3 1996/11/08 05:59:55 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.4 1997/08/19 21:35:06 momjian Exp $ * * Note - this code is real crufty... * @@ -31,6 +31,13 @@ #include "catalog/catname.h" /* XXX to support hacks below */ #include "utils/syscache.h" /* XXX to support the hacks below */ +static InvalidationEntry InvalidationEntryAllocate(uint16 size); +static void LocalInvalidInvalidate(LocalInvalid invalid, void (*function)()); +static LocalInvalid LocalInvalidRegister(LocalInvalid invalid, + InvalidationEntry entry); +static void getmyrelids(void); + + /* ---------------- * private invalidation structures * ---------------- @@ -83,7 +90,7 @@ Oid MyAMOPRelationId = InvalidOid; * Allocates an invalidation entry. * -------------------------------- */ -InvalidationEntry +static InvalidationEntry InvalidationEntryAllocate(uint16 size) { InvalidationEntryData *entryDataP; @@ -98,7 +105,7 @@ InvalidationEntryAllocate(uint16 size) * Returns a new local cache invalidation state containing a new entry. * -------------------------------- */ -LocalInvalid +static LocalInvalid LocalInvalidRegister(LocalInvalid invalid, InvalidationEntry entry) { @@ -116,7 +123,7 @@ LocalInvalidRegister(LocalInvalid invalid, * invalidation state. * -------------------------------- */ -void +static void LocalInvalidInvalidate(LocalInvalid invalid, void (*function)()) { InvalidationEntryData *entryDataP; @@ -230,7 +237,7 @@ RelationIdRegisterLocalInvalid(Oid relationId, Oid objectId) * getmyrelids * -------------------------------- */ -void +static void getmyrelids() { HeapTuple tuple; diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c index d9228fe72b3..9de0c3fb89b 100644 --- a/src/backend/utils/cache/lsyscache.c +++ b/src/backend/utils/cache/lsyscache.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.2 1996/10/31 05:55:32 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.3 1997/08/19 21:35:11 momjian Exp $ * * NOTES * Eventually, the index information should go through here, too. @@ -434,6 +434,7 @@ get_typbyval(Oid typid) * not. Returns 1 if by value, 0 if by reference. * */ +#ifdef NOT_USED char get_typalign(Oid typid) { @@ -446,6 +447,7 @@ get_typalign(Oid typid) else return ('i'); } +#endif /* * get_typdefault - @@ -469,6 +471,7 @@ get_typdefault(Oid typid) * It returns the null char if the cache lookup fails... * */ +#ifdef NOT_USED char get_typtype(Oid typid) { @@ -482,4 +485,4 @@ get_typtype(Oid typid) return('\0'); } } - +#endif diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 585d82fc126..c29e8c839d8 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.14 1997/08/19 04:44:21 vadim Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.15 1997/08/19 21:35:13 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -85,6 +85,12 @@ #include "catalog/index.h" #include "fmgr.h" +static void RelationFlushRelation(Relation *relationPtr, + bool onlyFlushReferenceCountZero); +static Relation RelationNameCacheGetRelation(char *relationName); +static void init_irels(void); +static void write_irels(void); + /* ---------------- * defines * ---------------- @@ -1075,7 +1081,7 @@ RelationIdCacheGetRelation(Oid relationId) * RelationNameCacheGetRelation * -------------------------------- */ -Relation +static Relation RelationNameCacheGetRelation(char *relationName) { Relation rd; @@ -1185,6 +1191,7 @@ RelationNameGetRelation(char *relationName) * old "getreldesc" interface. * ---------------- */ +#ifdef NOT_USED Relation getreldesc(char *relationName) { @@ -1197,6 +1204,7 @@ getreldesc(char *relationName) return RelationNameGetRelation(relationName); } +#endif /* ---------------------------------------------------------------- * cache invalidation support routines @@ -1221,7 +1229,7 @@ RelationClose(Relation relation) * anything anymore. * -------------------------------- */ -void +static void RelationFlushRelation(Relation *relationPtr, bool onlyFlushReferenceCountZero) { @@ -1606,7 +1614,7 @@ RelationInitialize(void) /* pg_attnumind, pg_classnameind, pg_classoidind */ #define Num_indices_bootstrap 3 -void +static void init_irels(void) { Size len; @@ -1746,7 +1754,7 @@ init_irels(void) } } -void +static void write_irels(void) { int len; diff --git a/src/backend/utils/error/exc.c b/src/backend/utils/error/exc.c index a1b185fcd0f..3366996fad1 100644 --- a/src/backend/utils/error/exc.c +++ b/src/backend/utils/error/exc.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/exc.c,v 1.14 1997/08/12 22:54:46 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/exc.c,v 1.15 1997/08/19 21:35:17 momjian Exp $ * * NOTE * XXX this code needs improvement--check for state violations and @@ -24,6 +24,11 @@ #include "utils/exc.h" #include "storage/ipc.h" +static void ExcUnCaught(Exception *excP, ExcDetail detail, ExcData data, + ExcMessage message); +static void ExcPrint(Exception *excP, ExcDetail detail, ExcData data, + ExcMessage message); + /* * Global Variables */ @@ -86,7 +91,7 @@ EnableExceptionHandling(bool on) ExceptionHandlingEnabled = on; } -void +static void ExcPrint(Exception *excP, ExcDetail detail, ExcData data, @@ -129,12 +134,15 @@ ExcPrint(Exception *excP, fflush(stderr); } +#ifdef NOT_USED ExcProc * ExcGetUnCaught(void) { return (ExcUnCaughtP); } +#endif +#ifdef NOT_USED ExcProc * ExcSetUnCaught(ExcProc *newP) { @@ -144,8 +152,9 @@ ExcSetUnCaught(ExcProc *newP) return (oldP); } +#endif -void +static void ExcUnCaught(Exception *excP, ExcDetail detail, ExcData data, diff --git a/src/backend/utils/fmgr/fmgr.c b/src/backend/utils/fmgr/fmgr.c index 99fb7d8c9d6..1da0ab18773 100644 --- a/src/backend/utils/fmgr/fmgr.c +++ b/src/backend/utils/fmgr/fmgr.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.2 1996/11/08 06:00:14 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.3 1997/08/19 21:35:21 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -207,6 +207,7 @@ fmgr(Oid procedureId, ... ) * * func_ptr, func_id, n_arguments, args... */ +#ifdef NOT_USED char * fmgr_ptr(func_ptr user_fn, Oid func_id, ...) { @@ -230,6 +231,7 @@ fmgr_ptr(func_ptr user_fn, Oid func_id, ...) return(fmgr_c(user_fn, func_id, n_arguments, &values, &isNull)); } +#endif /* * This routine is not well thought out. When I get around to adding a diff --git a/src/backend/utils/hash/hashfn.c b/src/backend/utils/hash/hashfn.c index 7c11724ded8..3b2f0ec19a9 100644 --- a/src/backend/utils/hash/hashfn.c +++ b/src/backend/utils/hash/hashfn.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/hash/hashfn.c,v 1.2 1996/11/03 06:54:16 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/hash/hashfn.c,v 1.3 1997/08/19 21:35:33 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -125,6 +125,7 @@ tag_hash(int *key, int keysize) * instructions. If this routine is heavily used enough, it's * worth the ugly coding */ +#ifdef NOT_USED long disk_hash(char *key) { @@ -154,5 +155,5 @@ disk_hash(char *key) } return(n); } - +#endif diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c index acf9297233c..2fe002bd914 100644 --- a/src/backend/utils/init/miscinit.c +++ b/src/backend/utils/init/miscinit.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.5 1997/04/27 19:20:37 thomas Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.6 1997/08/19 21:35:44 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -101,6 +101,7 @@ ExitPostgres(ExitStatus status) * Exceptions: * none */ +#ifdef NOT_USED void AbortPostgres() { @@ -115,6 +116,7 @@ AbortPostgres() else exitpg(FatalExitStatus); } +#endif /* ---------------- * StatusBackendExit diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c index 253814f33da..f338cc83c70 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.10 1997/08/12 22:54:54 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.11 1997/08/19 21:35:50 momjian Exp $ * * NOTES * InitPostgres() is the function called from PostgresMain @@ -71,6 +71,11 @@ #include "port-protos.h" #include "libpq/libpq-be.h" +static void InitCommunication(void); +static void InitMyDatabaseId(void); +static void InitStdio(void); +static void InitUserid(void); + static IPCKey PostgresIpcKey; @@ -108,7 +113,7 @@ static IPCKey PostgresIpcKey; * database directory but before we open any relations. * -------------------------------- */ -void +static void InitMyDatabaseId() { int dbfd; @@ -334,7 +339,7 @@ DoChdirAndInitDatabaseNameAndPath(char *name) { * initializes crap associated with the user id. * -------------------------------- */ -void +static void InitUserid() { setuid(geteuid()); @@ -351,7 +356,7 @@ InitUserid() * This does not set MyBackendId. MyBackendTag is set, however. * -------------------------------- */ -void +static void InitCommunication() { char *postid; @@ -460,7 +465,7 @@ InitCommunication() * they all seem to do stuff associated with io. * -------------------------------- */ -void +static void InitStdio() { DebugFileOpen(); diff --git a/src/backend/utils/mmgr/aset.c b/src/backend/utils/mmgr/aset.c index 41908232065..8e0482de38c 100644 --- a/src/backend/utils/mmgr/aset.c +++ b/src/backend/utils/mmgr/aset.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/aset.c,v 1.4 1996/11/10 03:03:45 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/aset.c,v 1.5 1997/08/19 21:35:54 momjian Exp $ * * NOTE * XXX This is a preliminary implementation which lacks fail-fast @@ -25,6 +25,10 @@ # include <string.h> #endif +static void AllocPointerDump(AllocPointer pointer); +static int AllocSetIterate(AllocSet set, + void (*function)(AllocPointer pointer)); + #undef AllocSetReset #undef malloc #undef free @@ -273,7 +277,7 @@ AllocSetRealloc(AllocSet set, AllocPointer pointer, Size size) * Exceptions: * BadArg if set is invalid. */ -int +static int AllocSetIterate(AllocSet set, void (*function)(AllocPointer pointer)) { @@ -295,6 +299,7 @@ AllocSetIterate(AllocSet set, return (count); } +#ifdef NOT_USED int AllocSetCount(AllocSet set) { @@ -310,6 +315,7 @@ AllocSetCount(AllocSet set) } return count; } +#endif /* * Private routines @@ -367,7 +373,7 @@ AllocPointerGetNext(AllocPointer pointer) * XXX AllocPointerDump -- * Displays allocated pointer. */ -void +static void AllocPointerDump(AllocPointer pointer) { printf("\t%-10ld@ %0#lx\n", ((long*)pointer)[-1], (long)pointer); /* XXX */ diff --git a/src/backend/utils/mmgr/mcxt.c b/src/backend/utils/mmgr/mcxt.c index e03948ff04e..df2eb480817 100644 --- a/src/backend/utils/mmgr/mcxt.c +++ b/src/backend/utils/mmgr/mcxt.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/mcxt.c,v 1.2 1996/11/08 06:00:54 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/mcxt.c,v 1.3 1997/08/19 21:35:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -281,6 +281,7 @@ MemoryContextRealloc(MemoryContext context, * ??? * BadArgumentsErr if firstTime is true for subsequent calls. */ +#ifdef NOT_USED char* MemoryContextGetName(MemoryContext context) { @@ -289,6 +290,7 @@ MemoryContextGetName(MemoryContext context) return (context->method->getName(context)); } +#endif /* * PointerGetAllocSize -- @@ -301,6 +303,7 @@ MemoryContextGetName(MemoryContext context) * ??? * BadArgumentsErr if firstTime is true for subsequent calls. */ +#ifdef NOT_USED Size PointerGetAllocSize(Pointer pointer) { @@ -309,6 +312,7 @@ PointerGetAllocSize(Pointer pointer) return (PSIZE(pointer)); } +#endif /* * MemoryContextSwitchTo -- diff --git a/src/backend/utils/mmgr/oset.c b/src/backend/utils/mmgr/oset.c index 478fe1516ab..d413cb5cb6f 100644 --- a/src/backend/utils/mmgr/oset.c +++ b/src/backend/utils/mmgr/oset.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/Attic/oset.c,v 1.1.1.1 1996/07/09 06:22:09 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/Attic/oset.c,v 1.2 1997/08/19 21:35:59 momjian Exp $ * * NOTE * XXX This is a preliminary implementation which lacks fail-fast @@ -89,6 +89,7 @@ OrderedSetGetHead(OrderedSet set) /* * OrderedSetGetTail -- */ +#ifdef NOT_USED Pointer OrderedSetGetTail(OrderedSet set) { @@ -100,6 +101,7 @@ OrderedSetGetTail(OrderedSet set) } return (NULL); } +#endif /* * OrderedElemGetPredecessor -- diff --git a/src/backend/utils/mmgr/portalmem.c b/src/backend/utils/mmgr/portalmem.c index 23e600ce244..7f1674d88db 100644 --- a/src/backend/utils/mmgr/portalmem.c +++ b/src/backend/utils/mmgr/portalmem.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/portalmem.c,v 1.4 1997/08/12 22:54:57 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/portalmem.c,v 1.5 1997/08/19 21:36:04 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -91,6 +91,12 @@ #include "utils/portal.h" +static void CollectNamedPortals(Portal *portalP, int destroy); +static Portal PortalHeapMemoryGetPortal(PortalHeapMemory context); +static PortalVariableMemory PortalHeapMemoryGetVariableMemory(PortalHeapMemory context); +static void PortalResetHeapMemory(Portal portal); +static Portal PortalVariableMemoryGetPortal(PortalVariableMemory context); + /* ---------------- * ALLOCFREE_ERROR_ABORT * define this if you want a core dump when you try to @@ -413,7 +419,7 @@ PortalNameIsSpecial(char *pname) * entry *before* we destroy anything (destroying updates the hashtable * and screws up the sequential walk of the table). -mer 17 Aug 1992 */ -void +static void CollectNamedPortals(Portal *portalP, int destroy) { static Portal *portalList = (Portal *)NULL; @@ -800,7 +806,7 @@ PortalDestroy(Portal *portalP) * BadArg if mode is invalid. * ---------------- */ -void +static void PortalResetHeapMemory(Portal portal) { PortalHeapMemory context; @@ -929,7 +935,7 @@ PortalGetHeapMemory(Portal portal) * BadState if called when disabled. * BadArg if context is invalid. */ -Portal +static Portal PortalVariableMemoryGetPortal(PortalVariableMemory context) { return ((Portal)((char *)context - offsetof (PortalD, variable))); @@ -943,7 +949,7 @@ PortalVariableMemoryGetPortal(PortalVariableMemory context) * BadState if called when disabled. * BadArg if context is invalid. */ -Portal +static Portal PortalHeapMemoryGetPortal(PortalHeapMemory context) { return ((Portal)((char *)context - offsetof (PortalD, heap))); @@ -957,6 +963,7 @@ PortalHeapMemoryGetPortal(PortalHeapMemory context) * BadState if called when disabled. * BadArg if context is invalid. */ +#ifdef NOT_USED PortalHeapMemory PortalVariableMemoryGetHeapMemory(PortalVariableMemory context) { @@ -964,6 +971,7 @@ PortalVariableMemoryGetHeapMemory(PortalVariableMemory context) - offsetof (PortalD, variable) + offsetof (PortalD, heap))); } +#endif /* * PortalHeapMemoryGetVariableMemory -- @@ -973,7 +981,7 @@ PortalVariableMemoryGetHeapMemory(PortalVariableMemory context) * BadState if called when disabled. * BadArg if context is invalid. */ -PortalVariableMemory +static PortalVariableMemory PortalHeapMemoryGetVariableMemory(PortalHeapMemory context) { return ((PortalVariableMemory)((char *)context diff --git a/src/backend/utils/sort/psort.c b/src/backend/utils/sort/psort.c index a5f43deece2..d7829401810 100644 --- a/src/backend/utils/sort/psort.c +++ b/src/backend/utils/sort/psort.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.16 1997/08/18 02:14:56 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.17 1997/08/19 21:36:06 momjian Exp $ * * NOTES * Sorts the first relation into the second relation. @@ -64,6 +64,18 @@ #include "miscadmin.h" #include "storage/fd.h" +static bool createrun(Sort *node, FILE *file, bool *empty); +static void destroytape(FILE *file); +static void dumptuples(FILE *file, Sort *node); +static FILE *gettape(void); +static void initialrun(Sort *node, bool *empty); +static void inittapes(Sort *node); +static void merge(Sort *node, struct tape *dest); +static FILE *mergeruns(Sort *node); +static HeapTuple tuplecopy(HeapTuple tup); + + + #define TEMPDIR "./" static long shortzero = 0; /* used to delimit runs */ @@ -157,7 +169,7 @@ psort_begin(Sort *node, int nkeys, ScanKey key) * Returns: * number of allocated tapes */ -void +static void inittapes(Sort *node) { register int i; @@ -194,17 +206,6 @@ inittapes(Sort *node) } /* - * resetpsort - resets (pfrees) palloc'd memory for an aborted Xaction - * - * Not implemented yet. - */ -void -resetpsort() -{ - ; -} - -/* * PUTTUP - writes the next tuple * ENDRUN - mark end of run * GETLEN - reads the length of the next tuple @@ -266,7 +267,7 @@ resetpsort() * I (perhaps prematurely) combined the 2 algorithms. * Also, perhaps allocate tapes when needed. Split into 2 funcs. */ -void +static void initialrun(Sort *node, bool *empty) { /* register struct tuple *tup; */ @@ -341,7 +342,7 @@ initialrun(Sort *node, bool *empty) * FALSE iff process through end of relation * Tuples contains the tuples for the following run upon exit */ -bool +static bool createrun(Sort *node, FILE *file, bool *empty) { register HeapTuple lasttuple; @@ -429,7 +430,7 @@ createrun(Sort *node, FILE *file, bool *empty) * This should eventually go there under that name? And this will * then use palloc directly (see version -r1.2). */ -HeapTuple +static HeapTuple tuplecopy(HeapTuple tup) { HeapTuple rettup; @@ -449,7 +450,7 @@ tuplecopy(HeapTuple tup) * Returns: * file of tuples in order */ -FILE * +static FILE * mergeruns(Sort *node) { register struct tape *tp; @@ -475,7 +476,7 @@ mergeruns(Sort *node) * merge - handles a single merge of the tape * (polyphase merge Alg.D(D5)--Knuth, Vol.3, p271) */ -void +static void merge(Sort *node, struct tape *dest) { register HeapTuple tup; @@ -571,7 +572,7 @@ merge(Sort *node, struct tape *dest) /* * dumptuples - stores all the tuples in tree into file */ -void +static void dumptuples(FILE *file, Sort *node) { register struct leftist *tp; @@ -736,7 +737,7 @@ static struct tapelst *Tapes = NULL; * Open stream for writing/reading. * NULL if unable to open temporary file. */ -FILE * +static FILE * gettape() { register struct tapelst *tp; @@ -777,7 +778,8 @@ gettape() /* * resettape - resets the tape to size 0 */ -void +#ifdef NOT_USED +static void resettape(FILE *file) { register struct tapelst *tp; @@ -796,6 +798,7 @@ resettape(FILE *file) elog(FATAL, "could not freopen temporary file"); } } +#endif /* * distroytape - unlinks the tape @@ -806,7 +809,7 @@ resettape(FILE *file) * Possible bugs: * Exits instead of returning status, if given invalid tape. */ -void +static void destroytape(FILE *file) { register struct tapelst *tp, *tq; diff --git a/src/backend/utils/time/tqual.c b/src/backend/utils/time/tqual.c index 5c2f8271fa8..a5843004733 100644 --- a/src/backend/utils/time/tqual.c +++ b/src/backend/utils/time/tqual.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.2 1997/03/28 07:05:28 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.3 1997/08/19 21:36:12 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -26,6 +26,16 @@ #include "utils/tqual.h" +static AbsoluteTime TimeQualGetEndTime(TimeQual qual); +static AbsoluteTime TimeQualGetSnapshotTime(TimeQual qual); +static AbsoluteTime TimeQualGetStartTime(TimeQual qual); +static bool TimeQualIncludesNow(TimeQual qual); +static bool TimeQualIndicatesDisableValidityChecking(TimeQual qual); +static bool TimeQualIsLegal(TimeQual qual); +static bool TimeQualIsRanged(TimeQual qual); +static bool TimeQualIsSnapshot(TimeQual qual); +static bool TimeQualIsValid(TimeQual qual); + /* * TimeQualMode -- * Mode indicator for treatment of time qualifications. @@ -114,7 +124,7 @@ static bool HeapTupleSatisfiesUpperUnboundedInternalTimeQual(HeapTuple tuple, * TimeQualIsValid -- * True iff time qualification is valid. */ -bool +static bool TimeQualIsValid(TimeQual qual) { bool hasStartTime; @@ -162,7 +172,7 @@ TimeQualIsValid(TimeQual qual) * Note: * Assumes time qualification is valid. */ -bool +static bool TimeQualIsLegal(TimeQual qual) { Assert(TimeQualIsValid(qual)); @@ -221,7 +231,7 @@ TimeQualIsLegal(TimeQual qual) * Note: * Assumes time qualification is valid. */ -bool +static bool TimeQualIncludesNow(TimeQual qual) { Assert(TimeQualIsValid(qual)); @@ -251,6 +261,7 @@ TimeQualIncludesNow(TimeQual qual) * Assumes time qualification is valid. * XXX may not be needed? */ +#ifdef NOT_USED bool TimeQualIncludesPast(TimeQual qual) { @@ -263,6 +274,7 @@ TimeQualIncludesPast(TimeQual qual) /* otherwise, must check archive (setting locks as appropriate) */ return (true); } +#endif /* * TimeQualIsSnapshot -- @@ -271,7 +283,7 @@ TimeQualIncludesPast(TimeQual qual) * Note: * Assumes time qualification is valid. */ -bool +static bool TimeQualIsSnapshot(TimeQual qual) { Assert(TimeQualIsValid(qual)); @@ -290,7 +302,7 @@ TimeQualIsSnapshot(TimeQual qual) * Note: * Assumes time qualification is valid. */ -bool +static bool TimeQualIsRanged(TimeQual qual) { Assert(TimeQualIsValid(qual)); @@ -310,7 +322,7 @@ TimeQualIsRanged(TimeQual qual) * Note: * XXX This should not be implemented since this does not make sense. */ -bool +static bool TimeQualIndicatesDisableValidityChecking(TimeQual qual) { Assert (TimeQualIsValid(qual)); @@ -332,7 +344,7 @@ TimeQualIndicatesDisableValidityChecking(TimeQual qual) * Note: * Assumes time qual is valid snapshot time qual. */ -AbsoluteTime +static AbsoluteTime TimeQualGetSnapshotTime(TimeQual qual) { Assert(TimeQualIsSnapshot(qual)); @@ -347,7 +359,7 @@ TimeQualGetSnapshotTime(TimeQual qual) * Note: * Assumes time qual is valid ranged time qual. */ -AbsoluteTime +static AbsoluteTime TimeQualGetStartTime(TimeQual qual) { Assert(TimeQualIsRanged(qual)); @@ -362,7 +374,7 @@ TimeQualGetStartTime(TimeQual qual) * Note: * Assumes time qual is valid ranged time qual. */ -AbsoluteTime +static AbsoluteTime TimeQualGetEndTime(TimeQual qual) { Assert(TimeQualIsRanged(qual)); |