diff options
| author | Bruce Momjian | 1997-08-19 21:40:56 +0000 |
|---|---|---|
| committer | Bruce Momjian | 1997-08-19 21:40:56 +0000 |
| commit | 1d8bbfd2e7cfb72cbe4d5c5d4fa650a28dedac0b (patch) | |
| tree | 8d3a5dac9207f22c3afb8afb563d54f88774deb3 /src/backend/utils/adt | |
| parent | b992e200b8872ecb6652ec85111995f8d4c5aee0 (diff) | |
Make functions static where possible, enclose unused functions in #ifdef NOT_USED.
Diffstat (limited to 'src/backend/utils/adt')
| -rw-r--r-- | src/backend/utils/adt/acl.c | 5 | ||||
| -rw-r--r-- | src/backend/utils/adt/arrayfuncs.c | 12 | ||||
| -rw-r--r-- | src/backend/utils/adt/chunk.c | 6 | ||||
| -rw-r--r-- | src/backend/utils/adt/date.c | 6 | ||||
| -rw-r--r-- | src/backend/utils/adt/datetime.c | 9 | ||||
| -rw-r--r-- | src/backend/utils/adt/datum.c | 4 | ||||
| -rw-r--r-- | src/backend/utils/adt/dt.c | 60 | ||||
| -rw-r--r-- | src/backend/utils/adt/geo_ops.c | 128 | ||||
| -rw-r--r-- | src/backend/utils/adt/geo_selfuncs.c | 10 | ||||
| -rw-r--r-- | src/backend/utils/adt/like.c | 6 | ||||
| -rw-r--r-- | src/backend/utils/adt/nabstime.c | 5 | ||||
| -rw-r--r-- | src/backend/utils/adt/name.c | 8 | ||||
| -rw-r--r-- | src/backend/utils/adt/not_in.c | 6 | ||||
| -rw-r--r-- | src/backend/utils/adt/numutils.c | 6 | ||||
| -rw-r--r-- | src/backend/utils/adt/varlena.c | 8 |
15 files changed, 179 insertions, 100 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 - |
