aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils')
-rw-r--r--src/backend/utils/adt/acl.c278
-rw-r--r--src/backend/utils/adt/arrayfuncs.c692
-rw-r--r--src/backend/utils/adt/arrayutils.c32
-rw-r--r--src/backend/utils/adt/bool.c6
-rw-r--r--src/backend/utils/adt/cash.c102
-rw-r--r--src/backend/utils/adt/char.c77
-rw-r--r--src/backend/utils/adt/chunk.c185
-rw-r--r--src/backend/utils/adt/date.c200
-rw-r--r--src/backend/utils/adt/datetime.c192
-rw-r--r--src/backend/utils/adt/datum.c22
-rw-r--r--src/backend/utils/adt/dt.c1646
-rw-r--r--src/backend/utils/adt/filename.c32
-rw-r--r--src/backend/utils/adt/float.c238
-rw-r--r--src/backend/utils/adt/geo_ops.c840
-rw-r--r--src/backend/utils/adt/geo_selfuncs.c14
-rw-r--r--src/backend/utils/adt/int.c191
-rw-r--r--src/backend/utils/adt/like.c60
-rw-r--r--src/backend/utils/adt/misc.c4
-rw-r--r--src/backend/utils/adt/nabstime.c188
-rw-r--r--src/backend/utils/adt/name.c18
-rw-r--r--src/backend/utils/adt/not_in.c34
-rw-r--r--src/backend/utils/adt/numutils.c128
-rw-r--r--src/backend/utils/adt/oid.c20
-rw-r--r--src/backend/utils/adt/oidint2.c12
-rw-r--r--src/backend/utils/adt/oidint4.c16
-rw-r--r--src/backend/utils/adt/oidname.c16
-rw-r--r--src/backend/utils/adt/oracle_compat.c140
-rw-r--r--src/backend/utils/adt/regexp.c38
-rw-r--r--src/backend/utils/adt/regproc.c82
-rw-r--r--src/backend/utils/adt/selfuncs.c88
-rw-r--r--src/backend/utils/adt/sets.c32
-rw-r--r--src/backend/utils/adt/tid.c26
-rw-r--r--src/backend/utils/adt/timestamp.c42
-rw-r--r--src/backend/utils/adt/varchar.c210
-rw-r--r--src/backend/utils/adt/varlena.c110
-rw-r--r--src/backend/utils/cache/catcache.c252
-rw-r--r--src/backend/utils/cache/fcache.c42
-rw-r--r--src/backend/utils/cache/inval.c110
-rw-r--r--src/backend/utils/cache/lsyscache.c16
-rw-r--r--src/backend/utils/cache/relcache.c380
-rw-r--r--src/backend/utils/cache/syscache.c76
-rw-r--r--src/backend/utils/error/assert.c6
-rw-r--r--src/backend/utils/error/elog.c86
-rw-r--r--src/backend/utils/error/exc.c22
-rw-r--r--src/backend/utils/error/excid.c22
-rw-r--r--src/backend/utils/error/format.c8
-rw-r--r--src/backend/utils/fmgr/dfmgr.c40
-rw-r--r--src/backend/utils/fmgr/fmgr.c191
-rw-r--r--src/backend/utils/hash/dynahash.c242
-rw-r--r--src/backend/utils/hash/hashfn.c158
-rw-r--r--src/backend/utils/init/findbe.c58
-rw-r--r--src/backend/utils/init/globals.c62
-rw-r--r--src/backend/utils/init/miscinit.c28
-rw-r--r--src/backend/utils/init/postinit.c59
-rw-r--r--src/backend/utils/misc/superuser.c6
-rw-r--r--src/backend/utils/mmgr/aset.c38
-rw-r--r--src/backend/utils/mmgr/mcxt.c40
-rw-r--r--src/backend/utils/mmgr/oset.c10
-rw-r--r--src/backend/utils/mmgr/palloc.c10
-rw-r--r--src/backend/utils/mmgr/portalmem.c80
-rw-r--r--src/backend/utils/sort/lselect.c32
-rw-r--r--src/backend/utils/sort/psort.c83
-rw-r--r--src/backend/utils/time/tqual.c74
63 files changed, 4152 insertions, 4090 deletions
diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c
index d4b8f1ca0b6..d0acb4c6941 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.14 1997/09/07 04:49:53 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.15 1997/09/08 02:30:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -21,10 +21,10 @@
#include "utils/syscache.h"
#include "miscadmin.h"
-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);
+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"
@@ -41,11 +41,11 @@ static char *aclparse(char *s, AclItem * aip, unsigned *modechg);
* - loads the identifier into 'name'. (If no identifier is found, 'name'
* contains an empty string).
*/
-static char *
+static char *
getid(char *s, char *n)
{
- unsigned len;
- char *id;
+ unsigned len;
+ char *id;
Assert(s && n);
@@ -82,11 +82,11 @@ getid(char *s, char *n)
* UID/GID, id type identifier and mode type values.
* - loads 'modechg' with the mode change flag.
*/
-static char *
+static char *
aclparse(char *s, AclItem * aip, unsigned *modechg)
{
- HeapTuple htp;
- char name[NAMEDATALEN];
+ HeapTuple htp;
+ char name[NAMEDATALEN];
Assert(s && aip && modechg);
@@ -113,18 +113,18 @@ aclparse(char *s, AclItem * aip, unsigned *modechg)
switch (*s)
{
- case ACL_MODECHG_ADD_CHR:
- *modechg = ACL_MODECHG_ADD;
- break;
- case ACL_MODECHG_DEL_CHR:
- *modechg = ACL_MODECHG_DEL;
- break;
- case ACL_MODECHG_EQL_CHR:
- *modechg = ACL_MODECHG_EQL;
- break;
- default:
- elog(WARN, "aclparse: mode change flag must use \"%s\"",
- ACL_MODECHG_STR);
+ case ACL_MODECHG_ADD_CHR:
+ *modechg = ACL_MODECHG_ADD;
+ break;
+ case ACL_MODECHG_DEL_CHR:
+ *modechg = ACL_MODECHG_DEL;
+ break;
+ case ACL_MODECHG_EQL_CHR:
+ *modechg = ACL_MODECHG_EQL;
+ break;
+ default:
+ elog(WARN, "aclparse: mode change flag must use \"%s\"",
+ ACL_MODECHG_STR);
}
aip->ai_mode = ACL_NO;
@@ -132,39 +132,39 @@ aclparse(char *s, AclItem * aip, unsigned *modechg)
{
switch (*s)
{
- case ACL_MODE_AP_CHR:
- aip->ai_mode |= ACL_AP;
- break;
- case ACL_MODE_RD_CHR:
- aip->ai_mode |= ACL_RD;
- break;
- case ACL_MODE_WR_CHR:
- aip->ai_mode |= ACL_WR;
- break;
- case ACL_MODE_RU_CHR:
- aip->ai_mode |= ACL_RU;
- break;
- default:
- elog(WARN, "aclparse: mode flags must use \"%s\"",
- ACL_MODE_STR);
+ case ACL_MODE_AP_CHR:
+ aip->ai_mode |= ACL_AP;
+ break;
+ case ACL_MODE_RD_CHR:
+ aip->ai_mode |= ACL_RD;
+ break;
+ case ACL_MODE_WR_CHR:
+ aip->ai_mode |= ACL_WR;
+ break;
+ case ACL_MODE_RU_CHR:
+ aip->ai_mode |= ACL_RU;
+ break;
+ default:
+ elog(WARN, "aclparse: mode flags must use \"%s\"",
+ ACL_MODE_STR);
}
}
switch (aip->ai_idtype)
{
- case ACL_IDTYPE_UID:
- htp = SearchSysCacheTuple(USENAME, PointerGetDatum(name),
- 0, 0, 0);
- if (!HeapTupleIsValid(htp))
- elog(WARN, "aclparse: non-existent user \"%s\"", name);
- aip->ai_id = ((Form_pg_user) GETSTRUCT(htp))->usesysid;
- break;
- case ACL_IDTYPE_GID:
- aip->ai_id = get_grosysid(name);
- break;
- case ACL_IDTYPE_WORLD:
- aip->ai_id = ACL_ID_WORLD;
- break;
+ case ACL_IDTYPE_UID:
+ htp = SearchSysCacheTuple(USENAME, PointerGetDatum(name),
+ 0, 0, 0);
+ if (!HeapTupleIsValid(htp))
+ elog(WARN, "aclparse: non-existent user \"%s\"", name);
+ aip->ai_id = ((Form_pg_user) GETSTRUCT(htp))->usesysid;
+ break;
+ case ACL_IDTYPE_GID:
+ aip->ai_id = get_grosysid(name);
+ break;
+ case ACL_IDTYPE_WORLD:
+ aip->ai_id = ACL_ID_WORLD;
+ break;
}
#ifdef ACLDEBUG_TRACE
@@ -181,11 +181,11 @@ aclparse(char *s, AclItem * aip, unsigned *modechg)
* RETURNS:
* the new Acl
*/
-Acl *
+Acl *
makeacl(int n)
{
- Acl *new_acl;
- Size size;
+ Acl *new_acl;
+ Size size;
if (n < 0)
elog(WARN, "makeacl: invalid size: %d\n", n);
@@ -209,11 +209,11 @@ makeacl(int n)
* RETURNS:
* the new AclItem
*/
-AclItem *
+AclItem *
aclitemin(char *s)
{
- unsigned modechg;
- AclItem *aip;
+ unsigned modechg;
+ AclItem *aip;
if (!s)
elog(WARN, "aclitemin: null string");
@@ -239,18 +239,18 @@ aclitemin(char *s)
* RETURNS:
* the new string
*/
-char *
+char *
aclitemout(AclItem * aip)
{
- register char *p;
- char *out;
- HeapTuple htp;
- unsigned i;
- static AclItem default_aclitem = {ACL_ID_WORLD,
+ register char *p;
+ char *out;
+ HeapTuple htp;
+ unsigned i;
+ static AclItem default_aclitem = {ACL_ID_WORLD,
ACL_IDTYPE_WORLD,
ACL_WORLD_DEFAULT};
- extern char *int2out();
- char *tmpname;
+ extern char *int2out();
+ char *tmpname;
if (!aip)
aip = &default_aclitem;
@@ -262,33 +262,33 @@ aclitemout(AclItem * aip)
switch (aip->ai_idtype)
{
- case ACL_IDTYPE_UID:
- htp = SearchSysCacheTuple(USESYSID, ObjectIdGetDatum(aip->ai_id),
- 0, 0, 0);
- if (!HeapTupleIsValid(htp))
- {
- char *tmp = int2out(aip->ai_id);
+ case ACL_IDTYPE_UID:
+ htp = SearchSysCacheTuple(USESYSID, ObjectIdGetDatum(aip->ai_id),
+ 0, 0, 0);
+ if (!HeapTupleIsValid(htp))
+ {
+ char *tmp = int2out(aip->ai_id);
- elog(NOTICE, "aclitemout: usesysid %d not found",
- aip->ai_id);
- strcat(p, tmp);
- pfree(tmp);
- }
- else
- strncat(p, (char *) &((Form_pg_user)
- GETSTRUCT(htp))->usename,
- sizeof(NameData));
- break;
- case ACL_IDTYPE_GID:
- strcat(p, "group ");
- tmpname = get_groname(aip->ai_id);
- strncat(p, tmpname, NAMEDATALEN);
- break;
- case ACL_IDTYPE_WORLD:
- break;
- default:
- elog(WARN, "aclitemout: bad ai_idtype: %d", aip->ai_idtype);
- break;
+ elog(NOTICE, "aclitemout: usesysid %d not found",
+ aip->ai_id);
+ strcat(p, tmp);
+ pfree(tmp);
+ }
+ else
+ strncat(p, (char *) &((Form_pg_user)
+ GETSTRUCT(htp))->usename,
+ sizeof(NameData));
+ break;
+ case ACL_IDTYPE_GID:
+ strcat(p, "group ");
+ tmpname = get_groname(aip->ai_id);
+ strncat(p, tmpname, NAMEDATALEN);
+ break;
+ case ACL_IDTYPE_WORLD:
+ break;
+ default:
+ elog(WARN, "aclitemout: bad ai_idtype: %d", aip->ai_idtype);
+ break;
}
while (*p)
++p;
@@ -311,7 +311,7 @@ aclitemout(AclItem * aip)
* RETURNS:
* a boolean value indicating = or >
*/
-static int32
+static int32
aclitemeq(AclItem * a1, AclItem * a2)
{
if (!a1 && !a2)
@@ -321,7 +321,7 @@ aclitemeq(AclItem * a1, AclItem * a2)
return (a1->ai_idtype == a2->ai_idtype && a1->ai_id == a2->ai_id);
}
-static int32
+static int32
aclitemgt(AclItem * a1, AclItem * a2)
{
if (a1 && !a2)
@@ -332,11 +332,11 @@ aclitemgt(AclItem * a1, AclItem * a2)
(a1->ai_idtype == a2->ai_idtype && a1->ai_id > a2->ai_id));
}
-Acl *
+Acl *
aclownerdefault(AclId ownerid)
{
- Acl *acl;
- AclItem *aip;
+ Acl *acl;
+ AclItem *aip;
acl = makeacl(2);
aip = ACL_DAT(acl);
@@ -349,11 +349,11 @@ aclownerdefault(AclId ownerid)
return (acl);
}
-Acl *
+Acl *
acldefault(void)
{
- Acl *acl;
- AclItem *aip;
+ Acl *acl;
+ AclItem *aip;
acl = makeacl(1);
aip = ACL_DAT(acl);
@@ -363,15 +363,15 @@ acldefault(void)
return (acl);
}
-Acl *
+Acl *
aclinsert3(Acl * old_acl, AclItem * mod_aip, unsigned modechg)
{
- Acl *new_acl;
- AclItem *old_aip,
- *new_aip;
- unsigned src,
- dst,
- num;
+ Acl *new_acl;
+ AclItem *old_aip,
+ *new_aip;
+ unsigned src,
+ dst,
+ num;
if (!old_acl || ACL_NUM(old_acl) < 1)
{
@@ -435,18 +435,18 @@ aclinsert3(Acl * old_acl, AclItem * mod_aip, unsigned modechg)
}
switch (modechg)
{
- case ACL_MODECHG_ADD:
- new_aip[dst].ai_mode =
- old_aip[src].ai_mode | mod_aip->ai_mode;
- break;
- case ACL_MODECHG_DEL:
- new_aip[dst].ai_mode =
- old_aip[src].ai_mode & ~mod_aip->ai_mode;
- break;
- case ACL_MODECHG_EQL:
- new_aip[dst].ai_mode =
- mod_aip->ai_mode;
- break;
+ case ACL_MODECHG_ADD:
+ new_aip[dst].ai_mode =
+ old_aip[src].ai_mode | mod_aip->ai_mode;
+ break;
+ case ACL_MODECHG_DEL:
+ new_aip[dst].ai_mode =
+ old_aip[src].ai_mode & ~mod_aip->ai_mode;
+ break;
+ case ACL_MODECHG_EQL:
+ new_aip[dst].ai_mode =
+ mod_aip->ai_mode;
+ break;
}
/*
@@ -458,7 +458,7 @@ aclinsert3(Acl * old_acl, AclItem * mod_aip, unsigned modechg)
{
if (new_aip[dst].ai_mode == 0)
{
- int i;
+ int i;
for (i = dst + 1; i < num; i++)
{
@@ -480,21 +480,21 @@ aclinsert3(Acl * old_acl, AclItem * mod_aip, unsigned modechg)
* aclinsert
*
*/
-Acl *
+Acl *
aclinsert(Acl * old_acl, AclItem * mod_aip)
{
return (aclinsert3(old_acl, mod_aip, ACL_MODECHG_EQL));
}
-Acl *
+Acl *
aclremove(Acl * old_acl, AclItem * mod_aip)
{
- Acl *new_acl;
- AclItem *old_aip,
- *new_aip;
- unsigned dst,
- old_num,
- new_num;
+ Acl *new_acl;
+ AclItem *old_aip,
+ *new_aip;
+ unsigned dst,
+ old_num,
+ new_num;
if (!old_acl || ACL_NUM(old_acl) < 1)
{
@@ -549,9 +549,9 @@ aclremove(Acl * old_acl, AclItem * mod_aip)
int32
aclcontains(Acl * acl, AclItem * aip)
{
- unsigned i,
- num;
- AclItem *aidat;
+ unsigned i,
+ num;
+ AclItem *aidat;
if (!acl || !aip || ((num = ACL_NUM(acl)) < 1))
return (0);
@@ -574,12 +574,12 @@ aclcontains(Acl * acl, AclItem * aip)
* the CALLER is reponsible for free'ing the string returned
*/
-char *
+char *
aclmakepriv(char *old_privlist, char new_priv)
{
- char *priv;
- int i;
- int l;
+ char *priv;
+ int i;
+ int l;
Assert(strlen(old_privlist) < 5);
priv = malloc(5); /* at most "rwaR" */ ;
@@ -628,10 +628,10 @@ aclmakepriv(char *old_privlist, char new_priv)
* the CALLER is responsible for freeing the memory allocated
*/
-char *
+char *
aclmakeuser(char *user_type, char *user)
{
- char *user_list;
+ char *user_list;
user_list = malloc(strlen(user) + 3);
sprintf(user_list, "%s %s", user_type, user);
@@ -652,12 +652,12 @@ aclmakeuser(char *user_type, char *user)
* then calling aclparse;
*/
-ChangeACLStmt *
+ChangeACLStmt *
makeAclStmt(char *privileges, List * rel_list, char *grantee,
char grant_or_revoke)
{
- ChangeACLStmt *n = makeNode(ChangeACLStmt);
- char str[MAX_PARSE_BUFFER];
+ ChangeACLStmt *n = makeNode(ChangeACLStmt);
+ char str[MAX_PARSE_BUFFER];
n->aclitem = (AclItem *) palloc(sizeof(AclItem));
/* the grantee string is "G <group_name>", "U <user_name>", or "ALL" */
diff --git a/src/backend/utils/adt/arrayfuncs.c b/src/backend/utils/adt/arrayfuncs.c
index 073b0a1fd01..15a60311798 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.16 1997/09/07 04:49:55 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.17 1997/09/08 02:30:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -42,15 +42,15 @@
*/
/*-=-=--=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-*/
-static int _ArrayCount(char *str, int dim[], int typdelim);
-static char *
+static int _ArrayCount(char *str, int dim[], int typdelim);
+static char *
_ReadArrayStr(char *arrayStr, int nitems, int ndim, int dim[],
func_ptr inputproc, Oid typelem, char typdelim,
int typlen, bool typbyval, char typalign,
int *nbytes);
#ifdef LOARRAY
-static char *
+static char *
_ReadLOArray(char *str, int *nbytes, int *fd, bool * chunkFlag,
int ndim, int dim[], int baseSize);
@@ -62,26 +62,26 @@ static void
system_cache_lookup(Oid element_type, bool input, int *typlen,
bool * typbyval, char *typdelim, Oid * typelem, Oid * proc,
char *typalign);
-static Datum _ArrayCast(char *value, bool byval, int len);
+static Datum _ArrayCast(char *value, bool byval, int len);
#ifdef LOARRAY
-static char *_AdvanceBy1word(char *str, char **word);
+static char *_AdvanceBy1word(char *str, char **word);
#endif
static void
_ArrayRange(int st[], int endp[], int bsize, char *destPtr,
ArrayType * array, int from);
-static int _ArrayClipCount(int stI[], int endpI[], ArrayType * array);
+static int _ArrayClipCount(int stI[], int endpI[], ArrayType * array);
static void
_LOArrayRange(int st[], int endp[], int bsize, int srcfd,
int destfd, ArrayType * array, int isSrcLO, bool * isNull);
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);
+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 :
@@ -91,31 +91,31 @@ static char *array_seek(char *ptr, int eltsize, int nitems);
* the internal representation of the input array
*--------------------------------------------------------------------
*/
-char *
+char *
array_in(char *string, /* input array in external form */
Oid element_type) /* type OID of an array element */
{
- int typlen;
- bool typbyval,
- done;
- char typdelim;
- Oid typinput;
- Oid typelem;
- char *string_save,
- *p,
- *q,
- *r;
- func_ptr inputproc;
- int i,
- nitems,
- dummy;
- int32 nbytes;
- char *dataPtr;
- ArrayType *retval = NULL;
- int ndim,
- dim[MAXDIM],
- lBound[MAXDIM];
- char typalign;
+ int typlen;
+ bool typbyval,
+ done;
+ char typdelim;
+ Oid typinput;
+ Oid typelem;
+ char *string_save,
+ *p,
+ *q,
+ *r;
+ func_ptr inputproc;
+ int i,
+ nitems,
+ dummy;
+ int32 nbytes;
+ char *dataPtr;
+ ArrayType *retval = NULL;
+ int ndim,
+ dim[MAXDIM],
+ lBound[MAXDIM];
+ char typalign;
system_cache_lookup(element_type, true, &typlen, &typbyval, &typdelim,
&typelem, &typinput, &typalign);
@@ -125,7 +125,7 @@ array_in(char *string, /* input array in external form */
string_save = (char *) palloc(strlen(string) + 3);
strcpy(string_save, string);
- /* --- read array dimensions ---------- */
+ /* --- read array dimensions ---------- */
p = q = string_save;
done = false;
for (ndim = 0; !done;)
@@ -197,7 +197,7 @@ array_in(char *string, /* input array in external form */
nitems = getNitems(ndim, dim);
if (nitems == 0)
{
- char *emptyArray = palloc(sizeof(ArrayType));
+ char *emptyArray = palloc(sizeof(ArrayType));
memset(emptyArray, 0, sizeof(ArrayType));
*(int32 *) emptyArray = sizeof(ArrayType);
@@ -232,9 +232,9 @@ array_in(char *string, /* input array in external form */
else
{
#ifdef LOARRAY
- int dummy,
- bytes;
- bool chunked = false;
+ int dummy,
+ bytes;
+ bool chunked = false;
dataPtr = _ReadLOArray(p, &bytes, &dummy, &chunked, ndim,
dim, typlen);
@@ -264,13 +264,13 @@ array_in(char *string, /* input array in external form */
static int
_ArrayCount(char *str, int dim[], int typdelim)
{
- int nest_level = 0,
- i;
- int ndim = 0,
- temp[MAXDIM];
- bool scanning_string = false;
- bool eoArray = false;
- char *q;
+ int nest_level = 0,
+ i;
+ int ndim = 0,
+ temp[MAXDIM];
+ bool scanning_string = false;
+ bool eoArray = false;
+ char *q;
for (i = 0; i < MAXDIM; ++i)
{
@@ -283,51 +283,55 @@ _ArrayCount(char *str, int dim[], int typdelim)
q = str;
while (eoArray != true)
{
- bool done = false;
+ bool done = false;
while (!done)
{
switch (*q)
{
- case '\\':
- /* skip escaped characters (\ and ") inside strings */
- if (scanning_string && *(q + 1))
- {
- q++;
- }
- break;
- case '\0':
- /* Signal a premature end of the string. DZ - 2-9-1996 */
- elog(WARN, "malformed array constant: %s", str);
- break;
- case '\"':
- scanning_string = !scanning_string;
- break;
- case '{':
- if (!scanning_string)
- {
- temp[nest_level] = 0;
- nest_level++;
- }
- break;
- case '}':
- if (!scanning_string)
- {
+ case '\\':
+ /* skip escaped characters (\ and ") inside strings */
+ if (scanning_string && *(q + 1))
+ {
+ q++;
+ }
+ break;
+ case '\0':
+
+ /*
+ * Signal a premature end of the string. DZ -
+ * 2-9-1996
+ */
+ elog(WARN, "malformed array constant: %s", str);
+ break;
+ case '\"':
+ scanning_string = !scanning_string;
+ break;
+ case '{':
+ if (!scanning_string)
+ {
+ temp[nest_level] = 0;
+ nest_level++;
+ }
+ break;
+ case '}':
+ if (!scanning_string)
+ {
+ if (!ndim)
+ ndim = nest_level;
+ nest_level--;
+ if (nest_level)
+ temp[nest_level - 1]++;
+ if (nest_level == 0)
+ eoArray = done = true;
+ }
+ break;
+ default:
if (!ndim)
ndim = nest_level;
- nest_level--;
- if (nest_level)
- temp[nest_level - 1]++;
- if (nest_level == 0)
- eoArray = done = true;
- }
- break;
- default:
- if (!ndim)
- ndim = nest_level;
- if (*q == typdelim && !scanning_string)
- done = true;
- break;
+ if (*q == typdelim && !scanning_string)
+ done = true;
+ break;
}
if (!done)
q++;
@@ -358,7 +362,7 @@ _ArrayCount(char *str, int dim[], int typdelim)
* nbytes is set to the size of the array in its internal representation.
*---------------------------------------------------------------------------
*/
-static char *
+static char *
_ReadArrayStr(char *arrayStr,
int nitems,
int ndim,
@@ -372,16 +376,16 @@ _ReadArrayStr(char *arrayStr,
char typalign,
int *nbytes)
{
- int i,
- nest_level = 0;
- char *p,
- *q,
- *r,
- **values;
- bool scanning_string = false;
- int indx[MAXDIM],
- prod[MAXDIM];
- bool eoArray = false;
+ int i,
+ nest_level = 0;
+ char *p,
+ *q,
+ *r,
+ **values;
+ bool scanning_string = false;
+ int indx[MAXDIM],
+ prod[MAXDIM];
+ bool eoArray = false;
mda_get_prod(ndim, dim, prod);
for (i = 0; i < ndim; indx[i++] = 0);
@@ -392,64 +396,64 @@ _ReadArrayStr(char *arrayStr,
while (!eoArray)
{
- bool done = false;
- int i = -1;
+ bool done = false;
+ int i = -1;
while (!done)
{
switch (*q)
{
- case '\\':
- /* Crunch the string on top of the backslash. */
- for (r = q; *r != '\0'; r++)
- *r = *(r + 1);
- break;
- case '\"':
- if (!scanning_string)
- {
- while (p != q)
- p++;
- p++; /* get p past first doublequote */
- }
- else
- *q = '\0';
- scanning_string = !scanning_string;
- break;
- case '{':
- if (!scanning_string)
- {
- p++;
- nest_level++;
- if (nest_level > ndim)
- elog(WARN, "array_in: illformed array constant");
- indx[nest_level - 1] = 0;
- indx[ndim - 1] = 0;
- }
- break;
- case '}':
- if (!scanning_string)
- {
- if (i == -1)
- i = tuple2linear(ndim, indx, prod);
- nest_level--;
- if (nest_level == 0)
- eoArray = done = true;
- else
+ case '\\':
+ /* Crunch the string on top of the backslash. */
+ for (r = q; *r != '\0'; r++)
+ *r = *(r + 1);
+ break;
+ case '\"':
+ if (!scanning_string)
{
+ while (p != q)
+ p++;
+ p++; /* get p past first doublequote */
+ }
+ else
*q = '\0';
- indx[nest_level - 1]++;
+ scanning_string = !scanning_string;
+ break;
+ case '{':
+ if (!scanning_string)
+ {
+ p++;
+ nest_level++;
+ if (nest_level > ndim)
+ elog(WARN, "array_in: illformed array constant");
+ indx[nest_level - 1] = 0;
+ indx[ndim - 1] = 0;
}
- }
- break;
- default:
- if (*q == typdelim && !scanning_string)
- {
- if (i == -1)
- i = tuple2linear(ndim, indx, prod);
- done = true;
- indx[ndim - 1]++;
- }
- break;
+ break;
+ case '}':
+ if (!scanning_string)
+ {
+ if (i == -1)
+ i = tuple2linear(ndim, indx, prod);
+ nest_level--;
+ if (nest_level == 0)
+ eoArray = done = true;
+ else
+ {
+ *q = '\0';
+ indx[nest_level - 1]++;
+ }
+ }
+ break;
+ default:
+ if (*q == typdelim && !scanning_string)
+ {
+ if (i == -1)
+ i = tuple2linear(ndim, indx, prod);
+ done = true;
+ indx[ndim - 1]++;
+ }
+ break;
}
if (!done)
q++;
@@ -513,7 +517,7 @@ _ReadArrayStr(char *arrayStr,
*----------------------------------------------------------------------------
*/
#ifdef LOARRAY
-static char *
+static char *
_ReadLOArray(char *str,
int *nbytes,
int *fd,
@@ -522,18 +526,18 @@ _ReadLOArray(char *str,
int dim[],
int baseSize)
{
- char *inputfile,
- *accessfile = NULL,
- *chunkfile = NULL;
- char *retStr,
- *_AdvanceBy1word();
- Oid lobjId;
+ char *inputfile,
+ *accessfile = NULL,
+ *chunkfile = NULL;
+ char *retStr,
+ *_AdvanceBy1word();
+ Oid lobjId;
str = _AdvanceBy1word(str, &inputfile);
while (str != NULL)
{
- char *word;
+ char *word;
str = _AdvanceBy1word(str, &word);
@@ -566,7 +570,7 @@ _ReadLOArray(char *str,
if (accessfile)
{
- FILE *afd;
+ FILE *afd;
if ((afd = AllocateFile(accessfile, "r")) == NULL)
elog(WARN, "unable to open access pattern file");
@@ -588,11 +592,11 @@ _CopyArrayEls(char **values,
char typalign,
bool typbyval)
{
- int i;
+ int i;
for (i = 0; i < nitems; i++)
{
- int inc;
+ int inc;
inc = ArrayCastAndSet(values[i], typbyval, typlen, p);
p += inc;
@@ -608,40 +612,40 @@ _CopyArrayEls(char **values,
* containing the array in its external format.
*-------------------------------------------------------------------------
*/
-char *
+char *
array_out(ArrayType * v, Oid element_type)
{
- int typlen;
- bool typbyval;
- char typdelim;
- Oid typoutput,
- typelem;
- func_ptr outputproc;
- char typalign;
-
- char *p,
- *retval,
- **values,
- delim[2];
- int nitems,
- overall_length,
- i,
- j,
- k,
- indx[MAXDIM];
- bool dummy_bool;
- int dummy_int;
- int ndim,
- *dim;
+ int typlen;
+ bool typbyval;
+ char typdelim;
+ Oid typoutput,
+ typelem;
+ func_ptr outputproc;
+ char typalign;
+
+ char *p,
+ *retval,
+ **values,
+ delim[2];
+ int nitems,
+ overall_length,
+ i,
+ j,
+ k,
+ indx[MAXDIM];
+ bool dummy_bool;
+ int dummy_int;
+ int ndim,
+ *dim;
if (v == (ArrayType *) NULL)
return ((char *) NULL);
if (ARR_IS_LO(v) == true)
{
- char *p,
- *save_p;
- int nbytes;
+ char *p,
+ *save_p;
+ int nbytes;
/* get a wide string to print to */
p = array_dims(v, &dummy_bool);
@@ -666,7 +670,7 @@ array_out(ArrayType * v, Oid element_type)
if (nitems == 0)
{
- char *emptyArray = palloc(3);
+ char *emptyArray = palloc(3);
emptyArray[0] = '{';
emptyArray[1] = '}';
@@ -683,16 +687,16 @@ array_out(ArrayType * v, Oid element_type)
{
switch (typlen)
{
- case 1:
- values[i] = (*outputproc) (*p, typelem);
- break;
- case 2:
- values[i] = (*outputproc) (*(int16 *) p, typelem);
- break;
- case 3:
- case 4:
- values[i] = (*outputproc) (*(int32 *) p, typelem);
- break;
+ case 1:
+ values[i] = (*outputproc) (*p, typelem);
+ break;
+ case 2:
+ values[i] = (*outputproc) (*(int16 *) p, typelem);
+ break;
+ case 3:
+ case 4:
+ values[i] = (*outputproc) (*(int32 *) p, typelem);
+ break;
}
p += typlen;
}
@@ -766,15 +770,15 @@ array_out(ArrayType * v, Oid element_type)
* returns the dimension of the array pointed to by "v"
*----------------------------------------------------------------------------
*/
-char *
+char *
array_dims(ArrayType * v, bool * isNull)
{
- char *p,
- *save_p;
- int nbytes,
- i;
- int *dimv,
- *lb;
+ char *p,
+ *save_p;
+ int nbytes,
+ i;
+ int *dimv,
+ *lb;
if (v == (ArrayType *) NULL)
RETURN_NULL;
@@ -814,14 +818,14 @@ array_ref(ArrayType * array,
int arraylen,
bool * isNull)
{
- int i,
- ndim,
- *dim,
- *lb,
- offset,
- nbytes;
+ int i,
+ ndim,
+ *dim,
+ *lb,
+ offset,
+ nbytes;
struct varlena *v = NULL;
- char *retval = NULL;
+ char *retval = NULL;
if (array == (ArrayType *) NULL)
RETURN_NULL;
@@ -848,8 +852,8 @@ array_ref(ArrayType * array,
if (ARR_IS_LO(array))
{
- char *lo_name;
- int fd = 0;
+ char *lo_name;
+ int fd = 0;
/* We are assuming fixed element lengths here */
offset *= elmlen;
@@ -876,7 +880,7 @@ array_ref(ArrayType * array,
retval = (char *) _ArrayCast((char *) VARDATA(v), reftype, elmlen);
if (reftype == 0)
{ /* not by value */
- char *tempdata = palloc(elmlen);
+ char *tempdata = palloc(elmlen);
memmove(tempdata, retval, elmlen);
retval = tempdata;
@@ -896,9 +900,9 @@ array_ref(ArrayType * array,
}
else
{
- bool done = false;
- char *temp;
- int bytes = nbytes;
+ bool done = false;
+ char *temp;
+ int bytes = nbytes;
temp = ARR_DATA_PTR(array);
i = 0;
@@ -935,14 +939,14 @@ array_clip(ArrayType * array,
int len,
bool * isNull)
{
- int i,
- ndim,
- *dim,
- *lb,
- nbytes;
- ArrayType *newArr;
- int bytes,
- span[MAXDIM];
+ int i,
+ ndim,
+ *dim,
+ *lb,
+ nbytes;
+ ArrayType *newArr;
+ int bytes,
+ span[MAXDIM];
/* timer_start(); */
if (array == (ArrayType *) NULL)
@@ -966,14 +970,14 @@ array_clip(ArrayType * array,
if (ARR_IS_LO(array))
{
#ifdef LOARRAY
- char *lo_name;
+ char *lo_name;
#endif
- char *newname = NULL;
- int fd = 0,
- newfd = 0,
- isDestLO = true,
- rsize;
+ char *newname = NULL;
+ int fd = 0,
+ newfd = 0,
+ isDestLO = true,
+ rsize;
if (len < 0)
elog(WARN, "array_clip: array of variable length objects not supported");
@@ -994,7 +998,7 @@ array_clip(ArrayType * array,
rsize = compute_size(lowerIndx, upperIndx, n, len);
if (rsize < MAX_BUFF_SIZE)
{
- char *buff;
+ char *buff;
rsize += 4;
buff = palloc(rsize);
@@ -1068,7 +1072,7 @@ array_clip(ArrayType * array,
* returns a pointer to the modified array.
*-----------------------------------------------------------------------------
*/
-char *
+char *
array_set(ArrayType * array,
int n,
int indx[],
@@ -1078,12 +1082,12 @@ array_set(ArrayType * array,
int arraylen,
bool * isNull)
{
- int ndim,
- *dim,
- *lb,
- offset,
- nbytes;
- char *pos;
+ int ndim,
+ *dim,
+ *lb,
+ offset,
+ nbytes;
+ char *pos;
if (array == (ArrayType *) NULL)
RETURN_NULL;
@@ -1113,13 +1117,13 @@ array_set(ArrayType * array,
if (ARR_IS_LO(array))
{
- int fd = 0;
+ int fd = 0;
struct varlena *v;
/* We are assuming fixed element lengths here */
offset *= elmlen;
#ifdef LOARRAY
- char *lo_name;
+ char *lo_name;
lo_name = ARR_DATA_PTR(array);
if ((fd = LOopen(lo_name, ARR_IS_INV(array) ? INV_WRITE : O_WRONLY)) < 0)
@@ -1151,15 +1155,15 @@ array_set(ArrayType * array,
}
else
{
- ArrayType *newarray;
- char *elt_ptr;
- int oldsize,
- newsize,
- oldlen,
- newlen,
- lth0,
- lth1,
- lth2;
+ ArrayType *newarray;
+ char *elt_ptr;
+ int oldsize,
+ newsize,
+ oldlen,
+ newlen,
+ lth0,
+ lth1,
+ lth2;
elt_ptr = array_seek(ARR_DATA_PTR(array), -1, offset);
oldlen = INTALIGN(*(int32 *) elt_ptr);
@@ -1203,7 +1207,7 @@ array_set(ArrayType * array,
* returns a pointer to the modified array.
*----------------------------------------------------------------------------
*/
-char *
+char *
array_assgn(ArrayType * array,
int n,
int upperIndx[],
@@ -1213,10 +1217,10 @@ array_assgn(ArrayType * array,
int len,
bool * isNull)
{
- int i,
- ndim,
- *dim,
- *lb;
+ int i,
+ ndim,
+ *dim,
+ *lb;
if (array == (ArrayType *) NULL)
RETURN_NULL;
@@ -1239,11 +1243,11 @@ array_assgn(ArrayType * array,
if (ARR_IS_LO(array))
{
- int fd = 0,
- newfd = 0;
+ int fd = 0,
+ newfd = 0;
#ifdef LOARRAY
- char *lo_name;
+ char *lo_name;
lo_name = (char *) ARR_DATA_PTR(array);
if ((fd = LOopen(lo_name, ARR_IS_INV(array) ? INV_WRITE : O_WRONLY)) < 0)
@@ -1303,8 +1307,8 @@ system_cache_lookup(Oid element_type,
Oid * proc,
char *typalign)
{
- HeapTuple typeTuple;
- TypeTupleForm typeStruct;
+ HeapTuple typeTuple;
+ TypeTupleForm typeStruct;
typeTuple = SearchSysCacheTuple(TYPOID, ObjectIdGetDatum(element_type),
0, 0, 0);
@@ -1331,23 +1335,23 @@ system_cache_lookup(Oid element_type,
}
}
-static Datum
+static Datum
_ArrayCast(char *value, bool byval, int len)
{
if (byval)
{
switch (len)
{
- case 1:
- return ((Datum) * value);
- case 2:
- return ((Datum) * (int16 *) value);
- case 3:
- case 4:
- return ((Datum) * (int32 *) value);
- default:
- elog(WARN, "array_ref: byval and elt len > 4!");
- break;
+ case 1:
+ return ((Datum) * value);
+ case 2:
+ return ((Datum) * (int16 *) value);
+ case 3:
+ case 4:
+ return ((Datum) * (int32 *) value);
+ default:
+ elog(WARN, "array_ref: byval and elt len > 4!");
+ break;
}
}
else
@@ -1364,7 +1368,7 @@ ArrayCastAndSet(char *src,
int typlen,
char *dest)
{
- int inc;
+ int inc;
if (typlen > 0)
{
@@ -1372,15 +1376,15 @@ ArrayCastAndSet(char *src,
{
switch (typlen)
{
- case 1:
- *dest = DatumGetChar(src);
- break;
- case 2:
- *(int16 *) dest = DatumGetInt16(src);
- break;
- case 4:
- *(int32 *) dest = (int32) src;
- break;
+ case 1:
+ *dest = DatumGetChar(src);
+ break;
+ case 2:
+ *(int16 *) dest = DatumGetInt16(src);
+ break;
+ case 4:
+ *(int32 *) dest = (int32) src;
+ break;
}
}
else
@@ -1398,11 +1402,11 @@ ArrayCastAndSet(char *src,
}
#ifdef LOARRAY
-static char *
+static char *
_AdvanceBy1word(char *str, char **word)
{
- char *retstr,
- *space;
+ char *retstr,
+ *space;
*word = NULL;
if (str == NULL)
@@ -1425,7 +1429,7 @@ _AdvanceBy1word(char *str, char **word)
static int
SanityCheckInput(int ndim, int n, int dim[], int lb[], int indx[])
{
- int i;
+ int i;
/* Do Sanity check on input */
if (n != ndim)
@@ -1444,18 +1448,18 @@ _ArrayRange(int st[],
ArrayType * array,
int from)
{
- int n,
- *dim,
- *lb,
- st_pos,
- prod[MAXDIM];
- int span[MAXDIM],
- dist[MAXDIM],
- indx[MAXDIM];
- int i,
- j,
- inc;
- char *srcPtr;
+ int n,
+ *dim,
+ *lb,
+ st_pos,
+ prod[MAXDIM];
+ int span[MAXDIM],
+ dist[MAXDIM],
+ indx[MAXDIM];
+ int i,
+ j,
+ inc;
+ char *srcPtr;
n = ARR_NDIM(array);
dim = ARR_DIMS(array);
@@ -1485,21 +1489,21 @@ _ArrayRange(int st[],
static int
_ArrayClipCount(int stI[], int endpI[], ArrayType * array)
{
- int n,
- *dim,
- *lb,
- st_pos,
- prod[MAXDIM];
- int span[MAXDIM],
- dist[MAXDIM],
- indx[MAXDIM];
- int i,
- j,
- inc,
- st[MAXDIM],
- endp[MAXDIM];
- int count = 0;
- char *ptr;
+ int n,
+ *dim,
+ *lb,
+ st_pos,
+ prod[MAXDIM];
+ int span[MAXDIM],
+ dist[MAXDIM],
+ indx[MAXDIM];
+ int i,
+ j,
+ inc,
+ st[MAXDIM],
+ endp[MAXDIM];
+ int count = 0;
+ char *ptr;
n = ARR_NDIM(array);
dim = ARR_DIMS(array);
@@ -1523,10 +1527,10 @@ _ArrayClipCount(int stI[], int endpI[], ArrayType * array)
return count;
}
-static char *
+static char *
array_seek(char *ptr, int eltsize, int nitems)
{
- int i;
+ int i;
if (eltsize > 0)
return (ptr + eltsize * nitems);
@@ -1538,9 +1542,9 @@ array_seek(char *ptr, int eltsize, int nitems)
static int
array_read(char *destptr, int eltsize, int nitems, char *srcptr)
{
- int i,
- inc,
- tmp;
+ int i,
+ inc,
+ tmp;
if (eltsize > 0)
{
@@ -1568,19 +1572,19 @@ _LOArrayRange(int st[],
int isSrcLO,
bool * isNull)
{
- int n,
- *dim,
- st_pos,
- prod[MAXDIM];
- int span[MAXDIM],
- dist[MAXDIM],
- indx[MAXDIM];
- int i,
- j,
- inc,
- tmp,
- *lb,
- offset;
+ int n,
+ *dim,
+ st_pos,
+ prod[MAXDIM];
+ int span[MAXDIM],
+ dist[MAXDIM],
+ indx[MAXDIM];
+ int i,
+ j,
+ inc,
+ tmp,
+ *lb,
+ offset;
n = ARR_NDIM(array);
dim = ARR_DIMS(array);
@@ -1622,19 +1626,19 @@ _ReadArray(int st[],
int isDestLO,
bool * isNull)
{
- int n,
- *dim,
- st_pos,
- prod[MAXDIM];
- int span[MAXDIM],
- dist[MAXDIM],
- indx[MAXDIM];
- int i,
- j,
- inc,
- tmp,
- *lb,
- offset;
+ int n,
+ *dim,
+ st_pos,
+ prod[MAXDIM];
+ int span[MAXDIM],
+ dist[MAXDIM],
+ indx[MAXDIM];
+ int i,
+ j,
+ inc,
+ tmp,
+ *lb,
+ offset;
n = ARR_NDIM(array);
dim = ARR_DIMS(array);
@@ -1677,9 +1681,9 @@ _LOtransfer(char **destfd,
#define MAX_READ (512 * 1024)
#define min(a, b) (a < b ? a : b)
struct varlena *v = NULL;
- int tmp,
- inc,
- resid;
+ int tmp,
+ inc,
+ resid;
inc = nitems * size;
if (isSrcLO && isDestLO && inc > 0)
@@ -1719,11 +1723,11 @@ _LOtransfer(char **destfd,
#undef MAX_READ
}
-char *
+char *
_array_newLO(int *fd, int flag)
{
- char *p;
- char saveName[NAME_LEN];
+ char *p;
+ char saveName[NAME_LEN];
p = (char *) palloc(NAME_LEN);
sprintf(p, "/Arry.%d", newoid());
diff --git a/src/backend/utils/adt/arrayutils.c b/src/backend/utils/adt/arrayutils.c
index 09a58d46e2c..898a6049629 100644
--- a/src/backend/utils/adt/arrayutils.c
+++ b/src/backend/utils/adt/arrayutils.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayutils.c,v 1.4 1997/09/07 04:49:57 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayutils.c,v 1.5 1997/09/08 02:30:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -21,9 +21,9 @@
int
GetOffset(int n, int dim[], int lb[], int indx[])
{
- int i,
- scale,
- offset;
+ int i,
+ scale,
+ offset;
for (i = n - 1, scale = 1, offset = 0; i >= 0; scale *= dim[i--])
offset += (indx[i] - lb[i]) * scale;
@@ -33,8 +33,8 @@ GetOffset(int n, int dim[], int lb[], int indx[])
int
getNitems(int n, int a[])
{
- int i,
- ret;
+ int i,
+ ret;
for (i = 0, ret = 1; i < n; ret *= a[i++]);
if (n == 0)
@@ -45,8 +45,8 @@ getNitems(int n, int a[])
int
compute_size(int st[], int endp[], int n, int base)
{
- int i,
- ret;
+ int i,
+ ret;
for (i = 0, ret = base; i < n; i++)
ret *= (endp[i] - st[i] + 1);
@@ -56,8 +56,8 @@ compute_size(int st[], int endp[], int n, int base)
void
mda_get_offset_values(int n, int dist[], int PC[], int span[])
{
- int i,
- j;
+ int i,
+ j;
for (j = n - 2, dist[n - 1] = 0; j >= 0; j--)
for (i = j + 1, dist[j] = PC[j] - 1; i < n;
@@ -67,7 +67,7 @@ mda_get_offset_values(int n, int dist[], int PC[], int span[])
void
mda_get_range(int n, int span[], int st[], int endp[])
{
- int i;
+ int i;
for (i = 0; i < n; i++)
span[i] = endp[i] - st[i] + 1;
@@ -76,7 +76,7 @@ mda_get_range(int n, int span[], int st[], int endp[])
void
mda_get_prod(int n, int range[], int P[])
{
- int i;
+ int i;
for (i = n - 2, P[n - 1] = 1; i >= 0; i--)
P[i] = P[i + 1] * range[i + 1];
@@ -85,8 +85,8 @@ mda_get_prod(int n, int range[], int P[])
int
tuple2linear(int n, int tup[], int scale[])
{
- int i,
- lin;
+ int i,
+ lin;
for (i = lin = 0; i < n; i++)
lin += tup[i] * scale[i];
@@ -96,7 +96,7 @@ tuple2linear(int n, int tup[], int scale[])
void
array2chunk_coord(int n, int C[], int a_coord[], int c_coord[])
{
- int i;
+ int i;
for (i = 0; i < n; i++)
c_coord[i] = a_coord[i] / C[i];
@@ -112,7 +112,7 @@ array2chunk_coord(int n, int C[], int a_coord[], int c_coord[])
int
next_tuple(int n, int curr[], int span[])
{
- int i;
+ int i;
if (!n)
return (-1);
diff --git a/src/backend/utils/adt/bool.c b/src/backend/utils/adt/bool.c
index d02661efa67..82760cc8d74 100644
--- a/src/backend/utils/adt/bool.c
+++ b/src/backend/utils/adt/bool.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/bool.c,v 1.5 1997/09/07 04:49:58 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/bool.c,v 1.6 1997/09/08 02:30:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -35,10 +35,10 @@ boolin(char *b)
/*
* boolout - converts 1 or 0 to "t" or "f"
*/
-char *
+char *
boolout(long b)
{
- char *result = (char *) palloc(2);
+ char *result = (char *) palloc(2);
*result = (b) ? 't' : 'f';
result[1] = '\0';
diff --git a/src/backend/utils/adt/cash.c b/src/backend/utils/adt/cash.c
index 763ac5856ce..a219ea3b832 100644
--- a/src/backend/utils/adt/cash.c
+++ b/src/backend/utils/adt/cash.c
@@ -9,7 +9,7 @@
* workings can be found in the book "Software Solutions in C" by
* Dale Schumacher, Academic Press, ISBN: 0-12-632360-7.
*
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/cash.c,v 1.10 1997/09/07 04:49:59 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/cash.c,v 1.11 1997/09/08 02:30:27 momjian Exp $
*/
#include <stdio.h>
@@ -47,22 +47,22 @@ static struct lconv *lconv = NULL;
* monetary values returned by localeconv() can be multiple
* bytes/characters. This code assumes one byte only. - tgl 97/04/14
*/
-Cash *
+Cash *
cash_in(const char *str)
{
- Cash *result;
-
- Cash value = 0;
- Cash dec = 0;
- Cash sgn = 1;
- int seen_dot = 0;
- const char *s = str;
- int fpoint;
- char dsymbol,
- ssymbol,
- psymbol,
- nsymbol,
- csymbol;
+ Cash *result;
+
+ Cash value = 0;
+ Cash dec = 0;
+ Cash sgn = 1;
+ int seen_dot = 0;
+ const char *s = str;
+ int fpoint;
+ char dsymbol,
+ ssymbol,
+ psymbol,
+ nsymbol,
+ csymbol;
#ifdef USE_LOCALE
if (lconv == NULL)
@@ -164,22 +164,22 @@ cash_in(const char *str)
* XXX HACK This code appears to assume US conventions for
* positive-valued amounts. - tgl 97/04/14
*/
-const char *
+const char *
cash_out(Cash * value)
{
- char *result;
- char buf[CASH_BUFSZ];
- int minus = 0;
- int count = LAST_DIGIT;
- int point_pos;
- int comma_position = 0;
- char mon_group,
- comma,
- points;
- char csymbol,
- dsymbol,
- *nsymbol;
- char convention;
+ char *result;
+ char buf[CASH_BUFSZ];
+ int minus = 0;
+ int count = LAST_DIGIT;
+ int point_pos;
+ int comma_position = 0;
+ char mon_group,
+ comma,
+ points;
+ char csymbol,
+ dsymbol,
+ *nsymbol;
+ char convention;
#ifdef USE_LOCALE
if (lconv == NULL)
@@ -328,10 +328,10 @@ cash_ge(Cash * c1, Cash * c2)
/* cash_pl()
* Add two cash values.
*/
-Cash *
+Cash *
cash_pl(Cash * c1, Cash * c2)
{
- Cash *result;
+ Cash *result;
if (!PointerIsValid(c1) || !PointerIsValid(c2))
return (NULL);
@@ -348,10 +348,10 @@ cash_pl(Cash * c1, Cash * c2)
/* cash_mi()
* Subtract two cash values.
*/
-Cash *
+Cash *
cash_mi(Cash * c1, Cash * c2)
{
- Cash *result;
+ Cash *result;
if (!PointerIsValid(c1) || !PointerIsValid(c2))
return (NULL);
@@ -368,10 +368,10 @@ cash_mi(Cash * c1, Cash * c2)
/* cash_mul()
* Multiply cash by floating point number.
*/
-Cash *
+Cash *
cash_mul(Cash * c, float8 * f)
{
- Cash *result;
+ Cash *result;
if (!PointerIsValid(f) || !PointerIsValid(c))
return (NULL);
@@ -391,10 +391,10 @@ cash_mul(Cash * c, float8 * f)
* XXX Don't know if rounding or truncating is correct behavior.
* Round for now. - tgl 97/04/15
*/
-Cash *
+Cash *
cash_div(Cash * c, float8 * f)
{
- Cash *result;
+ Cash *result;
if (!PointerIsValid(f) || !PointerIsValid(c))
return (NULL);
@@ -414,10 +414,10 @@ cash_div(Cash * c, float8 * f)
/* cashlarger()
* Return larger of two cash values.
*/
-Cash *
+Cash *
cashlarger(Cash * c1, Cash * c2)
{
- Cash *result;
+ Cash *result;
if (!PointerIsValid(c1) || !PointerIsValid(c2))
return (NULL);
@@ -434,10 +434,10 @@ cashlarger(Cash * c1, Cash * c2)
/* cashsmaller()
* Return smaller of two cash values.
*/
-Cash *
+Cash *
cashsmaller(Cash * c1, Cash * c2)
{
- Cash *result;
+ Cash *result;
if (!PointerIsValid(c1) || !PointerIsValid(c2))
return (NULL);
@@ -455,15 +455,15 @@ cashsmaller(Cash * c1, Cash * c2)
* This converts a int4 as well but to a representation using words
* Obviously way North American centric - sorry
*/
-const char *
+const char *
cash_words_out(Cash * value)
{
- static char buf[128];
- char *p = buf;
- Cash m0;
- Cash m1;
- Cash m2;
- Cash m3;
+ static char buf[128];
+ char *p = buf;
+ Cash m0;
+ Cash m1;
+ Cash m2;
+ Cash m3;
/* work with positive numbers */
if (*value < 0)
@@ -515,15 +515,15 @@ cash_words_out(Cash * value)
static const char *
num_word(Cash value)
{
- static char buf[128];
+ static char buf[128];
static const char *small[] = {
"zero", "one", "two", "three", "four", "five", "six", "seven",
"eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen",
"fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty",
"thirty", "fourty", "fifty", "sixty", "seventy", "eighty", "ninety"
};
- const char **big = small + 18;
- int tu = value % 100;
+ const char **big = small + 18;
+ int tu = value % 100;
/* deal with the simple cases first */
if (value <= 20)
diff --git a/src/backend/utils/adt/char.c b/src/backend/utils/adt/char.c
index 24e30054b6b..db5a6827a90 100644
--- a/src/backend/utils/adt/char.c
+++ b/src/backend/utils/adt/char.c
@@ -12,7 +12,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/char.c,v 1.8 1997/09/07 04:50:02 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/char.c,v 1.9 1997/09/08 02:30:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -40,10 +40,10 @@ charin(char *ch)
/*
* charout - converts 'x' to "x"
*/
-char *
+char *
charout(int32 ch)
{
- char *result = (char *) palloc(2);
+ char *result = (char *) palloc(2);
result[0] = (char) ch;
result[1] = '\0';
@@ -59,7 +59,7 @@ charout(int32 ch)
int32
cidin(char *s)
{
- CommandId c;
+ CommandId c;
if (s == NULL)
c = 0;
@@ -75,11 +75,11 @@ cidin(char *s)
* NOTE: we must no use 'charout' because cid might be a non
* printable character...
*/
-char *
+char *
cidout(int32 c)
{
- char *result;
- CommandId c2;
+ char *result;
+ CommandId c2;
/*
* cid is a number between 0 .. 2^16-1, therefore we need at most 6
@@ -98,10 +98,10 @@ cidout(int32 c)
* Note:
* Currently if strlen(s) < 14, the extra chars are nulls
*/
-char *
+char *
char16in(char *s)
{
- char *result;
+ char *result;
if (s == NULL)
return (NULL);
@@ -113,10 +113,10 @@ char16in(char *s)
/*
* char16out - converts internal reprsentation to "..."
*/
-char *
+char *
char16out(char *s)
{
- char *result = (char *) palloc(17);
+ char *result = (char *) palloc(17);
if (s == NULL)
{
@@ -133,48 +133,59 @@ char16out(char *s)
* PUBLIC ROUTINES *
*****************************************************************************/
-bool chareq(int8 arg1, int8 arg2)
+bool
+chareq(int8 arg1, int8 arg2)
{
return (arg1 == arg2);
}
-bool charne(int8 arg1, int8 arg2)
+bool
+charne(int8 arg1, int8 arg2)
{
return (arg1 != arg2);
}
-bool charlt(int8 arg1, int8 arg2)
+bool
+charlt(int8 arg1, int8 arg2)
{
return ((uint8) arg1 < (uint8) arg2);
}
-bool charle(int8 arg1, int8 arg2)
+bool
+charle(int8 arg1, int8 arg2)
{
return ((uint8) arg1 <= (uint8) arg2);
}
-bool chargt(int8 arg1, int8 arg2)
+bool
+chargt(int8 arg1, int8 arg2)
{
return ((uint8) arg1 > (uint8) arg2);
}
-bool charge(int8 arg1, int8 arg2)
+bool
+charge(int8 arg1, int8 arg2)
{
return ((uint8) arg1 >= (uint8) arg2);
}
-int8 charpl(int8 arg1, int8 arg2)
+int8
+charpl(int8 arg1, int8 arg2)
{
return (arg1 + arg2);
}
-int8 charmi(int8 arg1, int8 arg2)
+int8
+charmi(int8 arg1, int8 arg2)
{
return (arg1 - arg2);
}
-int8 charmul(int8 arg1, int8 arg2)
+int8
+charmul(int8 arg1, int8 arg2)
{
return (arg1 * arg2);
}
-int8 chardiv(int8 arg1, int8 arg2)
+int8
+chardiv(int8 arg1, int8 arg2)
{
return (arg1 / arg2);
}
-bool cideq(int8 arg1, int8 arg2)
+bool
+cideq(int8 arg1, int8 arg2)
{
return (arg1 == arg2);
}
@@ -248,7 +259,7 @@ char16ge(char *arg1, char *arg2)
uint16
char2in(char *s)
{
- uint16 res;
+ uint16 res;
if (s == NULL)
return (0);
@@ -257,10 +268,10 @@ char2in(char *s)
return (res);
}
-char *
+char *
char2out(uint16 s)
{
- char *result = (char *) palloc(3);
+ char *result = (char *) palloc(3);
strNcpy(result, (char *) &s, 2);
@@ -313,7 +324,7 @@ char2cmp(uint16 a, uint16 b)
uint32
char4in(char *s)
{
- uint32 res;
+ uint32 res;
if (s == NULL)
return (0);
@@ -323,11 +334,11 @@ char4in(char *s)
return (res);
}
-char *
+char *
char4out(s)
-uint32 s;
+uint32 s;
{
- char *result = (char *) palloc(5);
+ char *result = (char *) palloc(5);
strNcpy(result, (char *) &s, 4);
@@ -377,10 +388,10 @@ char4cmp(uint32 a, uint32 b)
}
/* ============================== char8 ============================== */
-char *
+char *
char8in(char *s)
{
- char *result;
+ char *result;
if (s == NULL)
return ((char *) NULL);
@@ -390,10 +401,10 @@ char8in(char *s)
return (result);
}
-char *
+char *
char8out(char *s)
{
- char *result = (char *) palloc(9);
+ char *result = (char *) palloc(9);
if (s == NULL)
{
diff --git a/src/backend/utils/adt/chunk.c b/src/backend/utils/adt/chunk.c
index fcfc8cdaeb5..021b7268676 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.7 1997/09/07 04:50:04 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/chunk.c,v 1.8 1997/09/08 02:30:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -48,8 +48,8 @@ static CHUNK_INFO cInfo;
static int
_FindBestChunk(int size, int dmax[], int dbest[], int dim,
int A[MAXPAT][MAXDIM + 1], int N);
-static int get_next(int d[], int k, int C, int dmax[]);
-static void initialize_info(CHUNK_INFO * A, int ndim, int dim[], int chunk[]);
+static int get_next(int d[], int k, int C, int dmax[]);
+static void initialize_info(CHUNK_INFO * A, int ndim, int dim[], int chunk[]);
#ifdef LOARRAY
static void
@@ -58,8 +58,8 @@ _ConvertToChunkFile(int n, int baseSize, int dim[], int C[],
static void
read_chunk(int chunk_no[], int C[], char a_chunk[], int srcfd,
int n, int baseSize, int PX[], int dist[]);
-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);
+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
@@ -75,7 +75,7 @@ GetChunkSize(FILE * fd, int ndim, int dim[MAXDIM], int baseSize,
* information about the chunked file
*-----------------------------------------------------------------------
*/
-char *
+char *
_ChunkArray(int fd,
FILE * afd,
int ndim,
@@ -85,12 +85,12 @@ _ChunkArray(int fd,
char *chunkfile)
{
#ifdef LOARRAY
- int cfd = 0;
+ int cfd = 0;
#endif
- int chunk[MAXDIM],
- csize;
- bool reorgFlag;
+ int chunk[MAXDIM],
+ csize;
+ bool reorgFlag;
if (chunkfile == NULL)
reorgFlag = true;
@@ -136,12 +136,12 @@ GetChunkSize(FILE * fd,
int baseSize,
int d[MAXDIM])
{
- int N,
- i,
- j,
- csize;
- int A[MAXPAT][MAXDIM + 1],
- dmax[MAXDIM];
+ int N,
+ i,
+ j,
+ csize;
+ int A[MAXPAT][MAXDIM + 1],
+ dmax[MAXDIM];
/*
* ----------- read input ------------
@@ -183,9 +183,9 @@ _FindBestChunk(int size,
int A[MAXPAT][MAXDIM + 1],
int N)
{
- int d[MAXDIM];
- int tc,
- mintc = INFTY;
+ int d[MAXDIM];
+ int tc,
+ mintc = INFTY;
d[0] = 0;
mintc = INFTY;
@@ -196,9 +196,9 @@ _FindBestChunk(int size,
* compute the number of page fetches for a given chunk size (d[])
* and access pattern (A[][])
*/
- register int i,
- j,
- nc;
+ register int i,
+ j,
+ nc;
for (i = 0, tc = 0; i < N; i++)
{
@@ -229,9 +229,9 @@ _FindBestChunk(int size,
static int
get_next(int d[], int k, int C, int dmax[])
{
- register int i,
- j,
- temp;
+ register int i,
+ j,
+ temp;
if (!d[0])
{
@@ -271,15 +271,14 @@ get_next(int d[], int k, int C, int dmax[])
}
#ifdef LOARRAY
-static char a_chunk[BLCKSZ + 4]; /* 4 since a_chunk is in varlena
- * format */
+static char a_chunk[BLCKSZ + 4];/* 4 since a_chunk is in varlena format */
#endif
static void
initialize_info(CHUNK_INFO * A, int ndim, int dim[], int chunk[])
{
- int i;
+ int i;
for (i = 0; i < ndim; i++)
A->C[i] = chunk[i];
@@ -305,13 +304,13 @@ _ConvertToChunkFile(int n,
int srcfd,
int destfd)
{
- int max_chunks[MAXDIM],
- chunk_no[MAXDIM];
- int PX[MAXDIM],
- dist[MAXDIM];
- int csize = 1,
- i,
- temp;
+ int max_chunks[MAXDIM],
+ chunk_no[MAXDIM];
+ int PX[MAXDIM],
+ dist[MAXDIM];
+ int csize = 1,
+ i,
+ temp;
for (i = 0; i < n; chunk_no[i++] = 0)
{
@@ -349,14 +348,14 @@ read_chunk(int chunk_no[],
int PX[],
int dist[])
{
- int i,
- j,
- cp,
- unit_transfer;
- int start_pos,
- pos[MAXDIM];
- int indx[MAXDIM];
- int fpOff;
+ int i,
+ j,
+ cp,
+ unit_transfer;
+ int start_pos,
+ pos[MAXDIM];
+ int indx[MAXDIM];
+ int fpOff;
for (i = start_pos = 0; i < n; i++)
{
@@ -392,7 +391,7 @@ read_chunk(int chunk_no[],
static int
write_chunk(struct varlena * a_chunk, int ofile)
{
- int got_n = 0;
+ int got_n = 0;
#ifdef LOARRAY
got_n = LOwrite(ofile, a_chunk);
@@ -444,41 +443,41 @@ _ReadChunkArray(int st[],
int isDestLO,
bool * isNull)
{
- int i,
- j,
- jj;
- int n,
- temp,
- words_read;
- int chunk_span[MAXDIM],
- chunk_off[MAXDIM];
- int chunk_st[MAXDIM],
- chunk_end[MAXDIM];
- int block_seek;
-
- int bptr,
- *C,
- csize,
- *dim,
- *lb;
- int range_st[MAXDIM],
- range_end[MAXDIM],
- range[MAXDIM],
- array_span[MAXDIM];
- int PA[MAXDIM],
- PCHUNK[MAXDIM],
- PC[MAXDIM];
- int to_read;
- int cdist[MAXDIM],
- adist[MAXDIM];
- int dist[MAXDIM],
- temp_seek;
-
- int srcOff; /* Needed since LO don't understand
+ int i,
+ j,
+ jj;
+ int n,
+ temp,
+ words_read;
+ int chunk_span[MAXDIM],
+ chunk_off[MAXDIM];
+ int chunk_st[MAXDIM],
+ chunk_end[MAXDIM];
+ int block_seek;
+
+ int bptr,
+ *C,
+ csize,
+ *dim,
+ *lb;
+ int range_st[MAXDIM],
+ range_end[MAXDIM],
+ range[MAXDIM],
+ array_span[MAXDIM];
+ int PA[MAXDIM],
+ PCHUNK[MAXDIM],
+ PC[MAXDIM];
+ int to_read;
+ int cdist[MAXDIM],
+ adist[MAXDIM];
+ int dist[MAXDIM],
+ temp_seek;
+
+ int srcOff; /* Needed since LO don't understand
* SEEK_CUR */
- char *baseDestFp = (char *) destfp;
+ char *baseDestFp = (char *) destfp;
- CHUNK_INFO *A = (CHUNK_INFO *) ARR_DATA_PTR(array);
+ CHUNK_INFO *A = (CHUNK_INFO *) ARR_DATA_PTR(array);
n = ARR_NDIM(array);
dim = ARR_DIMS(array);
@@ -584,7 +583,7 @@ _ReadChunkArray(int st[],
* compute next tuple in range[]
*/
{
- int x;
+ int x;
if (!(i + 1))
j = -1;
@@ -641,21 +640,21 @@ _ReadChunkArray1El(int st[],
ArrayType * array,
bool * isNull)
{
- int i,
- j,
- n,
- temp,
- srcOff;
- int chunk_st[MAXDIM];
-
- int *C,
- csize,
- *dim,
- *lb;
- int PCHUNK[MAXDIM],
- PC[MAXDIM];
-
- CHUNK_INFO *A = (CHUNK_INFO *) ARR_DATA_PTR(array);
+ int i,
+ j,
+ n,
+ temp,
+ srcOff;
+ int chunk_st[MAXDIM];
+
+ int *C,
+ csize,
+ *dim,
+ *lb;
+ int PCHUNK[MAXDIM],
+ PC[MAXDIM];
+
+ CHUNK_INFO *A = (CHUNK_INFO *) ARR_DATA_PTR(array);
n = ARR_NDIM(array);
lb = ARR_LBOUND(array);
diff --git a/src/backend/utils/adt/date.c b/src/backend/utils/adt/date.c
index 40369f9a84e..5a88e2bf324 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.15 1997/09/07 04:50:06 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.16 1997/09/08 02:30:32 momjian Exp $
*
* NOTES
* This code is actually (almost) unused.
@@ -74,7 +74,7 @@
#define ABSTIMEMAX(t1, t2) abstimelt((t1),(t2)) ? (t2) : (t1)
#if FALSE
-static char *unit_tab[] = {
+static char *unit_tab[] = {
"second", "seconds", "minute", "minutes",
"hour", "hours", "day", "days", "week", "weeks",
"month", "months", "year", "years"};
@@ -83,7 +83,7 @@ static char *unit_tab[] = {
#define NUNITS 14 /* number of different units */
/* table of seconds per unit (month = 30 days, year = 365 days) */
-static int sec_tab[] = {
+static int sec_tab[] = {
1, 1, 60, 60,
3600, 3600, 86400, 86400, 604800, 604800,
2592000, 2592000, 31536000, 31536000};
@@ -94,11 +94,11 @@ static int sec_tab[] = {
* Function prototypes -- internal to this file only
*/
-static 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);
-static int correct_dir(char direction[], int *signptr);
+static int correct_unit(char unit[], int *unptr);
+static int correct_dir(char direction[], int *signptr);
#endif
@@ -117,16 +117,16 @@ istinterval(char *i_string,
RelativeTime
reltimein(char *str)
{
- RelativeTime result;
+ RelativeTime result;
- struct tm tt,
- *tm = &tt;
- double fsec;
- int dtype;
- char *field[MAXDATEFIELDS];
- int nf,
- ftype[MAXDATEFIELDS];
- char lowstr[MAXDATELEN + 1];
+ struct tm tt,
+ *tm = &tt;
+ double fsec;
+ int dtype;
+ char *field[MAXDATEFIELDS];
+ int nf,
+ ftype[MAXDATEFIELDS];
+ char lowstr[MAXDATELEN + 1];
if (!PointerIsValid(str))
elog(WARN, "Bad (null) date external representation", NULL);
@@ -144,13 +144,13 @@ reltimein(char *str)
switch (dtype)
{
- case DTK_DELTA:
- result = ((((tm->tm_hour * 60) + tm->tm_min) * 60) + tm->tm_sec);
- result += (((tm->tm_year * 365) + (tm->tm_mon * 30) + tm->tm_mday) * (24 * 60 * 60));
- return (result);
+ case DTK_DELTA:
+ result = ((((tm->tm_hour * 60) + tm->tm_min) * 60) + tm->tm_sec);
+ result += (((tm->tm_year * 365) + (tm->tm_mon * 30) + tm->tm_mday) * (24 * 60 * 60));
+ return (result);
- default:
- return (INVALID_RELTIME);
+ default:
+ return (INVALID_RELTIME);
}
elog(WARN, "Bad reltime (internal coding error) '%s'", str);
@@ -161,13 +161,13 @@ reltimein(char *str)
/*
* reltimeout - converts the internal format to a reltime string
*/
-char *
+char *
reltimeout(int32 time)
{
- char *result;
- struct tm tt,
- *tm = &tt;
- char buf[MAXDATELEN + 1];
+ char *result;
+ struct tm tt,
+ *tm = &tt;
+ char buf[MAXDATELEN + 1];
if (time == INVALID_RELTIME)
{
@@ -204,10 +204,10 @@ reltime2tm(int32 time, struct tm * tm)
} /* reltime2tm() */
#if FALSE
-char *timestring;
-long quantity;
-register int i;
-int unitnr;
+char *timestring;
+long quantity;
+register int i;
+int unitnr;
timestring = (char *) palloc(Max(strlen(INVALID_RELTIME_STR),
UNITMAXLEN) + 1);
@@ -245,12 +245,12 @@ return (timestring);
TimeInterval
tintervalin(char *intervalstr)
{
- int error;
- AbsoluteTime i_start,
- i_end,
- t1,
- t2;
- TimeInterval interval;
+ int error;
+ AbsoluteTime i_start,
+ i_end,
+ t1,
+ t2;
+ TimeInterval interval;
interval = (TimeInterval) palloc(sizeof(TimeIntervalData));
error = istinterval(intervalstr, &t1, &t2);
@@ -274,11 +274,11 @@ tintervalin(char *intervalstr)
* tintervalout - converts an internal interval format to a string
*
*/
-char *
+char *
tintervalout(TimeInterval interval)
{
- char *i_str,
- *p;
+ char *i_str,
+ *p;
i_str = (char *) palloc(T_INTERVAL_LEN); /* ['...' '...'] */
strcpy(i_str, "[\"");
@@ -306,10 +306,10 @@ tintervalout(TimeInterval interval)
RelativeTime
timespan_reltime(TimeSpan * timespan)
{
- RelativeTime time;
- int year,
- month;
- double span;
+ RelativeTime time;
+ int year,
+ month;
+ double span;
if (!PointerIsValid(timespan))
time = INVALID_RELTIME;
@@ -353,28 +353,28 @@ timespan_reltime(TimeSpan * timespan)
} /* timespan_reltime() */
-TimeSpan *
+TimeSpan *
reltime_timespan(RelativeTime reltime)
{
- TimeSpan *result;
- int year,
- month;
+ TimeSpan *result;
+ int year,
+ month;
if (!PointerIsValid(result = PALLOCTYPE(TimeSpan)))
elog(WARN, "Memory allocation failed, can't convert reltime to timespan", NULL);
switch (reltime)
{
- case INVALID_RELTIME:
- TIMESPAN_INVALID(*result);
- break;
+ case INVALID_RELTIME:
+ TIMESPAN_INVALID(*result);
+ break;
- default:
- TMODULO(reltime, year, 31536000);
- TMODULO(reltime, month, 2592000);
+ default:
+ TMODULO(reltime, year, 31536000);
+ TMODULO(reltime, month, 2592000);
- result->time = reltime;
- result->month = ((12 * year) + month);
+ result->time = reltime;
+ result->month = ((12 * year) + month);
}
return (result);
@@ -387,9 +387,9 @@ reltime_timespan(RelativeTime reltime)
TimeInterval
mktinterval(AbsoluteTime t1, AbsoluteTime t2)
{
- AbsoluteTime tstart = ABSTIMEMIN(t1, t2),
- tend = ABSTIMEMAX(t1, t2);
- TimeInterval interval;
+ AbsoluteTime tstart = ABSTIMEMIN(t1, t2),
+ tend = ABSTIMEMAX(t1, t2);
+ TimeInterval interval;
interval = (TimeInterval) palloc(sizeof(TimeIntervalData));
if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME)
@@ -500,7 +500,7 @@ intervalrel(TimeInterval interval)
AbsoluteTime
timenow()
{
- time_t sec;
+ time_t sec;
if (time(&sec) < 0)
return (INVALID_ABSTIME);
@@ -583,7 +583,7 @@ intervaleq(TimeInterval i1, TimeInterval i2)
bool
intervalleneq(TimeInterval i, RelativeTime t)
{
- RelativeTime rt;
+ RelativeTime rt;
if ((i->status == T_INTERVAL_INVAL) || (t == INVALID_RELTIME))
return (0);
@@ -598,7 +598,7 @@ intervalleneq(TimeInterval i, RelativeTime t)
bool
intervallenne(TimeInterval i, RelativeTime t)
{
- RelativeTime rt;
+ RelativeTime rt;
if ((i->status == T_INTERVAL_INVAL) || (t == INVALID_RELTIME))
return (0);
@@ -613,7 +613,7 @@ intervallenne(TimeInterval i, RelativeTime t)
bool
intervallenlt(TimeInterval i, RelativeTime t)
{
- RelativeTime rt;
+ RelativeTime rt;
if ((i->status == T_INTERVAL_INVAL) || (t == INVALID_RELTIME))
return (0);
@@ -628,7 +628,7 @@ intervallenlt(TimeInterval i, RelativeTime t)
bool
intervallengt(TimeInterval i, RelativeTime t)
{
- RelativeTime rt;
+ RelativeTime rt;
if ((i->status == T_INTERVAL_INVAL) || (t == INVALID_RELTIME))
return (0);
@@ -643,7 +643,7 @@ intervallengt(TimeInterval i, RelativeTime t)
bool
intervallenle(TimeInterval i, RelativeTime t)
{
- RelativeTime rt;
+ RelativeTime rt;
if ((i->status == T_INTERVAL_INVAL) || (t == INVALID_RELTIME))
return (0);
@@ -658,7 +658,7 @@ intervallenle(TimeInterval i, RelativeTime t)
bool
intervallenge(TimeInterval i, RelativeTime t)
{
- RelativeTime rt;
+ RelativeTime rt;
if ((i->status == T_INTERVAL_INVAL) || (t == INVALID_RELTIME))
return (0);
@@ -727,14 +727,14 @@ intervalend(TimeInterval i)
int
isreltime(char *str)
{
- struct tm tt,
- *tm = &tt;
- double fsec;
- int dtype;
- char *field[MAXDATEFIELDS];
- int nf,
- ftype[MAXDATEFIELDS];
- char lowstr[MAXDATELEN + 1];
+ struct tm tt,
+ *tm = &tt;
+ double fsec;
+ int dtype;
+ char *field[MAXDATEFIELDS];
+ int nf,
+ ftype[MAXDATEFIELDS];
+ char lowstr[MAXDATELEN + 1];
if (!PointerIsValid(str))
return 0;
@@ -748,31 +748,31 @@ isreltime(char *str)
switch (dtype)
{
- case (DTK_DELTA):
- return ((abs(tm->tm_year) <= 68) ? 1 : 0);
- break;
+ case (DTK_DELTA):
+ return ((abs(tm->tm_year) <= 68) ? 1 : 0);
+ break;
- case (DTK_INVALID):
- return 2;
- break;
+ case (DTK_INVALID):
+ return 2;
+ break;
- default:
- return 0;
- break;
+ default:
+ return 0;
+ break;
}
return 0;
} /* isreltime() */
#if FALSE
-register char *p;
-register char c;
-int i;
-char unit[UNITMAXLEN];
-char direction[DIRMAXLEN];
-int localSign;
-int localUnitNumber;
-long localQuantity;
+register char *p;
+register char c;
+int i;
+char unit[UNITMAXLEN];
+char direction[DIRMAXLEN];
+int localSign;
+int localUnitNumber;
+long localQuantity;
if (!PointerIsValid(sign))
{
@@ -897,7 +897,7 @@ return (1);
static int
correct_unit(char unit[], int *unptr)
{
- int j = 0;
+ int j = 0;
while (j < NUNITS)
{
@@ -955,9 +955,9 @@ istinterval(char *i_string,
AbsoluteTime * i_start,
AbsoluteTime * i_end)
{
- register char *p,
- *p1;
- register char c;
+ register char *p,
+ *p1;
+ register char c;
p = i_string;
/* skip leading blanks up to '[' */
@@ -1058,16 +1058,16 @@ istinterval(char *i_string,
* the Wisconsin benchmark with Illustra whose TimeNow() shows current
* time with precision up to microsecs.) - ay 3/95
*/
-text *
+text *
timeofday(void)
{
- struct timeval tp;
+ struct timeval tp;
struct timezone tpz;
- char templ[500];
- char buf[500];
- text *tm;
- int len = 0;
+ char templ[500];
+ char buf[500];
+ text *tm;
+ int len = 0;
gettimeofday(&tp, &tpz);
strftime(templ, sizeof(templ), "%a %b %d %H:%M:%S.%%d %Y %Z",
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index a88bea36e9c..0ab3b501022 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.14 1997/09/07 04:50:08 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.15 1997/09/08 02:30:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -25,10 +25,10 @@
#include "utils/datetime.h"
#include "access/xact.h"
-static int date2tm(DateADT dateVal, int *tzp, struct tm * tm, double *fsec, char **tzn);
+static int date2tm(DateADT dateVal, int *tzp, struct tm * tm, double *fsec, char **tzn);
-static int day_tab[2][12] = {
+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}};
@@ -59,16 +59,16 @@ static int day_tab[2][12] = {
DateADT
date_in(char *str)
{
- DateADT date;
- double fsec;
- struct tm tt,
- *tm = &tt;
- int tzp;
- int dtype;
- int nf;
- char *field[MAXDATEFIELDS];
- int ftype[MAXDATEFIELDS];
- char lowstr[MAXDATELEN + 1];
+ DateADT date;
+ double fsec;
+ struct tm tt,
+ *tm = &tt;
+ int tzp;
+ int dtype;
+ int nf;
+ char *field[MAXDATEFIELDS];
+ int ftype[MAXDATEFIELDS];
+ char lowstr[MAXDATELEN + 1];
if (!PointerIsValid(str))
elog(WARN, "Bad (null) date external representation", NULL);
@@ -82,21 +82,21 @@ date_in(char *str)
switch (dtype)
{
- case DTK_DATE:
- break;
+ case DTK_DATE:
+ break;
- case DTK_CURRENT:
- GetCurrentTime(tm);
- break;
+ case DTK_CURRENT:
+ GetCurrentTime(tm);
+ break;
- case DTK_EPOCH:
- tm->tm_year = 1970;
- tm->tm_mon = 1;
- tm->tm_mday = 1;
- break;
+ case DTK_EPOCH:
+ tm->tm_year = 1970;
+ tm->tm_mon = 1;
+ tm->tm_mday = 1;
+ break;
- default:
- elog(WARN, "Unrecognized date external representation %s", str);
+ default:
+ elog(WARN, "Unrecognized date external representation %s", str);
}
if (tm->tm_year < 0 || tm->tm_year > 32767)
@@ -115,18 +115,18 @@ date_in(char *str)
/* date_out()
* Given internal format date, convert to text string.
*/
-char *
+char *
date_out(DateADT date)
{
- char *result;
- struct tm tt,
- *tm = &tt;
- char buf[MAXDATELEN + 1];
+ char *result;
+ struct tm tt,
+ *tm = &tt;
+ char buf[MAXDATELEN + 1];
#if FALSE
- int year,
- month,
- day;
+ int year,
+ month,
+ day;
#endif
@@ -237,15 +237,15 @@ date_mii(DateADT dateVal, int4 days)
/* date_datetime()
* Convert date to datetime data type.
*/
-DateTime *
+DateTime *
date_datetime(DateADT dateVal)
{
- DateTime *result;
- struct tm tt,
- *tm = &tt;
- int tz;
- double fsec = 0;
- char *tzn;
+ DateTime *result;
+ struct tm tt,
+ *tm = &tt;
+ int tz;
+ double fsec = 0;
+ char *tzn;
result = PALLOCTYPE(DateTime);
@@ -270,12 +270,12 @@ date_datetime(DateADT dateVal)
DateADT
datetime_date(DateTime * datetime)
{
- DateADT result;
- struct tm tt,
- *tm = &tt;
- int tz;
- double fsec;
- char *tzn;
+ DateADT result;
+ struct tm tt,
+ *tm = &tt;
+ int tz;
+ double fsec;
+ char *tzn;
if (!PointerIsValid(datetime))
elog(WARN, "Unable to convert null datetime to date", NULL);
@@ -311,36 +311,36 @@ datetime_date(DateTime * datetime)
DateADT
abstime_date(AbsoluteTime abstime)
{
- DateADT result;
- struct tm tt,
- *tm = &tt;
- int tz;
+ DateADT result;
+ struct tm tt,
+ *tm = &tt;
+ int tz;
switch (abstime)
{
- case INVALID_ABSTIME:
- case NOSTART_ABSTIME:
- case NOEND_ABSTIME:
- elog(WARN, "Unable to convert reserved abstime value to date", NULL);
-
- /*
- * pretend to drop through to make compiler think that result will
- * be set
- */
-
- case EPOCH_ABSTIME:
- result = date2j(1970, 1, 1) - date2j(2000, 1, 1);
- break;
-
- case CURRENT_ABSTIME:
- GetCurrentTime(tm);
- result = date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - date2j(2000, 1, 1);
- break;
-
- default:
- abstime2tm(abstime, &tz, tm, NULL);
- result = date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - date2j(2000, 1, 1);
- break;
+ case INVALID_ABSTIME:
+ case NOSTART_ABSTIME:
+ case NOEND_ABSTIME:
+ elog(WARN, "Unable to convert reserved abstime value to date", NULL);
+
+ /*
+ * pretend to drop through to make compiler think that result
+ * will be set
+ */
+
+ case EPOCH_ABSTIME:
+ result = date2j(1970, 1, 1) - date2j(2000, 1, 1);
+ break;
+
+ case CURRENT_ABSTIME:
+ GetCurrentTime(tm);
+ result = date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - date2j(2000, 1, 1);
+ break;
+
+ default:
+ abstime2tm(abstime, &tz, tm, NULL);
+ result = date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - date2j(2000, 1, 1);
+ break;
}
return (result);
@@ -356,8 +356,8 @@ abstime_date(AbsoluteTime abstime)
static int
date2tm(DateADT dateVal, int *tzp, struct tm * tm, double *fsec, char **tzn)
{
- struct tm *tx;
- time_t utime;
+ struct tm *tx;
+ time_t utime;
*fsec = 0;
@@ -447,20 +447,20 @@ date2tm(DateADT dateVal, int *tzp, struct tm * tm, double *fsec, char **tzn)
*****************************************************************************/
-TimeADT *
+TimeADT *
time_in(char *str)
{
- TimeADT *time;
+ TimeADT *time;
- double fsec;
- struct tm tt,
- *tm = &tt;
+ double fsec;
+ struct tm tt,
+ *tm = &tt;
- int nf;
- char lowstr[MAXDATELEN + 1];
- char *field[MAXDATEFIELDS];
- int dtype;
- int ftype[MAXDATEFIELDS];
+ int nf;
+ char lowstr[MAXDATELEN + 1];
+ char *field[MAXDATEFIELDS];
+ int dtype;
+ int ftype[MAXDATEFIELDS];
if (!PointerIsValid(str))
elog(WARN, "Bad (null) time external representation", NULL);
@@ -484,21 +484,21 @@ time_in(char *str)
} /* time_in() */
-char *
+char *
time_out(TimeADT * time)
{
- char *result;
- struct tm tt,
- *tm = &tt;
+ char *result;
+ struct tm tt,
+ *tm = &tt;
#if FALSE
- int hour,
- min,
- sec;
+ int hour,
+ min,
+ sec;
#endif
- double fsec;
- char buf[MAXDATELEN + 1];
+ double fsec;
+ char buf[MAXDATELEN + 1];
if (!PointerIsValid(time))
return NULL;
@@ -602,10 +602,10 @@ time_cmp(TimeADT * time1, TimeADT * time2)
/* datetime_datetime()
* Convert date and time to datetime data type.
*/
-DateTime *
+DateTime *
datetime_datetime(DateADT date, TimeADT * time)
{
- DateTime *result;
+ DateTime *result;
if (!PointerIsValid(time))
{
diff --git a/src/backend/utils/adt/datum.c b/src/backend/utils/adt/datum.c
index eb314176bab..b1045765575 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.6 1997/09/07 04:50:09 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/datum.c,v 1.7 1997/09/08 02:30:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -51,7 +51,7 @@ datumGetSize(Datum value, Oid type, bool byVal, Size len)
{
struct varlena *s;
- Size size = 0;
+ Size size = 0;
if (byVal)
{
@@ -110,9 +110,9 @@ Datum
datumCopy(Datum value, Oid type, bool byVal, Size len)
{
- Size realSize;
- Datum res;
- char *s;
+ Size realSize;
+ Datum res;
+ char *s;
if (byVal)
@@ -154,8 +154,8 @@ void
datumFree(Datum value, Oid type, bool byVal, Size len)
{
- Size realSize;
- Pointer s;
+ Size realSize;
+ Pointer s;
realSize = datumGetSize(value, type, byVal, len);
@@ -188,10 +188,10 @@ datumFree(Datum value, Oid type, bool byVal, Size len)
bool
datumIsEqual(Datum value1, Datum value2, Oid type, bool byVal, Size len)
{
- Size size1,
- size2;
- char *s1,
- *s2;
+ Size size1,
+ size2;
+ char *s1,
+ *s2;
if (byVal)
{
diff --git a/src/backend/utils/adt/dt.c b/src/backend/utils/adt/dt.c
index b3eca30144c..e7968e9a40c 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.38 1997/09/07 04:50:11 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.39 1997/09/08 02:30:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -31,38 +31,38 @@
#endif
#include "utils/builtins.h"
-static int DecodeDate(char *str, int fmask, int *tmask, struct tm * tm);
+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 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 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);
+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
#define isleap(y) (((y % 4) == 0) && (((y % 100) != 0) || ((y % 400) == 0)))
-int mdays[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 0};
+int mdays[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 0};
-char *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
+char *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec", NULL};
-char *days[] = {"Sunday", "Monday", "Tuesday", "Wednesday",
+char *days[] = {"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday", NULL};
/* TMODULO()
@@ -71,7 +71,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);}
-static void GetEpochTime(struct tm * tm);
+static void GetEpochTime(struct tm * tm);
#define UTIME_MINYEAR (1901)
#define UTIME_MINMONTH (12)
@@ -95,20 +95,20 @@ static void GetEpochTime(struct tm * tm);
/* datetime_in()
* Convert a string to internal form.
*/
-DateTime *
+DateTime *
datetime_in(char *str)
{
- DateTime *result;
-
- double fsec;
- struct tm tt,
- *tm = &tt;
- int tz;
- int dtype;
- int nf;
- char *field[MAXDATEFIELDS];
- int ftype[MAXDATEFIELDS];
- char lowstr[MAXDATELEN + 1];
+ DateTime *result;
+
+ double fsec;
+ struct tm tt,
+ *tm = &tt;
+ int tz;
+ int dtype;
+ int nf;
+ char *field[MAXDATEFIELDS];
+ int ftype[MAXDATEFIELDS];
+ char lowstr[MAXDATELEN + 1];
if (!PointerIsValid(str))
elog(WARN, "Bad (null) datetime external representation", NULL);
@@ -121,38 +121,38 @@ datetime_in(char *str)
switch (dtype)
{
- case DTK_DATE:
- if (tm2datetime(tm, fsec, &tz, result) != 0)
- elog(WARN, "Datetime out of range %s", str);
+ case DTK_DATE:
+ if (tm2datetime(tm, fsec, &tz, result) != 0)
+ elog(WARN, "Datetime out of range %s", str);
#ifdef DATEDEBUG
- printf("datetime_in- date is %f\n", *result);
+ printf("datetime_in- date is %f\n", *result);
#endif
- break;
+ break;
- case DTK_EPOCH:
- DATETIME_EPOCH(*result);
- break;
+ case DTK_EPOCH:
+ DATETIME_EPOCH(*result);
+ break;
- case DTK_CURRENT:
- DATETIME_CURRENT(*result);
- break;
+ case DTK_CURRENT:
+ DATETIME_CURRENT(*result);
+ break;
- case DTK_LATE:
- DATETIME_NOEND(*result);
- break;
+ case DTK_LATE:
+ DATETIME_NOEND(*result);
+ break;
- case DTK_EARLY:
- DATETIME_NOBEGIN(*result);
- break;
+ case DTK_EARLY:
+ DATETIME_NOBEGIN(*result);
+ break;
- case DTK_INVALID:
- DATETIME_INVALID(*result);
- break;
+ case DTK_INVALID:
+ DATETIME_INVALID(*result);
+ break;
- default:
- elog(WARN, "Internal coding error, can't input datetime '%s'", str);
+ default:
+ elog(WARN, "Internal coding error, can't input datetime '%s'", str);
}
return (result);
@@ -161,16 +161,16 @@ datetime_in(char *str)
/* datetime_out()
* Convert a datetime to external form.
*/
-char *
+char *
datetime_out(DateTime * dt)
{
- char *result;
- int tz;
- struct tm tt,
- *tm = &tt;
- double fsec;
- char *tzn;
- char buf[MAXDATELEN + 1];
+ char *result;
+ int tz;
+ struct tm tt,
+ *tm = &tt;
+ double fsec;
+ char *tzn;
+ char buf[MAXDATELEN + 1];
if (!PointerIsValid(dt))
return (NULL);
@@ -204,19 +204,19 @@ datetime_out(DateTime * dt)
* External format(s):
* Uses the generic date/time parsing and decoding routines.
*/
-TimeSpan *
+TimeSpan *
timespan_in(char *str)
{
- TimeSpan *span;
+ TimeSpan *span;
- double fsec;
- struct tm tt,
- *tm = &tt;
- int dtype;
- int nf;
- char *field[MAXDATEFIELDS];
- int ftype[MAXDATEFIELDS];
- char lowstr[MAXDATELEN + 1];
+ double fsec;
+ struct tm tt,
+ *tm = &tt;
+ int dtype;
+ int nf;
+ char *field[MAXDATEFIELDS];
+ int ftype[MAXDATEFIELDS];
+ char lowstr[MAXDATELEN + 1];
tm->tm_year = 0;
tm->tm_mon = 0;
@@ -237,18 +237,18 @@ timespan_in(char *str)
switch (dtype)
{
- case DTK_DELTA:
- if (tm2timespan(tm, fsec, span) != 0)
- {
+ case DTK_DELTA:
+ if (tm2timespan(tm, fsec, span) != 0)
+ {
#if FALSE
- TIMESPAN_INVALID(span);
+ TIMESPAN_INVALID(span);
#endif
- elog(WARN, "Bad timespan external representation %s", str);
- }
- break;
+ elog(WARN, "Bad timespan external representation %s", str);
+ }
+ break;
- default:
- elog(WARN, "Internal coding error, can't input timespan '%s'", str);
+ default:
+ elog(WARN, "Internal coding error, can't input timespan '%s'", str);
}
return (span);
@@ -257,15 +257,15 @@ timespan_in(char *str)
/* timespan_out()
* Convert a time span to external form.
*/
-char *
+char *
timespan_out(TimeSpan * span)
{
- char *result;
+ char *result;
- struct tm tt,
- *tm = &tt;
- double fsec;
- char buf[MAXDATELEN + 1];
+ struct tm tt,
+ *tm = &tt;
+ double fsec;
+ char buf[MAXDATELEN + 1];
if (!PointerIsValid(span))
return (NULL);
@@ -317,8 +317,8 @@ timespan_finite(TimeSpan * timespan)
static void
GetEpochTime(struct tm * tm)
{
- struct tm *t0;
- time_t epoch = 0;
+ struct tm *t0;
+ time_t epoch = 0;
t0 = gmtime(&epoch);
@@ -344,7 +344,7 @@ GetEpochTime(struct tm * tm)
DateTime
SetDateTime(DateTime dt)
{
- struct tm tt;
+ struct tm tt;
if (DATETIME_IS_CURRENT(dt))
{
@@ -373,8 +373,8 @@ SetDateTime(DateTime dt)
bool
datetime_eq(DateTime * datetime1, DateTime * datetime2)
{
- DateTime dt1,
- dt2;
+ DateTime dt1,
+ dt2;
if (!PointerIsValid(datetime1) || !PointerIsValid(datetime2))
return FALSE;
@@ -396,8 +396,8 @@ datetime_eq(DateTime * datetime1, DateTime * datetime2)
bool
datetime_ne(DateTime * datetime1, DateTime * datetime2)
{
- DateTime dt1,
- dt2;
+ DateTime dt1,
+ dt2;
if (!PointerIsValid(datetime1) || !PointerIsValid(datetime2))
return FALSE;
@@ -419,8 +419,8 @@ datetime_ne(DateTime * datetime1, DateTime * datetime2)
bool
datetime_lt(DateTime * datetime1, DateTime * datetime2)
{
- DateTime dt1,
- dt2;
+ DateTime dt1,
+ dt2;
if (!PointerIsValid(datetime1) || !PointerIsValid(datetime2))
return FALSE;
@@ -442,8 +442,8 @@ datetime_lt(DateTime * datetime1, DateTime * datetime2)
bool
datetime_gt(DateTime * datetime1, DateTime * datetime2)
{
- DateTime dt1,
- dt2;
+ DateTime dt1,
+ dt2;
if (!PointerIsValid(datetime1) || !PointerIsValid(datetime2))
return FALSE;
@@ -468,8 +468,8 @@ datetime_gt(DateTime * datetime1, DateTime * datetime2)
bool
datetime_le(DateTime * datetime1, DateTime * datetime2)
{
- DateTime dt1,
- dt2;
+ DateTime dt1,
+ dt2;
if (!PointerIsValid(datetime1) || !PointerIsValid(datetime2))
return FALSE;
@@ -491,8 +491,8 @@ datetime_le(DateTime * datetime1, DateTime * datetime2)
bool
datetime_ge(DateTime * datetime1, DateTime * datetime2)
{
- DateTime dt1,
- dt2;
+ DateTime dt1,
+ dt2;
if (!PointerIsValid(datetime1) || !PointerIsValid(datetime2))
return FALSE;
@@ -518,8 +518,8 @@ datetime_ge(DateTime * datetime1, DateTime * datetime2)
int
datetime_cmp(DateTime * datetime1, DateTime * datetime2)
{
- DateTime dt1,
- dt2;
+ DateTime dt1,
+ dt2;
if (!PointerIsValid(datetime1) || !PointerIsValid(datetime2))
return 0;
@@ -580,8 +580,8 @@ timespan_ne(TimeSpan * timespan1, TimeSpan * timespan2)
bool
timespan_lt(TimeSpan * timespan1, TimeSpan * timespan2)
{
- double span1,
- span2;
+ double span1,
+ span2;
if (!PointerIsValid(timespan1) || !PointerIsValid(timespan2))
return FALSE;
@@ -602,8 +602,8 @@ timespan_lt(TimeSpan * timespan1, TimeSpan * timespan2)
bool
timespan_gt(TimeSpan * timespan1, TimeSpan * timespan2)
{
- double span1,
- span2;
+ double span1,
+ span2;
if (!PointerIsValid(timespan1) || !PointerIsValid(timespan2))
return FALSE;
@@ -624,8 +624,8 @@ timespan_gt(TimeSpan * timespan1, TimeSpan * timespan2)
bool
timespan_le(TimeSpan * timespan1, TimeSpan * timespan2)
{
- double span1,
- span2;
+ double span1,
+ span2;
if (!PointerIsValid(timespan1) || !PointerIsValid(timespan2))
return FALSE;
@@ -646,8 +646,8 @@ timespan_le(TimeSpan * timespan1, TimeSpan * timespan2)
bool
timespan_ge(TimeSpan * timespan1, TimeSpan * timespan2)
{
- double span1,
- span2;
+ double span1,
+ span2;
if (!PointerIsValid(timespan1) || !PointerIsValid(timespan2))
return FALSE;
@@ -671,8 +671,8 @@ timespan_ge(TimeSpan * timespan1, TimeSpan * timespan2)
int
timespan_cmp(TimeSpan * timespan1, TimeSpan * timespan2)
{
- double span1,
- span2;
+ double span1,
+ span2;
if (!PointerIsValid(timespan1) || !PointerIsValid(timespan2))
return 0;
@@ -706,13 +706,13 @@ timespan_cmp(TimeSpan * timespan1, TimeSpan * timespan2)
* actual value.
*---------------------------------------------------------*/
-DateTime *
+DateTime *
datetime_smaller(DateTime * datetime1, DateTime * datetime2)
{
- DateTime *result;
+ DateTime *result;
- DateTime dt1,
- dt2;
+ DateTime dt1,
+ dt2;
if (!PointerIsValid(datetime1) || !PointerIsValid(datetime2))
return NULL;
@@ -743,13 +743,13 @@ datetime_smaller(DateTime * datetime1, DateTime * datetime2)
return (result);
} /* datetime_smaller() */
-DateTime *
+DateTime *
datetime_larger(DateTime * datetime1, DateTime * datetime2)
{
- DateTime *result;
+ DateTime *result;
- DateTime dt1,
- dt2;
+ DateTime dt1,
+ dt2;
if (!PointerIsValid(datetime1) || !PointerIsValid(datetime2))
return NULL;
@@ -781,13 +781,13 @@ datetime_larger(DateTime * datetime1, DateTime * datetime2)
} /* datetime_larger() */
-TimeSpan *
+TimeSpan *
datetime_mi(DateTime * datetime1, DateTime * datetime2)
{
- TimeSpan *result;
+ TimeSpan *result;
- DateTime dt1,
- dt2;
+ DateTime dt1,
+ dt2;
if (!PointerIsValid(datetime1) || !PointerIsValid(datetime2))
return NULL;
@@ -830,13 +830,13 @@ datetime_mi(DateTime * datetime1, DateTime * datetime2)
* Then, if the next month has fewer days, set the day of month
* to the last day of month.
*/
-DateTime *
+DateTime *
datetime_pl_span(DateTime * datetime, TimeSpan * span)
{
- DateTime *result;
- DateTime dt;
- int tz;
- char *tzn;
+ DateTime *result;
+ DateTime dt;
+ int tz;
+ char *tzn;
if ((!PointerIsValid(datetime)) || (!PointerIsValid(span)))
return NULL;
@@ -869,9 +869,9 @@ datetime_pl_span(DateTime * datetime, TimeSpan * span)
if (span->month != 0)
{
- struct tm tt,
- *tm = &tt;
- double fsec;
+ struct tm tt,
+ *tm = &tt;
+ double fsec;
if (datetime2tm(dt, &tz, tm, &fsec, &tzn) == 0)
{
@@ -924,11 +924,11 @@ datetime_pl_span(DateTime * datetime, TimeSpan * span)
return (result);
} /* datetime_pl_span() */
-DateTime *
+DateTime *
datetime_mi_span(DateTime * datetime, TimeSpan * span)
{
- DateTime *result;
- TimeSpan tspan;
+ DateTime *result;
+ TimeSpan tspan;
if (!PointerIsValid(datetime) || !PointerIsValid(span))
return NULL;
@@ -942,10 +942,10 @@ datetime_mi_span(DateTime * datetime, TimeSpan * span)
} /* datetime_mi_span() */
-TimeSpan *
+TimeSpan *
timespan_um(TimeSpan * timespan)
{
- TimeSpan *result;
+ TimeSpan *result;
if (!PointerIsValid(timespan))
return NULL;
@@ -959,13 +959,13 @@ timespan_um(TimeSpan * timespan)
} /* timespan_um() */
-TimeSpan *
+TimeSpan *
timespan_smaller(TimeSpan * timespan1, TimeSpan * timespan2)
{
- TimeSpan *result;
+ TimeSpan *result;
- double span1,
- span2;
+ double span1,
+ span2;
if (!PointerIsValid(timespan1) || !PointerIsValid(timespan2))
return NULL;
@@ -1014,13 +1014,13 @@ timespan_smaller(TimeSpan * timespan1, TimeSpan * timespan2)
return (result);
} /* timespan_smaller() */
-TimeSpan *
+TimeSpan *
timespan_larger(TimeSpan * timespan1, TimeSpan * timespan2)
{
- TimeSpan *result;
+ TimeSpan *result;
- double span1,
- span2;
+ double span1,
+ span2;
if (!PointerIsValid(timespan1) || !PointerIsValid(timespan2))
return NULL;
@@ -1070,10 +1070,10 @@ timespan_larger(TimeSpan * timespan1, TimeSpan * timespan2)
} /* timespan_larger() */
-TimeSpan *
+TimeSpan *
timespan_pl(TimeSpan * span1, TimeSpan * span2)
{
- TimeSpan *result;
+ TimeSpan *result;
if ((!PointerIsValid(span1)) || (!PointerIsValid(span2)))
return NULL;
@@ -1086,10 +1086,10 @@ timespan_pl(TimeSpan * span1, TimeSpan * span2)
return (result);
} /* timespan_pl() */
-TimeSpan *
+TimeSpan *
timespan_mi(TimeSpan * span1, TimeSpan * span2)
{
- TimeSpan *result;
+ TimeSpan *result;
if ((!PointerIsValid(span1)) || (!PointerIsValid(span2)))
return NULL;
@@ -1102,10 +1102,10 @@ timespan_mi(TimeSpan * span1, TimeSpan * span2)
return (result);
} /* timespan_mi() */
-TimeSpan *
+TimeSpan *
timespan_div(TimeSpan * span1, float8 * arg2)
{
- TimeSpan *result;
+ TimeSpan *result;
if ((!PointerIsValid(span1)) || (!PointerIsValid(arg2)))
return NULL;
@@ -1128,22 +1128,22 @@ timespan_div(TimeSpan * span1, float8 * arg2)
* since year and month are out of context once the arithmetic
* is done.
*/
-TimeSpan *
+TimeSpan *
datetime_age(DateTime * datetime1, DateTime * datetime2)
{
- TimeSpan *result;
-
- DateTime dt1,
- dt2;
- double fsec,
- fsec1,
- fsec2;
- struct tm tt,
- *tm = &tt;
- struct tm tt1,
- *tm1 = &tt1;
- struct tm tt2,
- *tm2 = &tt2;
+ TimeSpan *result;
+
+ DateTime dt1,
+ dt2;
+ double fsec,
+ fsec1,
+ fsec2;
+ struct tm tt,
+ *tm = &tt;
+ struct tm tt1,
+ *tm1 = &tt1;
+ struct tm tt2,
+ *tm2 = &tt2;
if (!PointerIsValid(datetime1) || !PointerIsValid(datetime2))
return NULL;
@@ -1275,12 +1275,12 @@ datetime_age(DateTime * datetime1, DateTime * datetime2)
/* datetime_text()
* Convert datetime to text data type.
*/
-text *
+text *
datetime_text(DateTime * datetime)
{
- text *result;
- char *str;
- int len;
+ text *result;
+ char *str;
+ int len;
if (!PointerIsValid(datetime))
return NULL;
@@ -1308,14 +1308,14 @@ datetime_text(DateTime * datetime)
* Text type is not null terminated, so use temporary string
* then call the standard input routine.
*/
-DateTime *
+DateTime *
text_datetime(text * str)
{
- DateTime *result;
- int i;
- char *sp,
- *dp,
- dstr[MAXDATELEN + 1];
+ DateTime *result;
+ int i;
+ char *sp,
+ *dp,
+ dstr[MAXDATELEN + 1];
if (!PointerIsValid(str))
return NULL;
@@ -1335,12 +1335,12 @@ text_datetime(text * str)
/* timespan_text()
* Convert timespan to text data type.
*/
-text *
+text *
timespan_text(TimeSpan * timespan)
{
- text *result;
- char *str;
- int len;
+ text *result;
+ char *str;
+ int len;
if (!PointerIsValid(timespan))
return NULL;
@@ -1369,14 +1369,14 @@ timespan_text(TimeSpan * timespan)
* then call the standard input routine.
*/
#ifdef NOT_USED
-TimeSpan *
+TimeSpan *
text_timespan(text * str)
{
- TimeSpan *result;
- int i;
- char *sp,
- *dp,
- dstr[MAXDATELEN + 1];
+ TimeSpan *result;
+ int i;
+ char *sp,
+ *dp,
+ dstr[MAXDATELEN + 1];
if (!PointerIsValid(str))
return NULL;
@@ -1397,23 +1397,23 @@ text_timespan(text * str)
/* datetime_trunc()
* Extract specified field from datetime.
*/
-DateTime *
+DateTime *
datetime_trunc(text * units, DateTime * datetime)
{
- DateTime *result;
-
- DateTime dt;
- int tz;
- int type,
- val;
- int i;
- char *up,
- *lp,
- lowunits[MAXDATELEN + 1];
- double fsec;
- char *tzn;
- struct tm tt,
- *tm = &tt;
+ DateTime *result;
+
+ DateTime dt;
+ int tz;
+ int type,
+ val;
+ int i;
+ char *up,
+ *lp,
+ lowunits[MAXDATELEN + 1];
+ double fsec;
+ char *tzn;
+ struct tm tt,
+ *tm = &tt;
if ((!PointerIsValid(units)) || (!PointerIsValid(datetime)))
return NULL;
@@ -1457,39 +1457,39 @@ datetime_trunc(text * units, DateTime * datetime)
{
switch (val)
{
- case DTK_MILLENIUM:
- tm->tm_year = (tm->tm_year / 1000) * 1000;
- case DTK_CENTURY:
- tm->tm_year = (tm->tm_year / 100) * 100;
- case DTK_DECADE:
- tm->tm_year = (tm->tm_year / 10) * 10;
- case DTK_YEAR:
- tm->tm_mon = 1;
- case DTK_QUARTER:
- tm->tm_mon = (3 * (tm->tm_mon / 4)) + 1;
- case DTK_MONTH:
- tm->tm_mday = 1;
- case DTK_DAY:
- tm->tm_hour = 0;
- case DTK_HOUR:
- tm->tm_min = 0;
- case DTK_MINUTE:
- tm->tm_sec = 0;
- case DTK_SECOND:
- fsec = 0;
- break;
+ case DTK_MILLENIUM:
+ tm->tm_year = (tm->tm_year / 1000) * 1000;
+ case DTK_CENTURY:
+ tm->tm_year = (tm->tm_year / 100) * 100;
+ case DTK_DECADE:
+ tm->tm_year = (tm->tm_year / 10) * 10;
+ case DTK_YEAR:
+ tm->tm_mon = 1;
+ case DTK_QUARTER:
+ tm->tm_mon = (3 * (tm->tm_mon / 4)) + 1;
+ case DTK_MONTH:
+ tm->tm_mday = 1;
+ case DTK_DAY:
+ tm->tm_hour = 0;
+ case DTK_HOUR:
+ tm->tm_min = 0;
+ case DTK_MINUTE:
+ tm->tm_sec = 0;
+ case DTK_SECOND:
+ fsec = 0;
+ break;
- case DTK_MILLISEC:
- fsec = rint(fsec * 1000) / 1000;
- break;
+ case DTK_MILLISEC:
+ fsec = rint(fsec * 1000) / 1000;
+ break;
- case DTK_MICROSEC:
- fsec = rint(fsec * 1000) / 1000;
- break;
+ case DTK_MICROSEC:
+ fsec = rint(fsec * 1000) / 1000;
+ break;
- default:
- elog(WARN, "Datetime units %s not supported", lowunits);
- result = NULL;
+ default:
+ elog(WARN, "Datetime units %s not supported", lowunits);
+ result = NULL;
}
if (IS_VALID_UTIME(tm->tm_year, tm->tm_mon, tm->tm_mday))
@@ -1545,20 +1545,20 @@ datetime_trunc(text * units, DateTime * datetime)
/* timespan_trunc()
* Extract specified field from timespan.
*/
-TimeSpan *
+TimeSpan *
timespan_trunc(text * units, TimeSpan * timespan)
{
- TimeSpan *result;
-
- int type,
- val;
- int i;
- char *up,
- *lp,
- lowunits[MAXDATELEN + 1];
- double fsec;
- struct tm tt,
- *tm = &tt;
+ TimeSpan *result;
+
+ int type,
+ val;
+ int i;
+ char *up,
+ *lp,
+ lowunits[MAXDATELEN + 1];
+ double fsec;
+ struct tm tt,
+ *tm = &tt;
if ((!PointerIsValid(units)) || (!PointerIsValid(timespan)))
return NULL;
@@ -1600,39 +1600,39 @@ timespan_trunc(text * units, TimeSpan * timespan)
{
switch (val)
{
- case DTK_MILLENIUM:
- tm->tm_year = (tm->tm_year / 1000) * 1000;
- case DTK_CENTURY:
- tm->tm_year = (tm->tm_year / 100) * 100;
- case DTK_DECADE:
- tm->tm_year = (tm->tm_year / 10) * 10;
- case DTK_YEAR:
- tm->tm_mon = 0;
- case DTK_QUARTER:
- tm->tm_mon = (3 * (tm->tm_mon / 4));
- case DTK_MONTH:
- tm->tm_mday = 0;
- case DTK_DAY:
- tm->tm_hour = 0;
- case DTK_HOUR:
- tm->tm_min = 0;
- case DTK_MINUTE:
- tm->tm_sec = 0;
- case DTK_SECOND:
- fsec = 0;
- break;
+ case DTK_MILLENIUM:
+ tm->tm_year = (tm->tm_year / 1000) * 1000;
+ case DTK_CENTURY:
+ tm->tm_year = (tm->tm_year / 100) * 100;
+ case DTK_DECADE:
+ tm->tm_year = (tm->tm_year / 10) * 10;
+ case DTK_YEAR:
+ tm->tm_mon = 0;
+ case DTK_QUARTER:
+ tm->tm_mon = (3 * (tm->tm_mon / 4));
+ case DTK_MONTH:
+ tm->tm_mday = 0;
+ case DTK_DAY:
+ tm->tm_hour = 0;
+ case DTK_HOUR:
+ tm->tm_min = 0;
+ case DTK_MINUTE:
+ tm->tm_sec = 0;
+ case DTK_SECOND:
+ fsec = 0;
+ break;
- case DTK_MILLISEC:
- fsec = rint(fsec * 1000) / 1000;
- break;
+ case DTK_MILLISEC:
+ fsec = rint(fsec * 1000) / 1000;
+ break;
- case DTK_MICROSEC:
- fsec = rint(fsec * 1000) / 1000;
- break;
+ case DTK_MICROSEC:
+ fsec = rint(fsec * 1000) / 1000;
+ break;
- default:
- elog(WARN, "Timespan units %s not supported", lowunits);
- result = NULL;
+ default:
+ elog(WARN, "Timespan units %s not supported", lowunits);
+ result = NULL;
}
if (tm2timespan(tm, fsec, result) != 0)
@@ -1674,20 +1674,20 @@ timespan_trunc(text * units, TimeSpan * timespan)
float64
datetime_part(text * units, DateTime * datetime)
{
- float64 result;
-
- DateTime dt;
- int tz;
- int type,
- val;
- int i;
- char *up,
- *lp,
- lowunits[MAXDATELEN + 1];
- double fsec;
- char *tzn;
- struct tm tt,
- *tm = &tt;
+ float64 result;
+
+ DateTime dt;
+ int tz;
+ int type,
+ val;
+ int i;
+ char *up,
+ *lp,
+ lowunits[MAXDATELEN + 1];
+ double fsec;
+ char *tzn;
+ struct tm tt,
+ *tm = &tt;
if ((!PointerIsValid(units)) || (!PointerIsValid(datetime)))
return NULL;
@@ -1729,61 +1729,61 @@ datetime_part(text * units, DateTime * datetime)
{
switch (val)
{
- case DTK_TZ:
- *result = tz;
- break;
+ case DTK_TZ:
+ *result = tz;
+ break;
- case DTK_MICROSEC:
- *result = (fsec * 1000000);
- break;
+ case DTK_MICROSEC:
+ *result = (fsec * 1000000);
+ break;
- case DTK_MILLISEC:
- *result = (fsec * 1000);
- break;
+ case DTK_MILLISEC:
+ *result = (fsec * 1000);
+ break;
- case DTK_SECOND:
- *result = (tm->tm_sec + fsec);
- break;
+ case DTK_SECOND:
+ *result = (tm->tm_sec + fsec);
+ break;
- case DTK_MINUTE:
- *result = tm->tm_min;
- break;
+ case DTK_MINUTE:
+ *result = tm->tm_min;
+ break;
- case DTK_HOUR:
- *result = tm->tm_hour;
- break;
+ case DTK_HOUR:
+ *result = tm->tm_hour;
+ break;
- case DTK_DAY:
- *result = tm->tm_mday;
- break;
+ case DTK_DAY:
+ *result = tm->tm_mday;
+ break;
- case DTK_MONTH:
- *result = tm->tm_mon;
- break;
+ case DTK_MONTH:
+ *result = tm->tm_mon;
+ break;
- case DTK_QUARTER:
- *result = (tm->tm_mon / 4) + 1;
- break;
+ case DTK_QUARTER:
+ *result = (tm->tm_mon / 4) + 1;
+ break;
- case DTK_YEAR:
- *result = tm->tm_year;
- break;
+ case DTK_YEAR:
+ *result = tm->tm_year;
+ break;
- case DTK_DECADE:
- *result = (tm->tm_year / 10) + 1;
- break;
+ case DTK_DECADE:
+ *result = (tm->tm_year / 10) + 1;
+ break;
- case DTK_CENTURY:
- *result = (tm->tm_year / 100) + 1;
- break;
+ case DTK_CENTURY:
+ *result = (tm->tm_year / 100) + 1;
+ break;
- case DTK_MILLENIUM:
- *result = (tm->tm_year / 1000) + 1;
- break;
+ case DTK_MILLENIUM:
+ *result = (tm->tm_year / 1000) + 1;
+ break;
- default:
- elog(WARN, "Datetime units %s not supported", lowunits);
- *result = 0;
+ default:
+ elog(WARN, "Datetime units %s not supported", lowunits);
+ *result = 0;
}
}
@@ -1791,21 +1791,21 @@ datetime_part(text * units, DateTime * datetime)
{
switch (val)
{
- case DTK_EPOCH:
- DATETIME_EPOCH(*result);
- *result = dt - SetDateTime(*result);
- break;
+ case DTK_EPOCH:
+ DATETIME_EPOCH(*result);
+ *result = dt - SetDateTime(*result);
+ break;
- case DTK_DOW:
- if (datetime2tm(dt, &tz, tm, &fsec, &tzn) != 0)
- elog(WARN, "Unable to encode datetime", NULL);
+ case DTK_DOW:
+ if (datetime2tm(dt, &tz, tm, &fsec, &tzn) != 0)
+ elog(WARN, "Unable to encode datetime", NULL);
- *result = j2day(date2j(tm->tm_year, tm->tm_mon, tm->tm_mday));
- break;
+ *result = j2day(date2j(tm->tm_year, tm->tm_mon, tm->tm_mday));
+ break;
- default:
- elog(WARN, "Datetime units %s not supported", lowunits);
- *result = 0;
+ default:
+ elog(WARN, "Datetime units %s not supported", lowunits);
+ *result = 0;
}
}
@@ -1826,17 +1826,17 @@ datetime_part(text * units, DateTime * datetime)
float64
timespan_part(text * units, TimeSpan * timespan)
{
- float64 result;
-
- int type,
- val;
- int i;
- char *up,
- *lp,
- lowunits[MAXDATELEN + 1];
- double fsec;
- struct tm tt,
- *tm = &tt;
+ float64 result;
+
+ int type,
+ val;
+ int i;
+ char *up,
+ *lp,
+ lowunits[MAXDATELEN + 1];
+ double fsec;
+ struct tm tt,
+ *tm = &tt;
if ((!PointerIsValid(units)) || (!PointerIsValid(timespan)))
return NULL;
@@ -1876,57 +1876,57 @@ timespan_part(text * units, TimeSpan * timespan)
{
switch (val)
{
- case DTK_MICROSEC:
- *result = (fsec * 1000000);
- break;
+ case DTK_MICROSEC:
+ *result = (fsec * 1000000);
+ break;
- case DTK_MILLISEC:
- *result = (fsec * 1000);
- break;
+ case DTK_MILLISEC:
+ *result = (fsec * 1000);
+ break;
- case DTK_SECOND:
- *result = (tm->tm_sec + fsec);
- break;
+ case DTK_SECOND:
+ *result = (tm->tm_sec + fsec);
+ break;
- case DTK_MINUTE:
- *result = tm->tm_min;
- break;
+ case DTK_MINUTE:
+ *result = tm->tm_min;
+ break;
- case DTK_HOUR:
- *result = tm->tm_hour;
- break;
+ case DTK_HOUR:
+ *result = tm->tm_hour;
+ break;
- case DTK_DAY:
- *result = tm->tm_mday;
- break;
+ case DTK_DAY:
+ *result = tm->tm_mday;
+ break;
- case DTK_MONTH:
- *result = tm->tm_mon;
- break;
+ case DTK_MONTH:
+ *result = tm->tm_mon;
+ break;
- case DTK_QUARTER:
- *result = (tm->tm_mon / 4) + 1;
- break;
+ case DTK_QUARTER:
+ *result = (tm->tm_mon / 4) + 1;
+ break;
- case DTK_YEAR:
- *result = tm->tm_year;
- break;
+ case DTK_YEAR:
+ *result = tm->tm_year;
+ break;
- case DTK_DECADE:
- *result = (tm->tm_year / 10) + 1;
- break;
+ case DTK_DECADE:
+ *result = (tm->tm_year / 10) + 1;
+ break;
- case DTK_CENTURY:
- *result = (tm->tm_year / 100) + 1;
- break;
+ case DTK_CENTURY:
+ *result = (tm->tm_year / 100) + 1;
+ break;
- case DTK_MILLENIUM:
- *result = (tm->tm_year / 1000) + 1;
- break;
+ case DTK_MILLENIUM:
+ *result = (tm->tm_year / 1000) + 1;
+ break;
- default:
- elog(WARN, "Timespan units %s not yet supported", units);
- result = NULL;
+ default:
+ elog(WARN, "Timespan units %s not yet supported", units);
+ result = NULL;
}
}
@@ -1960,26 +1960,26 @@ timespan_part(text * units, TimeSpan * timespan)
/* datetime_zone()
* Encode datetime type with specified time zone.
*/
-text *
+text *
datetime_zone(text * zone, DateTime * datetime)
{
- text *result;
-
- DateTime dt;
- int tz;
- int type,
- val;
- int i;
- char *up,
- *lp,
- lowzone[MAXDATELEN + 1];
- char *tzn,
- upzone[MAXDATELEN + 1];
- double fsec;
- struct tm tt,
- *tm = &tt;
- char buf[MAXDATELEN + 1];
- int len;
+ text *result;
+
+ DateTime dt;
+ int tz;
+ int type,
+ val;
+ int i;
+ char *up,
+ *lp,
+ lowzone[MAXDATELEN + 1];
+ char *tzn,
+ upzone[MAXDATELEN + 1];
+ double fsec;
+ struct tm tt,
+ *tm = &tt;
+ char buf[MAXDATELEN + 1];
+ int len;
if ((!PointerIsValid(zone)) || (!PointerIsValid(datetime)))
return NULL;
@@ -2064,7 +2064,7 @@ datetime_zone(text * zone, DateTime * datetime)
* entries by 10 and truncate the text field at MAXTOKLEN characters.
* the text field is not guaranteed to be NULL-terminated.
*/
-static datetkn datetktbl[] = {
+static datetkn datetktbl[] = {
/* text token lexval */
{EARLY, RESERV, DTK_EARLY}, /* "-infinity" reserved for "early time" */
{"acsst", DTZ, 63}, /* Cent. Australia */
@@ -2218,7 +2218,7 @@ static datetkn datetktbl[] = {
static unsigned int szdatetktbl = sizeof datetktbl / sizeof datetktbl[0];
-static datetkn deltatktbl[] = {
+static datetkn deltatktbl[] = {
/* text token lexval */
{"@", IGNORE, 0}, /* postgres relative time prefix */
{DAGO, AGO, 0}, /* "ago" indicates negative time offset */
@@ -2302,9 +2302,9 @@ static datetkn deltatktbl[] = {
static unsigned int szdeltatktbl = sizeof deltatktbl / sizeof deltatktbl[0];
#if USE_DATE_CACHE
-datetkn *datecache[MAXDATEFIELDS] = {NULL};
+datetkn *datecache[MAXDATEFIELDS] = {NULL};
-datetkn *deltacache[MAXDATEFIELDS] = {NULL};
+datetkn *deltacache[MAXDATEFIELDS] = {NULL};
#endif
@@ -2341,7 +2341,7 @@ datetkn *deltacache[MAXDATEFIELDS] = {NULL};
int
date2j(int y, int m, int d)
{
- int m12 = (m - 14) / 12;
+ int m12 = (m - 14) / 12;
return ((1461 * (y + 4800 + m12)) / 4 + (367 * (m - 2 - 12 * (m12))) / 12
- (3 * ((y + 4900 + m12) / 100)) / 4 + d - 32075);
@@ -2350,14 +2350,14 @@ date2j(int y, int m, int d)
void
j2date(int jd, int *year, int *month, int *day)
{
- int j,
- y,
- m,
- d;
+ int j,
+ y,
+ m,
+ d;
- int i,
- l,
- n;
+ int i,
+ l,
+ n;
l = jd + 68569;
n = (4 * l) / 146097;
@@ -2379,7 +2379,7 @@ j2date(int jd, int *year, int *month, int *day)
static int
j2day(int date)
{
- int day;
+ int day;
day = (date + 1) % 7;
@@ -2401,14 +2401,14 @@ j2day(int date)
int
datetime2tm(DateTime dt, int *tzp, struct tm * tm, double *fsec, char **tzn)
{
- double date,
- date0,
- time,
- sec;
- time_t utime;
+ double date,
+ date0,
+ time,
+ sec;
+ time_t utime;
#ifdef USE_POSIX_TIME
- struct tm *tx;
+ struct tm *tx;
#endif
@@ -2556,8 +2556,8 @@ int
tm2datetime(struct tm * tm, double fsec, int *tzp, DateTime * result)
{
- double date,
- time;
+ double date,
+ time;
/* Julian day routines are not correct for negative Julian days */
if (!IS_VALID_JULIAN(tm->tm_year, tm->tm_mon, tm->tm_mday))
@@ -2583,7 +2583,7 @@ tm2datetime(struct tm * tm, double fsec, int *tzp, DateTime * result)
static int
timespan2tm(TimeSpan span, struct tm * tm, float8 * fsec)
{
- double time;
+ double time;
if (span.month != 0)
{
@@ -2633,7 +2633,7 @@ tm2timespan(struct tm * tm, double fsec, TimeSpan * span)
} /* tm2timespan() */
-static DateTime
+static DateTime
dt2local(DateTime dt, int tz)
{
dt -= tz;
@@ -2650,7 +2650,7 @@ time2t(const int hour, const int min, const double sec)
static void
dt2time(DateTime jd, int *hour, int *min, double *sec)
{
- double time;
+ double time;
time = jd;
@@ -2677,9 +2677,9 @@ int
ParseDateTime(char *timestr, char *lowstr,
char *field[], int ftype[], int maxfields, int *numfields)
{
- int nf = 0;
- char *cp = timestr;
- char *lp = lowstr;
+ int nf = 0;
+ char *cp = timestr;
+ char *lp = lowstr;
#ifdef DATEDEBUG
printf("ParseDateTime- input string is %s\n", timestr);
@@ -2833,14 +2833,14 @@ int
DecodeDateTime(char *field[], int ftype[], int nf,
int *dtype, struct tm * tm, double *fsec, int *tzp)
{
- int fmask = 0,
- tmask,
- type;
- int i;
- int flen,
- val;
- int mer = HR24;
- int bc = FALSE;
+ int fmask = 0,
+ tmask,
+ type;
+ int i;
+ int flen,
+ val;
+ int mer = HR24;
+ int bc = FALSE;
*dtype = DTK_DATE;
tm->tm_hour = 0;
@@ -2859,181 +2859,181 @@ DecodeDateTime(char *field[], int ftype[], int nf,
#endif
switch (ftype[i])
{
- case DTK_DATE:
- if (DecodeDate(field[i], fmask, &tmask, tm) != 0)
- return -1;
- break;
-
- case DTK_TIME:
- if (DecodeTime(field[i], fmask, &tmask, tm, fsec) != 0)
- return -1;
-
- /*
- * check upper limit on hours; other limits checked in
- * DecodeTime()
- */
- if (tm->tm_hour > 23)
- return -1;
- break;
-
- case DTK_TZ:
- if (tzp == NULL)
- return -1;
- if (DecodeTimezone(field[i], tzp) != 0)
- return -1;
- tmask = DTK_M(TZ);
- break;
-
- case DTK_NUMBER:
- flen = strlen(field[i]);
-
- if (flen > 4)
- {
- if (DecodeNumberField(flen, field[i], fmask, &tmask, tm, fsec) != 0)
- return -1;
-
- }
- else
- {
- if (DecodeNumber(flen, field[i], fmask, &tmask, tm, fsec) != 0)
+ case DTK_DATE:
+ if (DecodeDate(field[i], fmask, &tmask, tm) != 0)
return -1;
- }
- break;
-
- case DTK_STRING:
- case DTK_SPECIAL:
- type = DecodeSpecial(i, field[i], &val);
-#ifdef DATEDEBUG
- printf("DecodeDateTime- special field[%d] %s type=%d value=%d\n", i, field[i], type, val);
-#endif
- if (type == IGNORE)
- continue;
-
- tmask = DTK_M(type);
- switch (type)
- {
- case RESERV:
-#ifdef DATEDEBUG
- printf("DecodeDateTime- RESERV field %s value is %d\n", field[i], val);
-#endif
- switch (val)
- {
- case DTK_NOW:
- tmask = (DTK_DATE_M | DTK_TIME_M | DTK_M(TZ));
- *dtype = DTK_DATE;
- GetCurrentTime(tm);
- if (tzp != NULL)
- *tzp = CTimeZone;
- break;
-
- case DTK_YESTERDAY:
- tmask = DTK_DATE_M;
- *dtype = DTK_DATE;
- GetCurrentTime(tm);
- j2date((date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - 1),
- &tm->tm_year, &tm->tm_mon, &tm->tm_mday);
- tm->tm_hour = 0;
- tm->tm_min = 0;
- tm->tm_sec = 0;
- break;
-
- case DTK_TODAY:
- tmask = DTK_DATE_M;
- *dtype = DTK_DATE;
- GetCurrentTime(tm);
- tm->tm_hour = 0;
- tm->tm_min = 0;
- tm->tm_sec = 0;
- break;
-
- case DTK_TOMORROW:
- tmask = DTK_DATE_M;
- *dtype = DTK_DATE;
- GetCurrentTime(tm);
- j2date((date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) + 1),
- &tm->tm_year, &tm->tm_mon, &tm->tm_mday);
- tm->tm_hour = 0;
- tm->tm_min = 0;
- tm->tm_sec = 0;
- break;
-
- case DTK_ZULU:
- tmask = (DTK_TIME_M | DTK_M(TZ));
- *dtype = DTK_DATE;
- tm->tm_hour = 0;
- tm->tm_min = 0;
- tm->tm_sec = 0;
- if (tzp != NULL)
- *tzp = 0;
- break;
-
- default:
- *dtype = val;
- }
-
- break;
-
- case MONTH:
-#ifdef DATEDEBUG
- printf("DecodeDateTime- month field %s value is %d\n", field[i], val);
-#endif
- tm->tm_mon = val;
break;
- /*
- * daylight savings time modifier (solves "MET DST"
- * syntax)
- */
- case DTZMOD:
- tmask |= DTK_M(DTZ);
- tm->tm_isdst = 1;
- if (tzp == NULL)
+ case DTK_TIME:
+ if (DecodeTime(field[i], fmask, &tmask, tm, fsec) != 0)
return -1;
- *tzp += val * 60;
- break;
-
- case DTZ:
/*
- * set mask for TZ here _or_ check for DTZ later when
- * getting default timezone
+ * check upper limit on hours; other limits checked in
+ * DecodeTime()
*/
- tmask |= DTK_M(TZ);
- tm->tm_isdst = 1;
- if (tzp == NULL)
+ if (tm->tm_hour > 23)
return -1;
- *tzp = val * 60;
break;
- case TZ:
- tm->tm_isdst = 0;
+ case DTK_TZ:
if (tzp == NULL)
return -1;
- *tzp = val * 60;
+ if (DecodeTimezone(field[i], tzp) != 0)
+ return -1;
+ tmask = DTK_M(TZ);
break;
- case IGNORE:
- break;
+ case DTK_NUMBER:
+ flen = strlen(field[i]);
- case AMPM:
- mer = val;
- break;
+ if (flen > 4)
+ {
+ if (DecodeNumberField(flen, field[i], fmask, &tmask, tm, fsec) != 0)
+ return -1;
- case ADBC:
- bc = (val == BC);
+ }
+ else
+ {
+ if (DecodeNumber(flen, field[i], fmask, &tmask, tm, fsec) != 0)
+ return -1;
+ }
break;
- case DOW:
- tm->tm_wday = val;
+ case DTK_STRING:
+ case DTK_SPECIAL:
+ type = DecodeSpecial(i, field[i], &val);
+#ifdef DATEDEBUG
+ printf("DecodeDateTime- special field[%d] %s type=%d value=%d\n", i, field[i], type, val);
+#endif
+ if (type == IGNORE)
+ continue;
+
+ tmask = DTK_M(type);
+ switch (type)
+ {
+ case RESERV:
+#ifdef DATEDEBUG
+ printf("DecodeDateTime- RESERV field %s value is %d\n", field[i], val);
+#endif
+ switch (val)
+ {
+ case DTK_NOW:
+ tmask = (DTK_DATE_M | DTK_TIME_M | DTK_M(TZ));
+ *dtype = DTK_DATE;
+ GetCurrentTime(tm);
+ if (tzp != NULL)
+ *tzp = CTimeZone;
+ break;
+
+ case DTK_YESTERDAY:
+ tmask = DTK_DATE_M;
+ *dtype = DTK_DATE;
+ GetCurrentTime(tm);
+ j2date((date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - 1),
+ &tm->tm_year, &tm->tm_mon, &tm->tm_mday);
+ tm->tm_hour = 0;
+ tm->tm_min = 0;
+ tm->tm_sec = 0;
+ break;
+
+ case DTK_TODAY:
+ tmask = DTK_DATE_M;
+ *dtype = DTK_DATE;
+ GetCurrentTime(tm);
+ tm->tm_hour = 0;
+ tm->tm_min = 0;
+ tm->tm_sec = 0;
+ break;
+
+ case DTK_TOMORROW:
+ tmask = DTK_DATE_M;
+ *dtype = DTK_DATE;
+ GetCurrentTime(tm);
+ j2date((date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) + 1),
+ &tm->tm_year, &tm->tm_mon, &tm->tm_mday);
+ tm->tm_hour = 0;
+ tm->tm_min = 0;
+ tm->tm_sec = 0;
+ break;
+
+ case DTK_ZULU:
+ tmask = (DTK_TIME_M | DTK_M(TZ));
+ *dtype = DTK_DATE;
+ tm->tm_hour = 0;
+ tm->tm_min = 0;
+ tm->tm_sec = 0;
+ if (tzp != NULL)
+ *tzp = 0;
+ break;
+
+ default:
+ *dtype = val;
+ }
+
+ break;
+
+ case MONTH:
+#ifdef DATEDEBUG
+ printf("DecodeDateTime- month field %s value is %d\n", field[i], val);
+#endif
+ tm->tm_mon = val;
+ break;
+
+ /*
+ * daylight savings time modifier (solves "MET
+ * DST" syntax)
+ */
+ case DTZMOD:
+ tmask |= DTK_M(DTZ);
+ tm->tm_isdst = 1;
+ if (tzp == NULL)
+ return -1;
+ *tzp += val * 60;
+ break;
+
+ case DTZ:
+
+ /*
+ * set mask for TZ here _or_ check for DTZ later
+ * when getting default timezone
+ */
+ tmask |= DTK_M(TZ);
+ tm->tm_isdst = 1;
+ if (tzp == NULL)
+ return -1;
+ *tzp = val * 60;
+ break;
+
+ case TZ:
+ tm->tm_isdst = 0;
+ if (tzp == NULL)
+ return -1;
+ *tzp = val * 60;
+ break;
+
+ case IGNORE:
+ break;
+
+ case AMPM:
+ mer = val;
+ break;
+
+ case ADBC:
+ bc = (val == BC);
+ break;
+
+ case DOW:
+ tm->tm_wday = val;
+ break;
+
+ default:
+ return -1;
+ }
break;
default:
return -1;
- }
- break;
-
- default:
- return -1;
}
#ifdef DATEDEBUG
@@ -3114,13 +3114,13 @@ DecodeDateTime(char *field[], int ftype[], int nf,
int
DecodeTimeOnly(char *field[], int ftype[], int nf, int *dtype, struct tm * tm, double *fsec)
{
- int fmask,
- tmask,
- type;
- int i;
- int flen,
- val;
- int mer = HR24;
+ int fmask,
+ tmask,
+ type;
+ int i;
+ int flen,
+ val;
+ int mer = HR24;
*dtype = DTK_TIME;
tm->tm_hour = 0;
@@ -3138,71 +3138,71 @@ DecodeTimeOnly(char *field[], int ftype[], int nf, int *dtype, struct tm * tm, d
#endif
switch (ftype[i])
{
- case DTK_TIME:
- if (DecodeTime(field[i], fmask, &tmask, tm, fsec) != 0)
- return -1;
- break;
+ case DTK_TIME:
+ if (DecodeTime(field[i], fmask, &tmask, tm, fsec) != 0)
+ return -1;
+ break;
- case DTK_NUMBER:
- flen = strlen(field[i]);
+ case DTK_NUMBER:
+ flen = strlen(field[i]);
- if (DecodeNumberField(flen, field[i], fmask, &tmask, tm, fsec) != 0)
- return -1;
- break;
+ if (DecodeNumberField(flen, field[i], fmask, &tmask, tm, fsec) != 0)
+ return -1;
+ break;
- case DTK_STRING:
- case DTK_SPECIAL:
- type = DecodeSpecial(i, field[i], &val);
+ case DTK_STRING:
+ case DTK_SPECIAL:
+ type = DecodeSpecial(i, field[i], &val);
#ifdef DATEDEBUG
- printf("DecodeTimeOnly- special field[%d] %s type=%d value=%d\n", i, field[i], type, val);
+ printf("DecodeTimeOnly- special field[%d] %s type=%d value=%d\n", i, field[i], type, val);
#endif
- if (type == IGNORE)
- continue;
+ if (type == IGNORE)
+ continue;
- tmask = DTK_M(type);
- switch (type)
- {
- case RESERV:
+ tmask = DTK_M(type);
+ switch (type)
+ {
+ case RESERV:
#ifdef DATEDEBUG
- printf("DecodeTimeOnly- RESERV field %s value is %d\n", field[i], val);
+ printf("DecodeTimeOnly- RESERV field %s value is %d\n", field[i], val);
#endif
- switch (val)
- {
- case DTK_NOW:
- tmask = DTK_TIME_M;
- *dtype = DTK_TIME;
- GetCurrentTime(tm);
- break;
-
- case DTK_ZULU:
- tmask = (DTK_TIME_M | DTK_M(TZ));
- *dtype = DTK_TIME;
- tm->tm_hour = 0;
- tm->tm_min = 0;
- tm->tm_sec = 0;
- tm->tm_isdst = 0;
- break;
-
- default:
- return -1;
+ switch (val)
+ {
+ case DTK_NOW:
+ tmask = DTK_TIME_M;
+ *dtype = DTK_TIME;
+ GetCurrentTime(tm);
+ break;
+
+ case DTK_ZULU:
+ tmask = (DTK_TIME_M | DTK_M(TZ));
+ *dtype = DTK_TIME;
+ tm->tm_hour = 0;
+ tm->tm_min = 0;
+ tm->tm_sec = 0;
+ tm->tm_isdst = 0;
+ break;
+
+ default:
+ return -1;
+ }
+
+ break;
+
+ case IGNORE:
+ break;
+
+ case AMPM:
+ mer = val;
+ break;
+
+ default:
+ return -1;
}
-
- break;
-
- case IGNORE:
- break;
-
- case AMPM:
- mer = val;
break;
default:
return -1;
- }
- break;
-
- default:
- return -1;
}
if (tmask & fmask)
@@ -3238,15 +3238,15 @@ DecodeTimeOnly(char *field[], int ftype[], int nf, int *dtype, struct tm * tm, d
static int
DecodeDate(char *str, int fmask, int *tmask, struct tm * tm)
{
- double fsec;
+ double fsec;
- int nf = 0;
- int i,
- len;
- int type,
- val,
- dmask = 0;
- char *field[MAXDATEFIELDS];
+ int nf = 0;
+ int i,
+ len;
+ int type,
+ val,
+ dmask = 0;
+ char *field[MAXDATEFIELDS];
/* parse this string... */
while ((*str != '\0') && (nf < MAXDATEFIELDS))
@@ -3290,18 +3290,18 @@ DecodeDate(char *str, int fmask, int *tmask, struct tm * tm)
dmask = DTK_M(type);
switch (type)
{
- case MONTH:
+ case MONTH:
#ifdef DATEDEBUG
- printf("DecodeDate- month field %s value is %d\n", field[i], val);
+ printf("DecodeDate- month field %s value is %d\n", field[i], val);
#endif
- tm->tm_mon = val;
- break;
+ tm->tm_mon = val;
+ break;
- default:
+ default:
#ifdef DATEDEBUG
- printf("DecodeDate- illegal field %s value is %d\n", field[i], val);
+ printf("DecodeDate- illegal field %s value is %d\n", field[i], val);
#endif
- return -1;
+ return -1;
}
if (fmask & dmask)
return -1;
@@ -3345,7 +3345,7 @@ DecodeDate(char *str, int fmask, int *tmask, struct tm * tm)
static int
DecodeTime(char *str, int fmask, int *tmask, struct tm * tm, double *fsec)
{
- char *cp;
+ char *cp;
*tmask = DTK_TIME_M;
@@ -3402,8 +3402,8 @@ DecodeTime(char *str, int fmask, int *tmask, struct tm * tm, double *fsec)
static int
DecodeNumber(int flen, char *str, int fmask, int *tmask, struct tm * tm, double *fsec)
{
- int val;
- char *cp;
+ int val;
+ char *cp;
*tmask = 0;
@@ -3531,7 +3531,7 @@ DecodeNumber(int flen, char *str, int fmask, int *tmask, struct tm * tm, double
static int
DecodeNumberField(int len, char *str, int fmask, int *tmask, struct tm * tm, double *fsec)
{
- char *cp;
+ char *cp;
/* yyyymmdd? */
if (len == 8)
@@ -3616,11 +3616,11 @@ DecodeNumberField(int len, char *str, int fmask, int *tmask, struct tm * tm, dou
static int
DecodeTimezone(char *str, int *tzp)
{
- int tz;
- int hr,
- min;
- char *cp;
- int len;
+ int tz;
+ int hr,
+ min;
+ char *cp;
+ int len;
/* assume leading character is "+" or "-" */
hr = strtol((str + 1), &cp, 10);
@@ -3661,8 +3661,8 @@ DecodeTimezone(char *str, int *tzp)
static int
DecodeSpecial(int field, char *lowtoken, int *val)
{
- int type;
- datetkn *tp;
+ int type;
+ datetkn *tp;
#if USE_DATE_CACHE
if ((datecache[field] != NULL)
@@ -3688,15 +3688,15 @@ DecodeSpecial(int field, char *lowtoken, int *val)
type = tp->type;
switch (type)
{
- case TZ:
- case DTZ:
- case DTZMOD:
- *val = FROMVAL(tp);
- break;
+ case TZ:
+ case DTZ:
+ case DTZMOD:
+ *val = FROMVAL(tp);
+ break;
- default:
- *val = tp->value;
- break;
+ default:
+ *val = tp->value;
+ break;
}
}
@@ -3715,22 +3715,22 @@ DecodeSpecial(int field, char *lowtoken, int *val)
int
DecodeDateDelta(char *field[], int ftype[], int nf, int *dtype, struct tm * tm, double *fsec)
{
- int is_before = FALSE;
+ int is_before = FALSE;
#if READ_FORWARD
- int is_neg = FALSE;
+ int is_neg = FALSE;
#endif
- int fmask = 0,
- tmask,
- type;
- int i,
- ii;
- int flen,
- val;
- char *cp;
- double sec;
+ int fmask = 0,
+ tmask,
+ type;
+ int i,
+ ii;
+ int flen,
+ val;
+ char *cp;
+ double sec;
*dtype = DTK_DELTA;
@@ -3773,137 +3773,137 @@ DecodeDateDelta(char *field[], int ftype[], int nf, int *dtype, struct tm * tm,
#endif
switch (ftype[i])
{
- case DTK_TIME:
- /* already read in forward-scan above so return error */
+ case DTK_TIME:
+ /* already read in forward-scan above so return error */
#if FALSE
- if (DecodeTime(field[i], fmask, &tmask, tm, fsec) != 0)
- return -1;
+ if (DecodeTime(field[i], fmask, &tmask, tm, fsec) != 0)
+ return -1;
#endif
- return -1;
- break;
+ return -1;
+ break;
- case DTK_TZ: /* timezone is a token with a leading sign
+ case DTK_TZ: /* timezone is a token with a leading sign
* character */
#if READ_FORWARD
- is_neg = (*field[i] == '-');
+ is_neg = (*field[i] == '-');
#endif
- case DTK_NUMBER:
- val = strtol(field[i], &cp, 10);
+ case DTK_NUMBER:
+ val = strtol(field[i], &cp, 10);
#if READ_FORWARD
- if (is_neg && (val > 0))
- val = -val;
+ if (is_neg && (val > 0))
+ val = -val;
#endif
- if (*cp == '.')
- {
- *fsec = strtod(cp, NULL);
- if (val < 0)
- *fsec = -(*fsec);
- }
- flen = strlen(field[i]);
- tmask = 0; /* DTK_M(type); */
-
- switch (type)
- {
- case DTK_MICROSEC:
- *fsec += (val * 1e-6);
- break;
-
- case DTK_MILLISEC:
- *fsec += (val * 1e-3);
- break;
-
- case DTK_SECOND:
- tm->tm_sec += val;
- tmask = DTK_M(SECOND);
- break;
-
- case DTK_MINUTE:
- tm->tm_min += val;
- tmask = DTK_M(MINUTE);
- break;
-
- case DTK_HOUR:
- tm->tm_hour += val;
- tmask = DTK_M(HOUR);
- break;
-
- case DTK_DAY:
- tm->tm_mday += val;
- tmask = ((fmask & DTK_M(DAY)) ? 0 : DTK_M(DAY));
- break;
-
- case DTK_WEEK:
- tm->tm_mday += val * 7;
- tmask = ((fmask & DTK_M(DAY)) ? 0 : DTK_M(DAY));
- break;
-
- case DTK_MONTH:
- tm->tm_mon += val;
- tmask = DTK_M(MONTH);
- break;
-
- case DTK_YEAR:
- tm->tm_year += val;
- tmask = ((fmask & DTK_M(YEAR)) ? 0 : DTK_M(YEAR));
- break;
-
- case DTK_DECADE:
- tm->tm_year += val * 10;
- tmask = ((fmask & DTK_M(YEAR)) ? 0 : DTK_M(YEAR));
- break;
-
- case DTK_CENTURY:
- tm->tm_year += val * 100;
- tmask = ((fmask & DTK_M(YEAR)) ? 0 : DTK_M(YEAR));
- break;
+ if (*cp == '.')
+ {
+ *fsec = strtod(cp, NULL);
+ if (val < 0)
+ *fsec = -(*fsec);
+ }
+ flen = strlen(field[i]);
+ tmask = 0; /* DTK_M(type); */
- case DTK_MILLENIUM:
- tm->tm_year += val * 1000;
- tmask = ((fmask & DTK_M(YEAR)) ? 0 : DTK_M(YEAR));
+ switch (type)
+ {
+ case DTK_MICROSEC:
+ *fsec += (val * 1e-6);
+ break;
+
+ case DTK_MILLISEC:
+ *fsec += (val * 1e-3);
+ break;
+
+ case DTK_SECOND:
+ tm->tm_sec += val;
+ tmask = DTK_M(SECOND);
+ break;
+
+ case DTK_MINUTE:
+ tm->tm_min += val;
+ tmask = DTK_M(MINUTE);
+ break;
+
+ case DTK_HOUR:
+ tm->tm_hour += val;
+ tmask = DTK_M(HOUR);
+ break;
+
+ case DTK_DAY:
+ tm->tm_mday += val;
+ tmask = ((fmask & DTK_M(DAY)) ? 0 : DTK_M(DAY));
+ break;
+
+ case DTK_WEEK:
+ tm->tm_mday += val * 7;
+ tmask = ((fmask & DTK_M(DAY)) ? 0 : DTK_M(DAY));
+ break;
+
+ case DTK_MONTH:
+ tm->tm_mon += val;
+ tmask = DTK_M(MONTH);
+ break;
+
+ case DTK_YEAR:
+ tm->tm_year += val;
+ tmask = ((fmask & DTK_M(YEAR)) ? 0 : DTK_M(YEAR));
+ break;
+
+ case DTK_DECADE:
+ tm->tm_year += val * 10;
+ tmask = ((fmask & DTK_M(YEAR)) ? 0 : DTK_M(YEAR));
+ break;
+
+ case DTK_CENTURY:
+ tm->tm_year += val * 100;
+ tmask = ((fmask & DTK_M(YEAR)) ? 0 : DTK_M(YEAR));
+ break;
+
+ case DTK_MILLENIUM:
+ tm->tm_year += val * 1000;
+ tmask = ((fmask & DTK_M(YEAR)) ? 0 : DTK_M(YEAR));
+ break;
+
+ default:
+ return -1;
+ }
break;
- default:
- return -1;
- }
- break;
-
- case DTK_STRING:
- case DTK_SPECIAL:
- type = DecodeUnits(i, field[i], &val);
+ case DTK_STRING:
+ case DTK_SPECIAL:
+ type = DecodeUnits(i, field[i], &val);
#ifdef DATEDEBUG
- printf("DecodeDateDelta- special field[%d] %s type=%d value=%d\n", i, field[i], type, val);
+ printf("DecodeDateDelta- special field[%d] %s type=%d value=%d\n", i, field[i], type, val);
#endif
- if (type == IGNORE)
- continue;
+ if (type == IGNORE)
+ continue;
- tmask = 0; /* DTK_M(type); */
- switch (type)
- {
- case UNITS:
+ tmask = 0; /* DTK_M(type); */
+ switch (type)
+ {
+ case UNITS:
#ifdef DATEDEBUG
- printf("DecodeDateDelta- UNITS field %s value is %d\n", field[i], val);
+ printf("DecodeDateDelta- UNITS field %s value is %d\n", field[i], val);
#endif
- type = val;
- break;
+ type = val;
+ break;
- case AGO:
- is_before = TRUE;
- type = val;
- break;
+ case AGO:
+ is_before = TRUE;
+ type = val;
+ break;
+
+ case RESERV:
+ tmask = (DTK_DATE_M || DTK_TIME_M);
+ *dtype = val;
+ break;
- case RESERV:
- tmask = (DTK_DATE_M || DTK_TIME_M);
- *dtype = val;
+ default:
+ return -1;
+ }
break;
default:
return -1;
- }
- break;
-
- default:
- return -1;
}
#ifdef DATEDEBUG
@@ -3951,8 +3951,8 @@ DecodeDateDelta(char *field[], int ftype[], int nf, int *dtype, struct tm * tm,
static int
DecodeUnits(int field, char *lowtoken, int *val)
{
- int type;
- datetkn *tp;
+ int type;
+ datetkn *tp;
#if USE_DATE_CACHE
if ((deltacache[field] != NULL)
@@ -3998,8 +3998,8 @@ static datetkn *
datebsearch(char *key, datetkn * base, unsigned int nel)
{
register datetkn *last = base + nel - 1,
- *position;
- register int result;
+ *position;
+ register int result;
while (last >= base)
{
@@ -4074,7 +4074,7 @@ int
EncodeDateOnly(struct tm * tm, int style, char *str)
{
#if FALSE
- int day;
+ int day;
#endif
@@ -4186,7 +4186,7 @@ EncodeDateOnly(struct tm * tm, int style, char *str)
int
EncodeTimeOnly(struct tm * tm, double fsec, int style, char *str)
{
- double sec;
+ double sec;
if ((tm->tm_hour < 0) || (tm->tm_hour > 24))
return -1;
@@ -4210,10 +4210,10 @@ EncodeTimeOnly(struct tm * tm, double fsec, int style, char *str)
int
EncodeDateTime(struct tm * tm, double fsec, int *tzp, char **tzn, int style, char *str)
{
- int day,
- hour,
- min;
- double sec;
+ int day,
+ hour,
+ min;
+ double sec;
if ((tm->tm_mon < 1) || (tm->tm_mon > 12))
return -1;
@@ -4372,9 +4372,9 @@ EncodeDateTime(struct tm * tm, double fsec, int *tzp, char **tzn, int style, cha
int
EncodeTimeSpan(struct tm * tm, double fsec, int style, char *str)
{
- int is_before = FALSE;
- int is_nonzero = FALSE;
- char *cp;
+ int is_before = FALSE;
+ int is_nonzero = FALSE;
+ char *cp;
strcpy(str, "@");
cp = str + strlen(str);
@@ -4465,9 +4465,9 @@ datetime_is_epoch(double j)
{
static union
{
- double epoch;
- unsigned char c[8];
- } u;
+ double epoch;
+ unsigned char c[8];
+ } u;
u.c[0] = 0x80; /* sign bit */
u.c[1] = 0x10; /* DBL_MIN */
@@ -4479,9 +4479,9 @@ datetime_is_current(double j)
{
static union
{
- double current;
- unsigned char c[8];
- } u;
+ double current;
+ unsigned char c[8];
+ } u;
u.c[1] = 0x10; /* DBL_MIN */
diff --git a/src/backend/utils/adt/filename.c b/src/backend/utils/adt/filename.c
index 445de98a77a..e8bfba41c96 100644
--- a/src/backend/utils/adt/filename.c
+++ b/src/backend/utils/adt/filename.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/filename.c,v 1.9 1997/09/07 04:50:14 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/filename.c,v 1.10 1997/09/08 02:30:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -22,11 +22,11 @@
#include <miscadmin.h>
#include "utils/builtins.h" /* where function declarations go */
-char *
+char *
filename_in(char *file)
{
- char *str;
- int ind = 0;
+ char *str;
+ int ind = 0;
/*
* XXX - HACK CITY --- REDO should let the shell do expansions
@@ -41,8 +41,8 @@ filename_in(char *file)
{
/* Home directory */
- char *userName;
- struct passwd *pw;
+ char *userName;
+ struct passwd *pw;
userName = GetPgUserName();
@@ -59,10 +59,10 @@ filename_in(char *file)
else
{
/* Someone else's directory */
- char name[16],
- *p;
- struct passwd *pw;
- int len;
+ char name[16],
+ *p;
+ struct passwd *pw;
+ int len;
if ((p = (char *) strchr(file, '/')) == NULL)
{
@@ -89,10 +89,10 @@ filename_in(char *file)
}
else if (file[0] == '$')
{ /* $POSTGRESHOME, etc. expand it. */
- char environment[80],
- *envirp,
- *p;
- int len;
+ char environment[80],
+ *envirp,
+ *p;
+ int len;
if ((p = (char *) strchr(file, '/')) == NULL)
{
@@ -123,10 +123,10 @@ filename_in(char *file)
return (str);
}
-char *
+char *
filename_out(char *s)
{
- char *ret;
+ char *ret;
if (!s)
return ((char *) NULL);
diff --git a/src/backend/utils/adt/float.c b/src/backend/utils/adt/float.c
index 32d78fb2ba7..03bd767dc65 100644
--- a/src/backend/utils/adt/float.c
+++ b/src/backend/utils/adt/float.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.18 1997/09/07 04:50:15 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.19 1997/09/08 02:30:41 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -81,36 +81,36 @@
/* NS3.3 has conflicting declarations of these in <math.h> */
#ifndef atof
-extern double atof(const char *p);
+extern double atof(const char *p);
#endif
#ifndef HAVE_CBRT
#define cbrt my_cbrt
-static double cbrt(double x);
+static double cbrt(double x);
#else
#if !defined(nextstep)
-extern double cbrt(double x);
+extern double cbrt(double x);
#endif
#endif
#ifndef HAVE_RINT
#define rint my_rint
-static double rint(double x);
+static double rint(double x);
#else
-extern double rint(double x);
+extern double rint(double x);
#endif
#ifndef HAVE_ISINF
#define isinf my_isinf
-static int isinf(double x);
+static int isinf(double x);
#else
-extern int isinf(double x);
+extern int isinf(double x);
#endif
@@ -203,9 +203,9 @@ CheckFloat8Val(double val)
float32
float4in(char *num)
{
- float32 result = (float32) palloc(sizeof(float32data));
- double val;
- char *endptr;
+ float32 result = (float32) palloc(sizeof(float32data));
+ double val;
+ char *endptr;
errno = 0;
val = strtod(num, &endptr);
@@ -227,10 +227,10 @@ float4in(char *num)
* float4out - converts a float4 number to a string
* using a standard output format
*/
-char *
+char *
float4out(float32 num)
{
- char *ascii = (char *) palloc(MAXFLOATWIDTH + 1);
+ char *ascii = (char *) palloc(MAXFLOATWIDTH + 1);
if (!num)
return strcpy(ascii, "(null)");
@@ -250,9 +250,9 @@ float4out(float32 num)
float64
float8in(char *num)
{
- float64 result = (float64) palloc(sizeof(float64data));
- double val;
- char *endptr;
+ float64 result = (float64) palloc(sizeof(float64data));
+ double val;
+ char *endptr;
errno = 0;
val = strtod(num, &endptr);
@@ -269,10 +269,10 @@ float8in(char *num)
* float8out - converts float8 number to a string
* using a standard output format
*/
-char *
+char *
float8out(float64 num)
{
- char *ascii = (char *) palloc(MAXDOUBLEWIDTH + 1);
+ char *ascii = (char *) palloc(MAXDOUBLEWIDTH + 1);
if (!num)
return strcpy(ascii, "(null)");
@@ -301,8 +301,8 @@ float8out(float64 num)
float32
float4abs(float32 arg1)
{
- float32 result;
- double val;
+ float32 result;
+ double val;
if (!arg1)
return (float32) NULL;
@@ -322,8 +322,8 @@ float4abs(float32 arg1)
float32
float4um(float32 arg1)
{
- float32 result;
- double val;
+ float32 result;
+ double val;
if (!arg1)
return (float32) NULL;
@@ -339,7 +339,7 @@ float4um(float32 arg1)
float32
float4larger(float32 arg1, float32 arg2)
{
- float32 result;
+ float32 result;
if (!arg1 || !arg2)
return (float32) NULL;
@@ -353,7 +353,7 @@ float4larger(float32 arg1, float32 arg2)
float32
float4smaller(float32 arg1, float32 arg2)
{
- float32 result;
+ float32 result;
if (!arg1 || !arg2)
return (float32) NULL;
@@ -376,8 +376,8 @@ float4smaller(float32 arg1, float32 arg2)
float64
float8abs(float64 arg1)
{
- float64 result;
- double val;
+ float64 result;
+ double val;
if (!arg1)
return (float64) NULL;
@@ -397,8 +397,8 @@ float8abs(float64 arg1)
float64
float8um(float64 arg1)
{
- float64 result;
- double val;
+ float64 result;
+ double val;
if (!arg1)
return (float64) NULL;
@@ -414,7 +414,7 @@ float8um(float64 arg1)
float64
float8larger(float64 arg1, float64 arg2)
{
- float64 result;
+ float64 result;
if (!arg1 || !arg2)
return (float64) NULL;
@@ -428,7 +428,7 @@ float8larger(float64 arg1, float64 arg2)
float64
float8smaller(float64 arg1, float64 arg2)
{
- float64 result;
+ float64 result;
if (!arg1 || !arg2)
return (float64) NULL;
@@ -456,8 +456,8 @@ float8smaller(float64 arg1, float64 arg2)
float32
float4pl(float32 arg1, float32 arg2)
{
- float32 result;
- double val;
+ float32 result;
+ double val;
if (!arg1 || !arg2)
return (float32) NULL;
@@ -474,8 +474,8 @@ float4pl(float32 arg1, float32 arg2)
float32
float4mi(float32 arg1, float32 arg2)
{
- float32 result;
- double val;
+ float32 result;
+ double val;
if (!arg1 || !arg2)
return (float32) NULL;
@@ -491,8 +491,8 @@ float4mi(float32 arg1, float32 arg2)
float32
float4mul(float32 arg1, float32 arg2)
{
- float32 result;
- double val;
+ float32 result;
+ double val;
if (!arg1 || !arg2)
return (float32) NULL;
@@ -508,8 +508,8 @@ float4mul(float32 arg1, float32 arg2)
float32
float4div(float32 arg1, float32 arg2)
{
- float32 result;
- double val;
+ float32 result;
+ double val;
if (!arg1 || !arg2)
return (float32) NULL;
@@ -528,7 +528,7 @@ float4div(float32 arg1, float32 arg2)
float32
float4inc(float32 arg1)
{
- double val;
+ double val;
if (!arg1)
return (float32) NULL;
@@ -549,8 +549,8 @@ float4inc(float32 arg1)
float64
float8pl(float64 arg1, float64 arg2)
{
- float64 result;
- double val;
+ float64 result;
+ double val;
if (!arg1 || !arg2)
return (float64) NULL;
@@ -566,8 +566,8 @@ float8pl(float64 arg1, float64 arg2)
float64
float8mi(float64 arg1, float64 arg2)
{
- float64 result;
- double val;
+ float64 result;
+ double val;
if (!arg1 || !arg2)
return (float64) NULL;
@@ -583,8 +583,8 @@ float8mi(float64 arg1, float64 arg2)
float64
float8mul(float64 arg1, float64 arg2)
{
- float64 result;
- double val;
+ float64 result;
+ double val;
if (!arg1 || !arg2)
return (float64) NULL;
@@ -600,8 +600,8 @@ float8mul(float64 arg1, float64 arg2)
float64
float8div(float64 arg1, float64 arg2)
{
- float64 result;
- double val;
+ float64 result;
+ double val;
if (!arg1 || !arg2)
return (float64) NULL;
@@ -620,7 +620,7 @@ float8div(float64 arg1, float64 arg2)
float64
float8inc(float64 arg1)
{
- double val;
+ double val;
if (!arg1)
return (float64) NULL;
@@ -765,7 +765,7 @@ float8ge(float64 arg1, float64 arg2)
float64
ftod(float32 num)
{
- float64 result;
+ float64 result;
if (!num)
return (float64) NULL;
@@ -783,7 +783,7 @@ ftod(float32 num)
float32
dtof(float64 num)
{
- float32 result;
+ float32 result;
if (!num)
return (float32) NULL;
@@ -803,7 +803,7 @@ dtof(float64 num)
int32
dtoi4(float64 num)
{
- int32 result;
+ int32 result;
if (!num)
elog(WARN, "dtoi4: unable to convert null", NULL);
@@ -822,7 +822,7 @@ dtoi4(float64 num)
int16
dtoi2(float64 num)
{
- int16 result;
+ int16 result;
if (!num)
elog(WARN, "dtoi2: unable to convert null", NULL);
@@ -841,7 +841,7 @@ dtoi2(float64 num)
float64
i4tod(int32 num)
{
- float64 result;
+ float64 result;
result = (float64) palloc(sizeof(float64data));
@@ -856,7 +856,7 @@ i4tod(int32 num)
float64
i2tod(int16 num)
{
- float64 result;
+ float64 result;
result = (float64) palloc(sizeof(float64data));
@@ -871,7 +871,7 @@ i2tod(int16 num)
int32
ftoi4(float32 num)
{
- int32 result;
+ int32 result;
if (!num)
elog(WARN, "ftoi4: unable to convert null", NULL);
@@ -890,7 +890,7 @@ ftoi4(float32 num)
int16
ftoi2(float32 num)
{
- int16 result;
+ int16 result;
if (!num)
elog(WARN, "ftoi2: unable to convert null", NULL);
@@ -909,7 +909,7 @@ ftoi2(float32 num)
float32
i4tof(int32 num)
{
- float32 result;
+ float32 result;
result = (float32) palloc(sizeof(float32data));
@@ -924,7 +924,7 @@ i4tof(int32 num)
float32
i2tof(int16 num)
{
- float32 result;
+ float32 result;
result = (float32) palloc(sizeof(float32data));
@@ -945,8 +945,8 @@ i2tof(int16 num)
float64
dround(float64 arg1)
{
- float64 result;
- double tmp;
+ float64 result;
+ double tmp;
if (!arg1)
return (float64) NULL;
@@ -969,8 +969,8 @@ dround(float64 arg1)
float64
dtrunc(float64 arg1)
{
- float64 result;
- double tmp;
+ float64 result;
+ double tmp;
if (!arg1)
return (float64) NULL;
@@ -992,8 +992,8 @@ dtrunc(float64 arg1)
float64
dsqrt(float64 arg1)
{
- float64 result;
- double tmp;
+ float64 result;
+ double tmp;
if (!arg1)
return (float64) NULL;
@@ -1012,8 +1012,8 @@ dsqrt(float64 arg1)
float64
dcbrt(float64 arg1)
{
- float64 result;
- double tmp;
+ float64 result;
+ double tmp;
if (!arg1)
return (float64) NULL;
@@ -1032,9 +1032,9 @@ dcbrt(float64 arg1)
float64
dpow(float64 arg1, float64 arg2)
{
- float64 result;
- double tmp1,
- tmp2;
+ float64 result;
+ double tmp1,
+ tmp2;
if (!arg1 || !arg2)
return (float64) NULL;
@@ -1065,8 +1065,8 @@ dpow(float64 arg1, float64 arg2)
float64
dexp(float64 arg1)
{
- float64 result;
- double tmp;
+ float64 result;
+ double tmp;
if (!arg1)
return (float64) NULL;
@@ -1097,8 +1097,8 @@ dexp(float64 arg1)
float64
dlog1(float64 arg1)
{
- float64 result;
- double tmp;
+ float64 result;
+ double tmp;
if (!arg1)
return (float64) NULL;
@@ -1132,7 +1132,7 @@ dlog1(float64 arg1)
float64
float48pl(float32 arg1, float64 arg2)
{
- float64 result;
+ float64 result;
if (!arg1 || !arg2)
return (float64) NULL;
@@ -1147,7 +1147,7 @@ float48pl(float32 arg1, float64 arg2)
float64
float48mi(float32 arg1, float64 arg2)
{
- float64 result;
+ float64 result;
if (!arg1 || !arg2)
return (float64) NULL;
@@ -1162,7 +1162,7 @@ float48mi(float32 arg1, float64 arg2)
float64
float48mul(float32 arg1, float64 arg2)
{
- float64 result;
+ float64 result;
if (!arg1 || !arg2)
return (float64) NULL;
@@ -1177,7 +1177,7 @@ float48mul(float32 arg1, float64 arg2)
float64
float48div(float32 arg1, float64 arg2)
{
- float64 result;
+ float64 result;
if (!arg1 || !arg2)
return (float64) NULL;
@@ -1201,7 +1201,7 @@ float48div(float32 arg1, float64 arg2)
float64
float84pl(float64 arg1, float32 arg2)
{
- float64 result;
+ float64 result;
if (!arg1 || !arg2)
return (float64) NULL;
@@ -1216,7 +1216,7 @@ float84pl(float64 arg1, float32 arg2)
float64
float84mi(float64 arg1, float32 arg2)
{
- float64 result;
+ float64 result;
if (!arg1 || !arg2)
return (float64) NULL;
@@ -1232,7 +1232,7 @@ float64
float84mul(float64 arg1, float32 arg2)
{
- float64 result;
+ float64 result;
if (!arg1 || !arg2)
return (float64) NULL;
@@ -1247,7 +1247,7 @@ float84mul(float64 arg1, float32 arg2)
float64
float84div(float64 arg1, float32 arg2)
{
- float64 result;
+ float64 result;
if (!arg1 || !arg2)
return (float64) NULL;
@@ -1415,8 +1415,8 @@ static const double
#else
static double
#endif
- one = 1.0,
- TWO52[2] = {
+ one = 1.0,
+ TWO52[2] = {
4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
-4.50359962737049600000e+15,/* 0xC3300000, 0x00000000 */
};
@@ -1427,18 +1427,18 @@ rint(double x)
#else
static double
rint(x)
-double x;
+double x;
#endif
{
- int i0,
- n0,
- j0,
- sx;
- unsigned i,
- i1;
- double w,
- t;
+ int i0,
+ n0,
+ j0,
+ sx;
+ unsigned i,
+ i1;
+ double w,
+ t;
n0 = (*((int *) &one) >> 29) ^ 1;
i0 = *(n0 + (int *) &x);
@@ -1505,10 +1505,10 @@ double x;
static
double
cbrt(x)
-double x;
+double x;
{
- int isneg = (x < 0.0);
- double tmpres = pow(fabs(x), (double) 1.0 / (double) 3.0);
+ int isneg = (x < 0.0);
+ double tmpres = pow(fabs(x), (double) 1.0 / (double) 3.0);
return (isneg ? -tmpres : tmpres);
}
@@ -1525,9 +1525,9 @@ double x;
static int
isinf(x)
-double x;
+double x;
{
- int fpclass = class(x);
+ int fpclass = class(x);
if (fpclass == FP_PLUS_INF)
return (1);
@@ -1542,9 +1542,9 @@ double x;
#include <fp_class.h>
static int
isinf(x)
-double x;
+double x;
{
- int fpclass = fp_class_d(x);
+ int fpclass = fp_class_d(x);
if (fpclass == FP_POS_INF)
return (1);
@@ -1559,9 +1559,9 @@ double x;
#include <fp_class.h>
static int
isinf(x)
-double x;
+double x;
{
- int fpclass = fp_class(x);
+ int fpclass = fp_class(x);
if (fpclass == FP_POS_INF)
return (1);
@@ -1577,19 +1577,19 @@ double x;
#include <ieeefp.h>
static int
isinf(d)
-double d;
+double d;
{
- fpclass_t type = fpclass(d);
+ fpclass_t type = fpclass(d);
switch (type)
{
- case FP_SNAN:
- case FP_QNAN:
- case FP_NINF:
- case FP_PINF:
- return (1);
- default:
- break;
+ case FP_SNAN:
+ case FP_QNAN:
+ case FP_NINF:
+ case FP_PINF:
+ return (1);
+ default:
+ break;
}
return (0);
@@ -1601,19 +1601,19 @@ double d;
#include <ieeefp.h>
static int
isinf(d)
-double d;
+double d;
{
- fpclass_t type = fpclass(d);
+ fpclass_t type = fpclass(d);
switch (type)
{
- case FP_SNAN:
- case FP_QNAN:
- case FP_NINF:
- case FP_PINF:
- return (1);
- default:
- break;
+ case FP_SNAN:
+ case FP_QNAN:
+ case FP_NINF:
+ case FP_PINF:
+ return (1);
+ default:
+ break;
}
return (0);
diff --git a/src/backend/utils/adt/geo_ops.c b/src/backend/utils/adt/geo_ops.c
index 71b478788ef..ac3bb853981 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.20 1997/09/07 04:50:18 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.21 1997/09/08 02:30:42 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,38 +28,38 @@
#define PI 3.1415926536
#endif
-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);
+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);
/*
@@ -80,7 +80,7 @@ static LINE *line_construct_pp(Point * pt1, Point * pt2);
#define P_MAXDIG DBL_DIG
#define P_MAXLEN (2*(P_MAXDIG+7)+1)
-static int digits8 = P_MAXDIG;
+static int digits8 = P_MAXDIG;
/*
@@ -111,7 +111,7 @@ static int digits8 = P_MAXDIG;
static int
single_decode(char *str, float8 * x, char **s)
{
- char *cp;
+ char *cp;
if (!PointerIsValid(str))
return (FALSE);
@@ -143,8 +143,8 @@ single_encode(float8 x, char *str)
static int
pair_decode(char *str, float8 * x, float8 * y, char **s)
{
- int has_delim;
- char *cp;
+ int has_delim;
+ char *cp;
if (!PointerIsValid(str))
return (FALSE);
@@ -194,10 +194,10 @@ pair_encode(float8 x, float8 y, char *str)
static int
path_decode(int opentype, int npts, char *str, int *isopen, char **ss, Point * p)
{
- int depth = 0;
- char *s,
- *cp;
- int i;
+ int depth = 0;
+ char *s,
+ *cp;
+ int i;
s = str;
while (isspace(*s))
@@ -263,25 +263,25 @@ path_decode(int opentype, int npts, char *str, int *isopen, char **ss, Point * p
return (TRUE);
} /* path_decode() */
-static char *
+static char *
path_encode(bool closed, int npts, Point * pt)
{
- char *result = PALLOC(npts * (P_MAXLEN + 3) + 2);
+ char *result = PALLOC(npts * (P_MAXLEN + 3) + 2);
- char *cp;
- int i;
+ char *cp;
+ int i;
cp = result;
switch (closed)
{
- case TRUE:
- *cp++ = LDELIM;
- break;
- case FALSE:
- *cp++ = LDELIM_EP;
- break;
- default:
- break;
+ case TRUE:
+ *cp++ = LDELIM;
+ break;
+ case FALSE:
+ *cp++ = LDELIM_EP;
+ break;
+ default:
+ break;
}
for (i = 0; i < npts; i++)
@@ -297,14 +297,14 @@ path_encode(bool closed, int npts, Point * pt)
cp--;
switch (closed)
{
- case TRUE:
- *cp++ = RDELIM;
- break;
- case FALSE:
- *cp++ = RDELIM_EP;
- break;
- default:
- break;
+ case TRUE:
+ *cp++ = RDELIM;
+ break;
+ case FALSE:
+ *cp++ = RDELIM_EP;
+ break;
+ default:
+ break;
}
*cp = '\0';
@@ -321,7 +321,7 @@ path_encode(bool closed, int npts, Point * pt)
static int
pair_count(char *s, char delim)
{
- int ndelim = 0;
+ int ndelim = 0;
while ((s = strchr(s, delim)) != NULL)
{
@@ -347,15 +347,15 @@ pair_count(char *s, char delim)
* "(f8, f8), (f8, f8)"
* also supports the older style "(f8, f8, f8, f8)"
*/
-BOX *
+BOX *
box_in(char *str)
{
- BOX *box = PALLOCTYPE(BOX);
+ BOX *box = PALLOCTYPE(BOX);
- int isopen;
- char *s;
- double x,
- y;
+ int isopen;
+ char *s;
+ double x,
+ y;
if (!PointerIsValid(str))
elog(WARN, " Bad (null) box external representation", NULL);
@@ -383,7 +383,7 @@ box_in(char *str)
/* box_out - convert a box to external form.
*/
-char *
+char *
box_out(BOX * box)
{
if (!PointerIsValid(box))
@@ -395,10 +395,10 @@ box_out(BOX * box)
/* box_construct - fill in a new box.
*/
-static BOX *
+static BOX *
box_construct(double x1, double x2, double y1, double y2)
{
- BOX *result = PALLOCTYPE(BOX);
+ BOX *result = PALLOCTYPE(BOX);
return (box_fill(result, x1, x2, y1, y2));
}
@@ -406,7 +406,7 @@ box_construct(double x1, double x2, double y1, double y2)
/* box_fill - fill in a static box
*/
-static BOX *
+static BOX *
box_fill(BOX * result, double x1, double x2, double y1, double y2)
{
if (x1 > x2)
@@ -436,10 +436,10 @@ box_fill(BOX * result, double x1, double x2, double y1, double y2)
/* box_copy - copy a box
*/
-static BOX *
+static BOX *
box_copy(BOX * box)
{
- BOX *result = PALLOCTYPE(BOX);
+ BOX *result = PALLOCTYPE(BOX);
memmove((char *) result, (char *) box, sizeof(BOX));
@@ -592,10 +592,10 @@ box_ge(BOX * box1, BOX * box2)
/* box_area - returns the area of the box.
*/
-double *
+double *
box_area(BOX * box)
{
- double *result = PALLOCTYPE(double);
+ double *result = PALLOCTYPE(double);
*result = box_wd(box) * box_ht(box);
@@ -606,10 +606,10 @@ box_area(BOX * box)
/* box_width - returns the width of the box
* (horizontal magnitude).
*/
-double *
+double *
box_width(BOX * box)
{
- double *result = PALLOCTYPE(double);
+ double *result = PALLOCTYPE(double);
*result = box->high.x - box->low.x;
@@ -620,10 +620,10 @@ box_width(BOX * box)
/* box_height - returns the height of the box
* (vertical magnitude).
*/
-double *
+double *
box_height(BOX * box)
{
- double *result = PALLOCTYPE(double);
+ double *result = PALLOCTYPE(double);
*result = box->high.y - box->low.y;
@@ -634,12 +634,12 @@ box_height(BOX * box)
/* box_distance - returns the distance between the
* center points of two boxes.
*/
-double *
+double *
box_distance(BOX * box1, BOX * box2)
{
- double *result = PALLOCTYPE(double);
- Point *a,
- *b;
+ double *result = PALLOCTYPE(double);
+ Point *a,
+ *b;
a = box_center(box1);
b = box_center(box2);
@@ -653,10 +653,10 @@ box_distance(BOX * box1, BOX * box2)
/* box_center - returns the center point of the box.
*/
-Point *
+Point *
box_center(BOX * box)
{
- Point *result = PALLOCTYPE(Point);
+ Point *result = PALLOCTYPE(Point);
result->x = (box->high.x + box->low.x) / 2.0;
result->y = (box->high.y + box->low.y) / 2.0;
@@ -701,9 +701,9 @@ box_ht(BOX * box)
static double
box_dt(BOX * box1, BOX * box2)
{
- double result;
- Point *a,
- *b;
+ double result;
+ Point *a,
+ *b;
a = box_center(box1);
b = box_center(box2);
@@ -724,10 +724,10 @@ box_dt(BOX * box1, BOX * box2)
* returns the overlapping portion of two boxes,
* or NULL if they do not intersect.
*/
-BOX *
+BOX *
box_intersect(BOX * box1, BOX * box2)
{
- BOX *result;
+ BOX *result;
if (!box_overlap(box1, box2))
return (NULL);
@@ -748,11 +748,11 @@ box_intersect(BOX * box1, BOX * box2)
* positive-slope diagonal of "box".
* provided, of course, we have LSEGs.
*/
-LSEG *
+LSEG *
box_diagonal(BOX * box)
{
- Point p1,
- p2;
+ Point p1,
+ p2;
p1.x = box->high.x;
p1.y = box->high.y;
@@ -776,10 +776,10 @@ box_diagonal(BOX * box)
* Internal form: Ax+By+C=0
*---------------------------------------------------------*/
-static LINE * /* point-slope */
+static LINE * /* point-slope */
line_construct_pm(Point * pt, double m)
{
- LINE *result = PALLOCTYPE(LINE);
+ LINE *result = PALLOCTYPE(LINE);
/* use "mx - y + yinter = 0" */
result->A = m;
@@ -792,10 +792,10 @@ line_construct_pm(Point * pt, double m)
} /* line_construct_pm() */
-static LINE * /* two points */
+static LINE * /* two points */
line_construct_pp(Point * pt1, Point * pt2)
{
- LINE *result = PALLOCTYPE(LINE);
+ LINE *result = PALLOCTYPE(LINE);
if (FPeq(pt1->x, pt2->x))
{ /* vertical */
@@ -910,7 +910,7 @@ line_horizontal(LINE * line)
bool
line_eq(LINE * l1, LINE * l2)
{
- double k;
+ double k;
if (!FPzero(l2->A))
k = l1->A / l2->A;
@@ -932,11 +932,11 @@ line_eq(LINE * l1, LINE * l2)
* Line arithmetic routines.
*---------------------------------------------------------*/
-double * /* distance between l1, l2 */
+double * /* distance between l1, l2 */
line_distance(LINE * l1, LINE * l2)
{
- double *result = PALLOCTYPE(double);
- Point *tmp;
+ double *result = PALLOCTYPE(double);
+ Point *tmp;
if (line_intersect(l1, l2))
{
@@ -957,12 +957,12 @@ line_distance(LINE * l1, LINE * l2)
/* line_interpt()
* Point where two lines l1, l2 intersect (if any)
*/
-static Point *
+static Point *
line_interpt(LINE * l1, LINE * l2)
{
- Point *result;
- double x,
- y;
+ Point *result;
+ double x,
+ y;
if (line_parallel(l1, l2))
return (NULL);
@@ -1040,16 +1040,16 @@ line_interpt(LINE * l1, LINE * l2)
* "(closed, npts, xcoord, ycoord,... )"
*---------------------------------------------------------*/
-PATH *
+PATH *
path_in(char *str)
{
- PATH *path;
+ PATH *path;
- int isopen;
- char *s;
- int npts;
- int size;
- int depth = 0;
+ int isopen;
+ char *s;
+ int npts;
+ int size;
+ int depth = 0;
if (!PointerIsValid(str))
elog(WARN, "Bad (null) path external representation");
@@ -1084,7 +1084,7 @@ path_in(char *str)
} /* path_in() */
-char *
+char *
path_out(PATH * path)
{
if (!PointerIsValid(path))
@@ -1165,10 +1165,10 @@ path_npoints(PATH * path)
return (path->npts);
} /* path_npoints() */
-PATH *
+PATH *
path_close(PATH * path)
{
- PATH *result;
+ PATH *result;
if (!PointerIsValid(path))
return (NULL);
@@ -1180,10 +1180,10 @@ path_close(PATH * path)
} /* path_close() */
-PATH *
+PATH *
path_open(PATH * path)
{
- PATH *result;
+ PATH *result;
if (!PointerIsValid(path))
return (NULL);
@@ -1195,11 +1195,11 @@ path_open(PATH * path)
} /* path_open() */
-PATH *
+PATH *
path_copy(PATH * path)
{
- PATH *result;
- int size;
+ PATH *result;
+ int size;
size = offsetof(PATH, p[0]) + (sizeof(path->p[0]) * path->npts);
result = PALLOC(size);
@@ -1217,12 +1217,12 @@ path_copy(PATH * path)
bool
path_inter(PATH * p1, PATH * p2)
{
- BOX b1,
- b2;
- int i,
- j;
- LSEG seg1,
- seg2;
+ BOX b1,
+ b2;
+ int i,
+ j;
+ LSEG seg1,
+ seg2;
b1.high.x = b1.low.x = p1->p[0].x;
b1.high.y = b1.low.y = p1->p[0].y;
@@ -1263,15 +1263,15 @@ path_inter(PATH * p1, PATH * p2)
/* this essentially does a cartesian product of the lsegs in the
two paths, and finds the min distance between any two lsegs */
-double *
+double *
path_distance(PATH * p1, PATH * p2)
{
- double *min = NULL,
- *tmp;
- int i,
- j;
- LSEG seg1,
- seg2;
+ double *min = NULL,
+ *tmp;
+ int i,
+ j;
+ LSEG seg1,
+ seg2;
/*
statlseg_construct(&seg1, &p1->p[0], &p1->p[1]);
@@ -1306,11 +1306,11 @@ path_distance(PATH * p1, PATH * p2)
* "Arithmetic" operations.
*---------------------------------------------------------*/
-double *
+double *
path_length(PATH * path)
{
- double *result;
- int i;
+ double *result;
+ int i;
result = PALLOCTYPE(double);
@@ -1326,8 +1326,8 @@ path_length(PATH * path)
double
path_ln(PATH * path)
{
- double result;
- int i;
+ double result;
+ int i;
result = 0;
for (i = 0; i < (path->npts - 1); i++)
@@ -1351,14 +1351,14 @@ path_ln(PATH * path)
* "x,y"
*---------------------------------------------------------*/
-Point *
+Point *
point_in(char *str)
{
- Point *point;
+ Point *point;
- double x,
- y;
- char *s;
+ double x,
+ y;
+ char *s;
if (!PointerIsValid(str))
elog(WARN, "Bad (null) point external representation");
@@ -1374,7 +1374,7 @@ point_in(char *str)
return (point);
} /* point_in() */
-char *
+char *
point_out(Point * pt)
{
if (!PointerIsValid(pt))
@@ -1384,10 +1384,10 @@ point_out(Point * pt)
} /* point_out() */
-static Point *
+static Point *
point_construct(double x, double y)
{
- Point *result = PALLOCTYPE(Point);
+ Point *result = PALLOCTYPE(Point);
result->x = x;
result->y = y;
@@ -1395,10 +1395,10 @@ point_construct(double x, double y)
}
-static Point *
+static Point *
point_copy(Point * pt)
{
- Point *result;
+ Point *result;
if (!PointerIsValid(pt))
return (NULL);
@@ -1469,16 +1469,16 @@ point_eq(Point * pt1, Point * pt2)
int32
pointdist(Point * p1, Point * p2)
{
- int32 result;
+ int32 result;
result = point_dt(p1, p2);
return (result);
}
-double *
+double *
point_distance(Point * pt1, Point * pt2)
{
- double *result = PALLOCTYPE(double);
+ double *result = PALLOCTYPE(double);
*result = HYPOT(pt1->x - pt2->x, pt1->y - pt2->y);
return (result);
@@ -1491,10 +1491,10 @@ point_dt(Point * pt1, Point * pt2)
return (HYPOT(pt1->x - pt2->x, pt1->y - pt2->y));
}
-double *
+double *
point_slope(Point * pt1, Point * pt2)
{
- double *result = PALLOCTYPE(double);
+ double *result = PALLOCTYPE(double);
if (point_vert(pt1, pt2))
*result = (double) DBL_MAX;
@@ -1528,13 +1528,13 @@ point_sl(Point * pt1, Point * pt2)
* (old form) "(x1, y1, x2, y2)"
*---------------------------------------------------------*/
-LSEG *
+LSEG *
lseg_in(char *str)
{
- LSEG *lseg;
+ LSEG *lseg;
- int isopen;
- char *s;
+ int isopen;
+ char *s;
if (!PointerIsValid(str))
elog(WARN, " Bad (null) lseg external representation", NULL);
@@ -1551,7 +1551,7 @@ lseg_in(char *str)
} /* lseg_in() */
-char *
+char *
lseg_out(LSEG * ls)
{
if (!PointerIsValid(ls))
@@ -1564,10 +1564,10 @@ lseg_out(LSEG * ls)
/* lseg_construct -
* form a LSEG from two Points.
*/
-LSEG *
+LSEG *
lseg_construct(Point * pt1, Point * pt2)
{
- LSEG *result = PALLOCTYPE(LSEG);
+ LSEG *result = PALLOCTYPE(LSEG);
result->p[0].x = pt1->x;
result->p[0].y = pt1->y;
@@ -1602,9 +1602,9 @@ statlseg_construct(LSEG * lseg, Point * pt1, Point * pt2)
bool
lseg_intersect(LSEG * l1, LSEG * l2)
{
- LINE *ln;
- Point *interpt;
- bool retval;
+ LINE *ln;
+ Point *interpt;
+ bool retval;
ln = line_construct_pp(&l2->p[0], &l2->p[1]);
interpt = interpt_sl(l1, ln);
@@ -1632,8 +1632,8 @@ lseg_parallel(LSEG * l1, LSEG * l2)
bool
lseg_perp(LSEG * l1, LSEG * l2)
{
- double m1,
- m2;
+ double m1,
+ m2;
m1 = point_sl(&(l1->p[0]), &(l1->p[1]));
m2 = point_sl(&(l2->p[0]), &(l2->p[1]));
@@ -1677,10 +1677,10 @@ lseg_eq(LSEG * l1, LSEG * l2)
* point will be from one of the endpoints to the other
* segment.
*/
-double *
+double *
lseg_distance(LSEG * l1, LSEG * l2)
{
- double *result = PALLOCTYPE(double);
+ double *result = PALLOCTYPE(double);
*result = lseg_dt(l1, l2);
@@ -1691,8 +1691,8 @@ lseg_distance(LSEG * l1, LSEG * l2)
static double
lseg_dt(LSEG * l1, LSEG * l2)
{
- double *d,
- result;
+ double *d,
+ result;
if (lseg_intersect(l1, l2))
return (0.0);
@@ -1719,10 +1719,10 @@ lseg_dt(LSEG * l1, LSEG * l2)
} /* lseg_dt() */
-Point *
+Point *
lseg_center(LSEG * lseg)
{
- Point *result;
+ Point *result;
if (!PointerIsValid(lseg))
return (NULL);
@@ -1745,12 +1745,12 @@ lseg_center(LSEG * lseg)
* endpoints since there may be rounding effects with annoying
* lsb residue. - tgl 1997-07-09
*/
-Point *
+Point *
lseg_interpt(LSEG * l1, LSEG * l2)
{
- Point *result;
- LINE *tmp1,
- *tmp2;
+ Point *result;
+ LINE *tmp1,
+ *tmp2;
if (!PointerIsValid(l1) || !PointerIsValid(l2))
return (NULL);
@@ -1805,10 +1805,10 @@ lseg_interpt(LSEG * l1, LSEG * l2)
* Minimum distance from one object to another.
*-------------------------------------------------------------------*/
-double *
+double *
dist_pl(Point * pt, LINE * line)
{
- double *result = PALLOCTYPE(double);
+ double *result = PALLOCTYPE(double);
*result = (line->A * pt->x + line->B * pt->y + line->C) /
HYPOT(line->A, line->B);
@@ -1816,14 +1816,14 @@ dist_pl(Point * pt, LINE * line)
return (result);
}
-double *
+double *
dist_ps(Point * pt, LSEG * lseg)
{
- double m; /* slope of perp. */
- LINE *ln;
- double *result,
- *tmpdist;
- Point *ip;
+ double m; /* slope of perp. */
+ LINE *ln;
+ double *result,
+ *tmpdist;
+ Point *ip;
/*
* Construct a line perpendicular to the input segment
@@ -1887,51 +1887,51 @@ dist_ps(Point * pt, LSEG * lseg)
/*
** Distance from a point to a path
*/
-double *
+double *
dist_ppath(Point * pt, PATH * path)
{
- double *result;
- double *tmp;
- int i;
- LSEG lseg;
+ double *result;
+ double *tmp;
+ int i;
+ LSEG lseg;
switch (path->npts)
{
- /* no points in path? then result is undefined... */
- case 0:
- result = NULL;
- break;
- /* one point in path? then get distance between two points... */
- case 1:
- result = point_distance(pt, &path->p[0]);
- break;
- default:
- /* make sure the path makes sense... */
- Assert(path->npts > 1);
-
- /*
- * the distance from a point to a path is the smallest distance
- * from the point to any of its constituent segments.
- */
- result = PALLOCTYPE(double);
- for (i = 0; i < path->npts - 1; i++)
- {
- statlseg_construct(&lseg, &path->p[i], &path->p[i + 1]);
- tmp = dist_ps(pt, &lseg);
- if (i == 0 || *tmp < *result)
- *result = *tmp;
- PFREE(tmp);
- }
- break;
+ /* no points in path? then result is undefined... */
+ case 0:
+ result = NULL;
+ break;
+ /* one point in path? then get distance between two points... */
+ case 1:
+ result = point_distance(pt, &path->p[0]);
+ break;
+ default:
+ /* make sure the path makes sense... */
+ Assert(path->npts > 1);
+
+ /*
+ * the distance from a point to a path is the smallest
+ * distance from the point to any of its constituent segments.
+ */
+ result = PALLOCTYPE(double);
+ for (i = 0; i < path->npts - 1; i++)
+ {
+ statlseg_construct(&lseg, &path->p[i], &path->p[i + 1]);
+ tmp = dist_ps(pt, &lseg);
+ if (i == 0 || *tmp < *result)
+ *result = *tmp;
+ PFREE(tmp);
+ }
+ break;
}
return (result);
}
-double *
+double *
dist_pb(Point * pt, BOX * box)
{
- Point *tmp;
- double *result;
+ Point *tmp;
+ double *result;
tmp = close_pb(pt, box);
result = point_distance(tmp, pt);
@@ -1941,11 +1941,11 @@ dist_pb(Point * pt, BOX * box)
}
-double *
+double *
dist_sl(LSEG * lseg, LINE * line)
{
- double *result,
- *d2;
+ double *result,
+ *d2;
if (inter_sl(lseg, line))
{
@@ -1972,11 +1972,11 @@ dist_sl(LSEG * lseg, LINE * line)
}
-double *
+double *
dist_sb(LSEG * lseg, BOX * box)
{
- Point *tmp;
- double *result;
+ Point *tmp;
+ double *result;
tmp = close_sb(lseg, box);
if (tmp == NULL)
@@ -1994,11 +1994,11 @@ dist_sb(LSEG * lseg, BOX * box)
}
-double *
+double *
dist_lb(LINE * line, BOX * box)
{
- Point *tmp;
- double *result;
+ Point *tmp;
+ double *result;
tmp = close_lb(line, box);
if (tmp == NULL)
@@ -2016,13 +2016,13 @@ dist_lb(LINE * line, BOX * box)
}
-double *
+double *
dist_cpoly(CIRCLE * circle, POLYGON * poly)
{
- double *result;
- int i;
- double *d;
- LSEG seg;
+ double *result;
+ int i;
+ double *d;
+ LSEG seg;
if (!PointerIsValid(circle) || !PointerIsValid(poly))
elog(WARN, "Invalid (null) input for distance", NULL);
@@ -2079,11 +2079,11 @@ dist_cpoly(CIRCLE * circle, POLYGON * poly)
* lines and boxes, since there are typically two.
*-------------------------------------------------------------------*/
-static Point *
+static Point *
interpt_sl(LSEG * lseg, LINE * line)
{
- LINE *tmp;
- Point *p;
+ LINE *tmp;
+ Point *p;
tmp = line_construct_pp(&lseg->p[0], &lseg->p[1]);
p = line_interpt(tmp, line);
@@ -2126,12 +2126,12 @@ interpt_sl(LSEG * lseg, LINE * line)
* The intersection point of a perpendicular of the line
* through the point.
*/
-Point *
+Point *
close_pl(Point * pt, LINE * line)
{
- Point *result;
- LINE *tmp;
- double invm;
+ Point *result;
+ LINE *tmp;
+ double invm;
result = PALLOCTYPE(Point);
#if FALSE
@@ -2174,14 +2174,14 @@ close_pl(Point * pt, LINE * line)
* above, or below the segment, otherwise find the intersection
* point of the segment and its perpendicular through the point.
*/
-Point *
+Point *
close_ps(Point * pt, LSEG * lseg)
{
- Point *result;
- LINE *tmp;
- double invm;
- int xh,
- yh;
+ Point *result;
+ LINE *tmp;
+ double invm;
+ int xh,
+ yh;
result = NULL;
xh = lseg->p[0].x < lseg->p[1].x;
@@ -2226,7 +2226,7 @@ close_ps(Point * pt, LSEG * lseg)
return (result);
} /* close_ps() */
-Point *
+Point *
close_pb(Point * pt, BOX * box)
{
/* think about this one for a while */
@@ -2235,12 +2235,12 @@ close_pb(Point * pt, BOX * box)
return (NULL);
}
-Point *
+Point *
close_sl(LSEG * lseg, LINE * line)
{
- Point *result;
- double *d1,
- *d2;
+ Point *result;
+ double *d1,
+ *d2;
result = interpt_sl(lseg, line);
if (result)
@@ -2257,7 +2257,7 @@ close_sl(LSEG * lseg, LINE * line)
return (result);
}
-Point *
+Point *
close_sb(LSEG * lseg, BOX * box)
{
/* think about this one for a while */
@@ -2266,7 +2266,7 @@ close_sb(LSEG * lseg, BOX * box)
return (NULL);
}
-Point *
+Point *
close_lb(LINE * line, BOX * box)
{
/* think about this one for a while */
@@ -2334,21 +2334,21 @@ bool
on_ppath(Point * pt, PATH * path)
{
#if FALSE
- int above,
- next, /* is the seg above the ray? */
- inter, /* # of times path crosses ray */
- hi; /* index inc of higher seg (0,1) */
- double x,
- yh,
- yl,
- xh,
- xl;
+ int above,
+ next, /* is the seg above the ray? */
+ inter, /* # of times path crosses ray */
+ hi; /* index inc of higher seg (0,1) */
+ double x,
+ yh,
+ yl,
+ xh,
+ xl;
#endif
- int i,
- n;
- double a,
- b;
+ int i,
+ n;
+ double a,
+ b;
if (!PointerIsValid(pt) || !PointerIsValid(path))
return (FALSE);
@@ -2449,7 +2449,7 @@ on_sb(LSEG * lseg, BOX * box)
bool
inter_sl(LSEG * lseg, LINE * line)
{
- Point *tmp;
+ Point *tmp;
if (!PointerIsValid(lseg) || !PointerIsValid(line))
return (FALSE);
@@ -2493,11 +2493,11 @@ inter_lb(LINE * line, BOX * box)
static void
make_bound_box(POLYGON * poly)
{
- int i;
- double x1,
- y1,
- x2,
- y2;
+ int i;
+ double x1,
+ y1,
+ x2,
+ y2;
if (poly->npts > 0)
{
@@ -2531,14 +2531,14 @@ make_bound_box(POLYGON * poly)
* "x0,y0,...,xn,yn"
* also supports the older style "(x1,...,xn,y1,...yn)"
*------------------------------------------------------------------*/
-POLYGON *
+POLYGON *
poly_in(char *str)
{
- POLYGON *poly;
- int npts;
- int size;
- int isopen;
- char *s;
+ POLYGON *poly;
+ int npts;
+ int size;
+ int isopen;
+ char *s;
if (!PointerIsValid(str))
elog(WARN, " Bad (null) polygon external representation");
@@ -2567,7 +2567,7 @@ poly_in(char *str)
* character string format "((f8,f8),...,(f8,f8))"
* also support old format "(f8,f8,...,f8,f8)"
*---------------------------------------------------------------*/
-char *
+char *
poly_out(POLYGON * poly)
{
if (!PointerIsValid(poly))
@@ -2677,7 +2677,7 @@ poly_contain(POLYGON * polya, POLYGON * polyb)
bool
poly_contain(POLYGON * polya, POLYGON * polyb)
{
- int i;
+ int i;
if (!PointerIsValid(polya) || !PointerIsValid(polyb))
return (FALSE);
@@ -2764,10 +2764,10 @@ pt_contained_poly(Point * p, POLYGON * poly)
} /* pt_contained_poly() */
-double *
+double *
poly_distance(POLYGON * polya, POLYGON * polyb)
{
- double *result;
+ double *result;
if (!PointerIsValid(polya) || !PointerIsValid(polyb))
return (NULL);
@@ -2786,7 +2786,7 @@ poly_distance(POLYGON * polya, POLYGON * polyb)
**
***********************************************************************/
-Point *
+Point *
point(float8 * x, float8 * y)
{
if (!(PointerIsValid(x) && PointerIsValid(y)))
@@ -2796,10 +2796,10 @@ point(float8 * x, float8 * y)
} /* point() */
-Point *
+Point *
point_add(Point * p1, Point * p2)
{
- Point *result;
+ Point *result;
if (!(PointerIsValid(p1) && PointerIsValid(p2)))
return (NULL);
@@ -2812,10 +2812,10 @@ point_add(Point * p1, Point * p2)
return (result);
} /* point_add() */
-Point *
+Point *
point_sub(Point * p1, Point * p2)
{
- Point *result;
+ Point *result;
if (!(PointerIsValid(p1) && PointerIsValid(p2)))
return (NULL);
@@ -2828,10 +2828,10 @@ point_sub(Point * p1, Point * p2)
return (result);
} /* point_sub() */
-Point *
+Point *
point_mul(Point * p1, Point * p2)
{
- Point *result;
+ Point *result;
if (!(PointerIsValid(p1) && PointerIsValid(p2)))
return (NULL);
@@ -2844,11 +2844,11 @@ point_mul(Point * p1, Point * p2)
return (result);
} /* point_mul() */
-Point *
+Point *
point_div(Point * p1, Point * p2)
{
- Point *result;
- double div;
+ Point *result;
+ double div;
if (!(PointerIsValid(p1) && PointerIsValid(p2)))
return (NULL);
@@ -2873,10 +2873,10 @@ point_div(Point * p1, Point * p2)
**
***********************************************************************/
-BOX *
+BOX *
box(Point * p1, Point * p2)
{
- BOX *result;
+ BOX *result;
if (!(PointerIsValid(p1) && PointerIsValid(p2)))
return (NULL);
@@ -2886,10 +2886,10 @@ box(Point * p1, Point * p2)
return (result);
} /* box() */
-BOX *
+BOX *
box_add(BOX * box, Point * p)
{
- BOX *result;
+ BOX *result;
if (!(PointerIsValid(box) && PointerIsValid(p)))
return (NULL);
@@ -2900,10 +2900,10 @@ box_add(BOX * box, Point * p)
return (result);
} /* box_add() */
-BOX *
+BOX *
box_sub(BOX * box, Point * p)
{
- BOX *result;
+ BOX *result;
if (!(PointerIsValid(box) && PointerIsValid(p)))
return (NULL);
@@ -2914,12 +2914,12 @@ box_sub(BOX * box, Point * p)
return (result);
} /* box_sub() */
-BOX *
+BOX *
box_mul(BOX * box, Point * p)
{
- BOX *result;
- Point *high,
- *low;
+ BOX *result;
+ Point *high,
+ *low;
if (!(PointerIsValid(box) && PointerIsValid(p)))
return (NULL);
@@ -2934,12 +2934,12 @@ box_mul(BOX * box, Point * p)
return (result);
} /* box_mul() */
-BOX *
+BOX *
box_div(BOX * box, Point * p)
{
- BOX *result;
- Point *high,
- *low;
+ BOX *result;
+ Point *high,
+ *low;
if (!(PointerIsValid(box) && PointerIsValid(p)))
return (NULL);
@@ -2974,12 +2974,12 @@ box_div(BOX * box, Point * p)
/* path_add()
* Concatenate two paths (only if they are both open).
*/
-PATH *
+PATH *
path_add(PATH * p1, PATH * p2)
{
- PATH *result;
- int size;
- int i;
+ PATH *result;
+ int size;
+ int i;
if (!(PointerIsValid(p1) && PointerIsValid(p2))
|| p1->closed || p2->closed)
@@ -3009,11 +3009,11 @@ path_add(PATH * p1, PATH * p2)
/* path_add_pt()
* Translation operator.
*/
-PATH *
+PATH *
path_add_pt(PATH * path, Point * point)
{
- PATH *result;
- int i;
+ PATH *result;
+ int i;
if ((!PointerIsValid(path)) || (!PointerIsValid(point)))
return (NULL);
@@ -3029,11 +3029,11 @@ path_add_pt(PATH * path, Point * point)
return (result);
} /* path_add_pt() */
-PATH *
+PATH *
path_sub_pt(PATH * path, Point * point)
{
- PATH *result;
- int i;
+ PATH *result;
+ int i;
if ((!PointerIsValid(path)) || (!PointerIsValid(point)))
return (NULL);
@@ -3053,12 +3053,12 @@ path_sub_pt(PATH * path, Point * point)
/* path_mul_pt()
* Rotation and scaling operators.
*/
-PATH *
+PATH *
path_mul_pt(PATH * path, Point * point)
{
- PATH *result;
- Point *p;
- int i;
+ PATH *result;
+ Point *p;
+ int i;
if ((!PointerIsValid(path)) || (!PointerIsValid(point)))
return (NULL);
@@ -3076,12 +3076,12 @@ path_mul_pt(PATH * path, Point * point)
return (result);
} /* path_mul_pt() */
-PATH *
+PATH *
path_div_pt(PATH * path, Point * point)
{
- PATH *result;
- Point *p;
- int i;
+ PATH *result;
+ Point *p;
+ int i;
if ((!PointerIsValid(path)) || (!PointerIsValid(point)))
return (NULL);
@@ -3119,10 +3119,10 @@ pt_contained_path(Point * p, PATH * path)
} /* pt_contained_path() */
-Point *
+Point *
path_center(PATH * path)
{
- Point *result;
+ Point *result;
if (!PointerIsValid(path))
return (NULL);
@@ -3135,12 +3135,12 @@ path_center(PATH * path)
return (result);
} /* path_center() */
-POLYGON *
+POLYGON *
path_poly(PATH * path)
{
- POLYGON *poly;
- int size;
- int i;
+ POLYGON *poly;
+ int size;
+ int i;
if (!PointerIsValid(path))
return (NULL);
@@ -3176,10 +3176,10 @@ path_poly(PATH * path)
PATH
* upgradepath(PATH * path)
{
- PATH *result;
- int size,
- npts;
- int i;
+ PATH *result;
+ int size,
+ npts;
+ int i;
if (!PointerIsValid(path) || (path->npts < 2))
return (NULL);
@@ -3231,11 +3231,11 @@ poly_npoints(POLYGON * poly)
} /* poly_npoints() */
-Point *
+Point *
poly_center(POLYGON * poly)
{
- Point *result;
- CIRCLE *circle;
+ Point *result;
+ CIRCLE *circle;
if (!PointerIsValid(poly))
return (NULL);
@@ -3255,10 +3255,10 @@ poly_center(POLYGON * poly)
} /* poly_center() */
-BOX *
+BOX *
poly_box(POLYGON * poly)
{
- BOX *box;
+ BOX *box;
if (!PointerIsValid(poly) || (poly->npts < 1))
return (NULL);
@@ -3272,11 +3272,11 @@ poly_box(POLYGON * poly)
/* box_poly()
* Convert a box to a polygon.
*/
-POLYGON *
+POLYGON *
box_poly(BOX * box)
{
- POLYGON *poly;
- int size;
+ POLYGON *poly;
+ int size;
if (!PointerIsValid(box))
return (NULL);
@@ -3303,12 +3303,12 @@ box_poly(BOX * box)
} /* box_poly() */
-PATH *
+PATH *
poly_path(POLYGON * poly)
{
- PATH *path;
- int size;
- int i;
+ PATH *path;
+ int size;
+ int i;
if (!PointerIsValid(poly) || (poly->npts < 0))
return (NULL);
@@ -3338,11 +3338,11 @@ poly_path(POLYGON * poly)
POLYGON
* upgradepoly(POLYGON * poly)
{
- POLYGON *result;
- int size;
- int n2,
- i,
- ii;
+ POLYGON *result;
+ int size;
+ int n2,
+ i,
+ ii;
if (!PointerIsValid(poly) || (poly->npts < 1))
return (NULL);
@@ -3384,11 +3384,11 @@ POLYGON
POLYGON
* revertpoly(POLYGON * poly)
{
- POLYGON *result;
- int size;
- int n2,
- i,
- ii;
+ POLYGON *result;
+ int size;
+ int n2,
+ i,
+ ii;
if (!PointerIsValid(poly) || (poly->npts < 1))
return (NULL);
@@ -3441,14 +3441,14 @@ POLYGON
* "((f8,f8)<f8>)"
* also supports quick entry style "(f8,f8,f8)"
*/
-CIRCLE *
+CIRCLE *
circle_in(char *str)
{
- CIRCLE *circle;
+ CIRCLE *circle;
- char *s,
- *cp;
- int depth = 0;
+ char *s,
+ *cp;
+ int depth = 0;
if (!PointerIsValid(str))
elog(WARN, " Bad (null) circle external representation", NULL);
@@ -3505,11 +3505,11 @@ circle_in(char *str)
/* circle_out - convert a circle to external form.
*/
-char *
+char *
circle_out(CIRCLE * circle)
{
- char *result;
- char *cp;
+ char *result;
+ char *cp;
if (!PointerIsValid(circle))
return (NULL);
@@ -3674,10 +3674,10 @@ circle_ge(CIRCLE * circle1, CIRCLE * circle2)
* actual value.
*---------------------------------------------------------*/
-static CIRCLE *
+static CIRCLE *
circle_copy(CIRCLE * circle)
{
- CIRCLE *result;
+ CIRCLE *result;
if (!PointerIsValid(circle))
return NULL;
@@ -3692,10 +3692,10 @@ circle_copy(CIRCLE * circle)
/* circle_add_pt()
* Translation operator.
*/
-CIRCLE *
+CIRCLE *
circle_add_pt(CIRCLE * circle, Point * point)
{
- CIRCLE *result;
+ CIRCLE *result;
if (!PointerIsValid(circle) || !PointerIsValid(point))
return (NULL);
@@ -3708,10 +3708,10 @@ circle_add_pt(CIRCLE * circle, Point * point)
return (result);
} /* circle_add_pt() */
-CIRCLE *
+CIRCLE *
circle_sub_pt(CIRCLE * circle, Point * point)
{
- CIRCLE *result;
+ CIRCLE *result;
if (!PointerIsValid(circle) || !PointerIsValid(point))
return (NULL);
@@ -3728,11 +3728,11 @@ circle_sub_pt(CIRCLE * circle, Point * point)
/* circle_mul_pt()
* Rotation and scaling operators.
*/
-CIRCLE *
+CIRCLE *
circle_mul_pt(CIRCLE * circle, Point * point)
{
- CIRCLE *result;
- Point *p;
+ CIRCLE *result;
+ Point *p;
if (!PointerIsValid(circle) || !PointerIsValid(point))
return (NULL);
@@ -3748,11 +3748,11 @@ circle_mul_pt(CIRCLE * circle, Point * point)
return (result);
} /* circle_mul_pt() */
-CIRCLE *
+CIRCLE *
circle_div_pt(CIRCLE * circle, Point * point)
{
- CIRCLE *result;
- Point *p;
+ CIRCLE *result;
+ Point *p;
if (!PointerIsValid(circle) || !PointerIsValid(point))
return (NULL);
@@ -3771,10 +3771,10 @@ circle_div_pt(CIRCLE * circle, Point * point)
/* circle_area - returns the area of the circle.
*/
-double *
+double *
circle_area(CIRCLE * circle)
{
- double *result;
+ double *result;
result = PALLOCTYPE(double);
*result = circle_ar(circle);
@@ -3785,10 +3785,10 @@ circle_area(CIRCLE * circle)
/* circle_diameter - returns the diameter of the circle.
*/
-double *
+double *
circle_diameter(CIRCLE * circle)
{
- double *result;
+ double *result;
result = PALLOCTYPE(double);
*result = (2 * circle->radius);
@@ -3799,10 +3799,10 @@ circle_diameter(CIRCLE * circle)
/* circle_radius - returns the radius of the circle.
*/
-double *
+double *
circle_radius(CIRCLE * circle)
{
- double *result;
+ double *result;
result = PALLOCTYPE(double);
*result = circle->radius;
@@ -3814,10 +3814,10 @@ circle_radius(CIRCLE * circle)
/* circle_distance - returns the distance between
* two circles.
*/
-double *
+double *
circle_distance(CIRCLE * circle1, CIRCLE * circle2)
{
- double *result;
+ double *result;
result = PALLOCTYPE(double);
*result = (point_dt(&circle1->center, &circle2->center)
@@ -3832,8 +3832,8 @@ circle_distance(CIRCLE * circle1, CIRCLE * circle2)
bool
circle_contain_pt(CIRCLE * circle, Point * point)
{
- bool within;
- double *d;
+ bool within;
+ double *d;
if (!PointerIsValid(circle) || !PointerIsValid(point))
return (FALSE);
@@ -3856,10 +3856,10 @@ pt_contained_circle(Point * point, CIRCLE * circle)
/* dist_pc - returns the distance between
* a point and a circle.
*/
-double *
+double *
dist_pc(Point * point, CIRCLE * circle)
{
- double *result;
+ double *result;
result = PALLOCTYPE(double);
@@ -3873,10 +3873,10 @@ dist_pc(Point * point, CIRCLE * circle)
/* circle_center - returns the center point of the circle.
*/
-Point *
+Point *
circle_center(CIRCLE * circle)
{
- Point *result;
+ Point *result;
result = PALLOCTYPE(Point);
result->x = circle->center.x;
@@ -3902,7 +3902,7 @@ circle_ar(CIRCLE * circle)
double
circle_dt(CIRCLE * circle1, CIRCLE * circle2)
{
- double result;
+ double result;
result = point_dt(&circle1->center, &circle2->center);
@@ -3915,10 +3915,10 @@ circle_dt(CIRCLE * circle1, CIRCLE * circle2)
* Conversion operators.
*---------------------------------------------------------*/
-CIRCLE *
+CIRCLE *
circle(Point * center, float8 * radius)
{
- CIRCLE *result;
+ CIRCLE *result;
if (!(PointerIsValid(center) && PointerIsValid(radius)))
return (NULL);
@@ -3933,11 +3933,11 @@ circle(Point * center, float8 * radius)
}
-BOX *
+BOX *
circle_box(CIRCLE * circle)
{
- BOX *box;
- double delta;
+ BOX *box;
+ double delta;
if (!PointerIsValid(circle))
return (NULL);
@@ -3957,10 +3957,10 @@ circle_box(CIRCLE * circle)
/* box_circle()
* Convert a box to a circle.
*/
-CIRCLE *
+CIRCLE *
box_circle(BOX * box)
{
- CIRCLE *circle;
+ CIRCLE *circle;
if (!PointerIsValid(box))
return (NULL);
@@ -3976,13 +3976,13 @@ box_circle(BOX * box)
} /* box_circle() */
-POLYGON *
+POLYGON *
circle_poly(int npts, CIRCLE * circle)
{
- POLYGON *poly;
- int size;
- int i;
- double angle;
+ POLYGON *poly;
+ int size;
+ int i;
+ double angle;
if (!PointerIsValid(circle))
return (NULL);
@@ -4014,11 +4014,11 @@ circle_poly(int npts, CIRCLE * circle)
* XXX This algorithm should use weighted means of line segments
* rather than straight average values of points - tgl 97/01/21.
*/
-CIRCLE *
+CIRCLE *
poly_circle(POLYGON * poly)
{
- CIRCLE *circle;
- int i;
+ CIRCLE *circle;
+ int i;
if (!PointerIsValid(poly))
return (NULL);
@@ -4064,16 +4064,16 @@ poly_circle(POLYGON * poly)
static int
point_inside(Point * p, int npts, Point plist[])
{
- double x0,
- y0;
- double px,
- py;
+ double x0,
+ y0;
+ double px,
+ py;
- int i;
- double x,
- y;
- int cross,
- crossnum;
+ int i;
+ double x,
+ y;
+ int cross,
+ crossnum;
/*
* We calculate crossnum, which is twice the crossing number of a
@@ -4132,8 +4132,8 @@ point_inside(Point * p, int npts, Point plist[])
static int
lseg_crossing(double x, double y, double px, double py)
{
- double z;
- int sgn;
+ double z;
+ int sgn;
/* If (px,py) = (0,0) and not first call we have already sent HIT_IT */
@@ -4184,12 +4184,12 @@ lseg_crossing(double x, double y, double px, double py)
} /* lseg_crossing() */
-static bool
+static bool
plist_same(int npts, Point p1[], Point p2[])
{
- int i,
- ii,
- j;
+ int i,
+ ii,
+ j;
/* find match for first point */
for (i = 0; i < npts; i++)
diff --git a/src/backend/utils/adt/geo_selfuncs.c b/src/backend/utils/adt/geo_selfuncs.c
index 240639d6eda..d07230e41f7 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.4 1997/09/07 04:50:20 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_selfuncs.c,v 1.5 1997/09/08 02:30:44 momjian Exp $
*
* XXX These are totally bogus.
*
@@ -28,7 +28,7 @@ areasel(Oid opid,
char *value,
int32 flag)
{
- float64 result;
+ float64 result;
result = (float64) palloc(sizeof(float64data));
*result = 1.0 / 4.0;
@@ -42,7 +42,7 @@ areajoinsel(Oid opid,
char *value,
int32 flag)
{
- float64 result;
+ float64 result;
result = (float64) palloc(sizeof(float64data));
*result = 1.0 / 4.0;
@@ -73,7 +73,7 @@ leftsel(Oid opid,
char *value,
int32 flag)
{
- float64 result;
+ float64 result;
result = (float64) palloc(sizeof(float64data));
*result = 1.0 / 6.0;
@@ -90,7 +90,7 @@ leftjoinsel(Oid opid,
char *value,
int32 flag)
{
- float64 result;
+ float64 result;
result = (float64) palloc(sizeof(float64data));
*result = 1.0 / 6.0;
@@ -110,7 +110,7 @@ contsel(Oid opid,
char *value,
int32 flag)
{
- float64 result;
+ float64 result;
result = (float64) palloc(sizeof(float64data));
*result = 1.0 / 10.0;
@@ -127,7 +127,7 @@ contjoinsel(Oid opid,
char *value,
int32 flag)
{
- float64 result;
+ float64 result;
result = (float64) palloc(sizeof(float64data));
*result = 1.0 / 10.0;
diff --git a/src/backend/utils/adt/int.c b/src/backend/utils/adt/int.c
index c7ea5f71fcc..b1945196175 100644
--- a/src/backend/utils/adt/int.c
+++ b/src/backend/utils/adt/int.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.5 1997/09/07 04:50:21 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.6 1997/09/08 02:30:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -50,10 +50,10 @@ int2in(char *num)
/*
* int2out - converts short to "num"
*/
-char *
+char *
int2out(int16 sh)
{
- char *result;
+ char *result;
result = (char *) palloc(7);/* assumes sign, 5 digits, '\0' */
itoa((int) sh, result);
@@ -66,11 +66,11 @@ int2out(int16 sh)
* Note:
* Fills any nonexistent digits with NULLs.
*/
-int16 *
+int16 *
int28in(char *shs)
{
- register int16(*result)[];
- int nums;
+ register int16(*result)[];
+ int nums;
if (shs == NULL)
return (NULL);
@@ -95,13 +95,13 @@ int28in(char *shs)
/*
* int28out - converts internal form to "num num ..."
*/
-char *
+char *
int28out(int16(*shs)[])
{
- register int num;
+ register int num;
register int16 *sp;
- register char *rp;
- char *result;
+ register char *rp;
+ char *result;
if (shs == NULL)
{
@@ -130,11 +130,11 @@ int28out(int16(*shs)[])
* Note:
* Fills any nonexistent digits with NULLs.
*/
-int32 *
+int32 *
int44in(char *input_string)
{
- int32 *foo = (int32 *) palloc(4 * sizeof(int32));
- register int i = 0;
+ int32 *foo = (int32 *) palloc(4 * sizeof(int32));
+ register int i = 0;
i = sscanf(input_string,
"%d, %d, %d, %d",
@@ -151,16 +151,16 @@ int44in(char *input_string)
/*
* int28out - converts internal form to "num num ..."
*/
-char *
+char *
int44out(int32 an_array[])
{
- int temp = 4;
- char *output_string = NULL;
- int i;
+ int temp = 4;
+ char *output_string = NULL;
+ int i;
if (temp > 0)
{
- char *walk;
+ char *walk;
output_string = (char *) palloc(16 * temp); /* assume 15 digits +
* sign */
@@ -194,10 +194,10 @@ int4in(char *num)
/*
* int4out - converts int4 to "num"
*/
-char *
+char *
int4out(int32 l)
{
- char *result;
+ char *result;
result = (char *) palloc(12); /* assumes sign, 10 digits, '\0' */
ltoa(l, result);
@@ -243,108 +243,133 @@ i4toi2(int32 arg1)
* intgt - returns 1 iff arg1 > arg2
* intge - returns 1 iff arg1 >= arg2
*/
-bool int4eq(int32 arg1, int32 arg2)
+bool
+int4eq(int32 arg1, int32 arg2)
{
return (arg1 == arg2);
}
-bool int4ne(int32 arg1, int32 arg2)
+bool
+int4ne(int32 arg1, int32 arg2)
{
return (arg1 != arg2);
}
-bool int4lt(int32 arg1, int32 arg2)
+bool
+int4lt(int32 arg1, int32 arg2)
{
return (arg1 < arg2);
}
-bool int4le(int32 arg1, int32 arg2)
+bool
+int4le(int32 arg1, int32 arg2)
{
return (arg1 <= arg2);
}
-bool int4gt(int32 arg1, int32 arg2)
+bool
+int4gt(int32 arg1, int32 arg2)
{
return (arg1 > arg2);
}
-bool int4ge(int32 arg1, int32 arg2)
+bool
+int4ge(int32 arg1, int32 arg2)
{
return (arg1 >= arg2);
}
-bool int2eq(int16 arg1, int16 arg2)
+bool
+int2eq(int16 arg1, int16 arg2)
{
return (arg1 == arg2);
}
-bool int2ne(int16 arg1, int16 arg2)
+bool
+int2ne(int16 arg1, int16 arg2)
{
return (arg1 != arg2);
}
-bool int2lt(int16 arg1, int16 arg2)
+bool
+int2lt(int16 arg1, int16 arg2)
{
return (arg1 < arg2);
}
-bool int2le(int16 arg1, int16 arg2)
+bool
+int2le(int16 arg1, int16 arg2)
{
return (arg1 <= arg2);
}
-bool int2gt(int16 arg1, int16 arg2)
+bool
+int2gt(int16 arg1, int16 arg2)
{
return (arg1 > arg2);
}
-bool int2ge(int16 arg1, int16 arg2)
+bool
+int2ge(int16 arg1, int16 arg2)
{
return (arg1 >= arg2);
}
-bool int24eq(int32 arg1, int32 arg2)
+bool
+int24eq(int32 arg1, int32 arg2)
{
return (arg1 == arg2);
}
-bool int24ne(int32 arg1, int32 arg2)
+bool
+int24ne(int32 arg1, int32 arg2)
{
return (arg1 != arg2);
}
-bool int24lt(int32 arg1, int32 arg2)
+bool
+int24lt(int32 arg1, int32 arg2)
{
return (arg1 < arg2);
}
-bool int24le(int32 arg1, int32 arg2)
+bool
+int24le(int32 arg1, int32 arg2)
{
return (arg1 <= arg2);
}
-bool int24gt(int32 arg1, int32 arg2)
+bool
+int24gt(int32 arg1, int32 arg2)
{
return (arg1 > arg2);
}
-bool int24ge(int32 arg1, int32 arg2)
+bool
+int24ge(int32 arg1, int32 arg2)
{
return (arg1 >= arg2);
}
-bool int42eq(int32 arg1, int32 arg2)
+bool
+int42eq(int32 arg1, int32 arg2)
{
return (arg1 == arg2);
}
-bool int42ne(int32 arg1, int32 arg2)
+bool
+int42ne(int32 arg1, int32 arg2)
{
return (arg1 != arg2);
}
-bool int42lt(int32 arg1, int32 arg2)
+bool
+int42lt(int32 arg1, int32 arg2)
{
return (arg1 < arg2);
}
-bool int42le(int32 arg1, int32 arg2)
+bool
+int42le(int32 arg1, int32 arg2)
{
return (arg1 <= arg2);
}
-bool int42gt(int32 arg1, int32 arg2)
+bool
+int42gt(int32 arg1, int32 arg2)
{
return (arg1 > arg2);
}
-bool int42ge(int32 arg1, int32 arg2)
+bool
+int42ge(int32 arg1, int32 arg2)
{
return (arg1 >= arg2);
}
-bool keyfirsteq(int16 * arg1, int16 arg2)
+bool
+keyfirsteq(int16 * arg1, int16 arg2)
{
return (*arg1 == arg2);
}
@@ -355,86 +380,106 @@ bool keyfirsteq(int16 * arg1, int16 arg2)
* int[24]mul - returns arg1 * arg2
* int[24]div - returns arg1 / arg2
*/
-int32 int4um(int32 arg)
+int32
+int4um(int32 arg)
{
return (-arg);
}
-int32 int4pl(int32 arg1, int32 arg2)
+int32
+int4pl(int32 arg1, int32 arg2)
{
return (arg1 + arg2);
}
-int32 int4mi(int32 arg1, int32 arg2)
+int32
+int4mi(int32 arg1, int32 arg2)
{
return (arg1 - arg2);
}
-int32 int4mul(int32 arg1, int32 arg2)
+int32
+int4mul(int32 arg1, int32 arg2)
{
return (arg1 * arg2);
}
-int32 int4div(int32 arg1, int32 arg2)
+int32
+int4div(int32 arg1, int32 arg2)
{
return (arg1 / arg2);
}
-int32 int4inc(int32 arg)
+int32
+int4inc(int32 arg)
{
return (arg + (int32) 1);
}
-int16 int2um(int16 arg)
+int16
+int2um(int16 arg)
{
return (-arg);
}
-int16 int2pl(int16 arg1, int16 arg2)
+int16
+int2pl(int16 arg1, int16 arg2)
{
return (arg1 + arg2);
}
-int16 int2mi(int16 arg1, int16 arg2)
+int16
+int2mi(int16 arg1, int16 arg2)
{
return (arg1 - arg2);
}
-int16 int2mul(int16 arg1, int16 arg2)
+int16
+int2mul(int16 arg1, int16 arg2)
{
return (arg1 * arg2);
}
-int16 int2div(int16 arg1, int16 arg2)
+int16
+int2div(int16 arg1, int16 arg2)
{
return (arg1 / arg2);
}
-int16 int2inc(int16 arg)
+int16
+int2inc(int16 arg)
{
return (arg + (int16) 1);
}
-int32 int24pl(int32 arg1, int32 arg2)
+int32
+int24pl(int32 arg1, int32 arg2)
{
return (arg1 + arg2);
}
-int32 int24mi(int32 arg1, int32 arg2)
+int32
+int24mi(int32 arg1, int32 arg2)
{
return (arg1 - arg2);
}
-int32 int24mul(int32 arg1, int32 arg2)
+int32
+int24mul(int32 arg1, int32 arg2)
{
return (arg1 * arg2);
}
-int32 int24div(int32 arg1, int32 arg2)
+int32
+int24div(int32 arg1, int32 arg2)
{
return (arg1 / arg2);
}
-int32 int42pl(int32 arg1, int32 arg2)
+int32
+int42pl(int32 arg1, int32 arg2)
{
return (arg1 + arg2);
}
-int32 int42mi(int32 arg1, int32 arg2)
+int32
+int42mi(int32 arg1, int32 arg2)
{
return (arg1 - arg2);
}
-int32 int42mul(int32 arg1, int32 arg2)
+int32
+int42mul(int32 arg1, int32 arg2)
{
return (arg1 * arg2);
}
-int32 int42div(int32 arg1, int32 arg2)
+int32
+int42div(int32 arg1, int32 arg2)
{
return (arg1 / arg2);
}
@@ -442,19 +487,23 @@ int32 int42div(int32 arg1, int32 arg2)
/*
* int[24]mod - returns arg1 mod arg2
*/
-int32 int4mod(int32 arg1, int32 arg2)
+int32
+int4mod(int32 arg1, int32 arg2)
{
return (arg1 % arg2);
}
-int32 int2mod(int16 arg1, int16 arg2)
+int32
+int2mod(int16 arg1, int16 arg2)
{
return (arg1 % arg2);
}
-int32 int24mod(int32 arg1, int32 arg2)
+int32
+int24mod(int32 arg1, int32 arg2)
{
return (arg1 % arg2);
}
-int32 int42mod(int32 arg1, int32 arg2)
+int32
+int42mod(int32 arg1, int32 arg2)
{
return (arg1 % arg2);
}
@@ -465,7 +514,7 @@ int32 int42mod(int32 arg1, int32 arg2)
int32
int4fac(int32 arg1)
{
- int32 result;
+ int32 result;
if (arg1 < 1)
result = 0;
@@ -478,7 +527,7 @@ int4fac(int32 arg1)
int32
int2fac(int16 arg1)
{
- int16 result;
+ int16 result;
if (arg1 < 1)
result = 0;
diff --git a/src/backend/utils/adt/like.c b/src/backend/utils/adt/like.c
index a3fdbce8855..5e9c0e7ebbe 100644
--- a/src/backend/utils/adt/like.c
+++ b/src/backend/utils/adt/like.c
@@ -22,7 +22,7 @@
#include "utils/palloc.h"
#include "utils/builtins.h" /* where the function declarations go */
-static int like(char *text, char *p);
+static int like(char *text, char *p);
/*
* interface routines called by the function manager
@@ -36,12 +36,12 @@ static int like(char *text, char *p);
p - the pattern
charlen - the length of the string
*/
-static bool
+static bool
fixedlen_like(char *s, struct varlena * p, int charlen)
{
- char *sterm,
- *pterm;
- int result;
+ char *sterm,
+ *pterm;
+ int result;
if (!s || !p)
return FALSE;
@@ -72,7 +72,7 @@ fixedlen_like(char *s, struct varlena * p, int charlen)
bool
char2like(uint16 arg1, struct varlena * p)
{
- char *s = (char *) &arg1;
+ char *s = (char *) &arg1;
return (fixedlen_like(s, p, 2));
}
@@ -86,7 +86,7 @@ char2nlike(uint16 arg1, struct varlena * p)
bool
char4like(uint32 arg1, struct varlena * p)
{
- char *s = (char *) &arg1;
+ char *s = (char *) &arg1;
return (fixedlen_like(s, p, 4));
}
@@ -150,7 +150,7 @@ textnlike(struct varlena * s, struct varlena * p)
}
-/* $Revision: 1.7 $
+/* $Revision: 1.8 $
** "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.
@@ -187,7 +187,7 @@ textnlike(struct varlena * s, struct varlena * p)
static int
DoMatch(register char *text, register char *p)
{
- register int matched;
+ register int matched;
for (; *p; text++, p++)
{
@@ -195,28 +195,28 @@ DoMatch(register char *text, register char *p)
return LIKE_ABORT;
switch (*p)
{
- case '\\':
- /* Literal match with following character. */
- p++;
- /* FALLTHROUGH */
- default:
- if (*text != *p)
- return LIKE_FALSE;
- continue;
- case '_':
- /* Match anything. */
- continue;
- case '%':
- while (*++p == '%')
- /* Consecutive percents act just like one. */
+ case '\\':
+ /* Literal match with following character. */
+ p++;
+ /* FALLTHROUGH */
+ default:
+ if (*text != *p)
+ return LIKE_FALSE;
continue;
- if (*p == '\0')
- /* Trailing percent matches everything. */
- return LIKE_TRUE;
- while (*text)
- if ((matched = DoMatch(text++, p)) != LIKE_FALSE)
- return matched;
- return LIKE_ABORT;
+ case '_':
+ /* Match anything. */
+ continue;
+ case '%':
+ while (*++p == '%')
+ /* Consecutive percents act just like one. */
+ continue;
+ if (*p == '\0')
+ /* Trailing percent matches everything. */
+ return LIKE_TRUE;
+ while (*text)
+ if ((matched = DoMatch(text++, p)) != LIKE_FALSE)
+ return matched;
+ return LIKE_ABORT;
}
}
diff --git a/src/backend/utils/adt/misc.c b/src/backend/utils/adt/misc.c
index f04152cf6d2..90d9c0289e3 100644
--- a/src/backend/utils/adt/misc.c
+++ b/src/backend/utils/adt/misc.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/misc.c,v 1.8 1997/09/07 04:50:23 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/misc.c,v 1.9 1997/09/08 02:30:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -66,7 +66,7 @@ nonnullvalue(Datum value, bool * isNull)
bool
oidrand(Oid o, int32 X)
{
- bool result;
+ bool result;
if (X == 0)
return true;
diff --git a/src/backend/utils/adt/nabstime.c b/src/backend/utils/adt/nabstime.c
index 9eb5ed36281..9e929c579c5 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.32 1997/09/07 04:50:24 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.33 1997/09/08 02:30:49 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -45,14 +45,14 @@ static AbsoluteTime tm2abstime(struct tm * tm, int tz);
AbsoluteTime
GetCurrentAbsoluteTime(void)
{
- time_t now;
+ time_t now;
#ifdef USE_POSIX_TIME
- struct tm *tm;
+ struct tm *tm;
now = time(NULL);
#else /* ! USE_POSIX_TIME */
- struct timeb tb; /* the old V7-ism */
+ struct timeb tb; /* the old V7-ism */
ftime(&tb);
now = tb.time;
@@ -109,7 +109,7 @@ GetCurrentAbsoluteTime(void)
void
GetCurrentTime(struct tm * tm)
{
- int tz;
+ int tz;
abstime2tm(GetCurrentTransactionStartTime(), &tz, tm, NULL);
@@ -121,10 +121,10 @@ void
abstime2tm(AbsoluteTime time, int *tzp, struct tm * tm, char *tzn)
{
#ifdef USE_POSIX_TIME
- struct tm *tx;
+ struct tm *tx;
#else /* ! USE_POSIX_TIME */
- struct timeb tb; /* the old V7-ism */
+ struct timeb tb; /* the old V7-ism */
ftime(&tb);
#endif
@@ -198,11 +198,11 @@ abstime2tm(AbsoluteTime time, int *tzp, struct tm * tm, char *tzn)
* Convert a tm structure to abstime.
* Note that tm has full year (not 1900-based) and 1-based month.
*/
-static AbsoluteTime
+static AbsoluteTime
tm2abstime(struct tm * tm, int tz)
{
- int day,
- sec;
+ int day,
+ sec;
/* validate, before going out of range on some members */
if (tm->tm_year < 1901 || tm->tm_year > 2038
@@ -241,18 +241,18 @@ tm2abstime(struct tm * tm, int tz)
AbsoluteTime
nabstimein(char *str)
{
- AbsoluteTime result;
+ AbsoluteTime result;
- double fsec;
- int tz = 0;
- struct tm date,
- *tm = &date;
+ double fsec;
+ int tz = 0;
+ struct tm date,
+ *tm = &date;
- char *field[MAXDATEFIELDS];
- char lowstr[MAXDATELEN + 1];
- int dtype;
- int nf,
- ftype[MAXDATEFIELDS];
+ char *field[MAXDATEFIELDS];
+ char lowstr[MAXDATELEN + 1];
+ int dtype;
+ int nf,
+ ftype[MAXDATEFIELDS];
if (!PointerIsValid(str))
elog(WARN, "Bad (null) abstime external representation", NULL);
@@ -270,34 +270,34 @@ nabstimein(char *str)
switch (dtype)
{
- case DTK_DATE:
- result = tm2abstime(tm, tz);
- break;
+ case DTK_DATE:
+ result = tm2abstime(tm, tz);
+ break;
- case DTK_EPOCH:
- result = EPOCH_ABSTIME;
- break;
+ case DTK_EPOCH:
+ result = EPOCH_ABSTIME;
+ break;
- case DTK_CURRENT:
- result = CURRENT_ABSTIME;
- break;
+ case DTK_CURRENT:
+ result = CURRENT_ABSTIME;
+ break;
- case DTK_LATE:
- result = NOEND_ABSTIME;
- break;
+ case DTK_LATE:
+ result = NOEND_ABSTIME;
+ break;
- case DTK_EARLY:
- result = NOSTART_ABSTIME;
- break;
+ case DTK_EARLY:
+ result = NOSTART_ABSTIME;
+ break;
- case DTK_INVALID:
- result = INVALID_ABSTIME;
- break;
+ case DTK_INVALID:
+ result = INVALID_ABSTIME;
+ break;
- default:
- elog(WARN, "Bad abstime (internal coding error) '%s'", str);
- result = INVALID_ABSTIME;
- break;
+ default:
+ elog(WARN, "Bad abstime (internal coding error) '%s'", str);
+ result = INVALID_ABSTIME;
+ break;
};
return result;
@@ -307,41 +307,41 @@ nabstimein(char *str)
/* nabstimeout()
* Given an AbsoluteTime return the English text version of the date
*/
-char *
+char *
nabstimeout(AbsoluteTime time)
{
- char *result;
- int tz;
- double fsec = 0;
- struct tm tt,
- *tm = &tt;
- char buf[MAXDATELEN + 1];
- char zone[MAXDATELEN + 1],
- *tzn = zone;
+ char *result;
+ int tz;
+ double fsec = 0;
+ struct tm tt,
+ *tm = &tt;
+ char buf[MAXDATELEN + 1];
+ char zone[MAXDATELEN + 1],
+ *tzn = zone;
switch (time)
{
- case EPOCH_ABSTIME:
- strcpy(buf, EPOCH);
- break;
- case INVALID_ABSTIME:
- strcpy(buf, INVALID);
- break;
- case CURRENT_ABSTIME:
- strcpy(buf, DCURRENT);
- break;
- case NOEND_ABSTIME:
- strcpy(buf, LATE);
- break;
- case NOSTART_ABSTIME:
- strcpy(buf, EARLY);
- break;
- default:
- abstime2tm(time, &tz, tm, tzn);
+ case EPOCH_ABSTIME:
+ strcpy(buf, EPOCH);
+ break;
+ case INVALID_ABSTIME:
+ strcpy(buf, INVALID);
+ break;
+ case CURRENT_ABSTIME:
+ strcpy(buf, DCURRENT);
+ break;
+ case NOEND_ABSTIME:
+ strcpy(buf, LATE);
+ break;
+ case NOSTART_ABSTIME:
+ strcpy(buf, EARLY);
+ break;
+ default:
+ abstime2tm(time, &tz, tm, tzn);
#if DATEDEBUG
#endif
- EncodeDateTime(tm, fsec, &tz, &tzn, DateStyle, buf);
- break;
+ EncodeDateTime(tm, fsec, &tz, &tzn, DateStyle, buf);
+ break;
}
result = PALLOC(strlen(buf) + 1);
@@ -489,11 +489,11 @@ abstimege(AbsoluteTime t1, AbsoluteTime t2)
AbsoluteTime
datetime_abstime(DateTime * datetime)
{
- AbsoluteTime result;
+ AbsoluteTime result;
- double fsec;
- struct tm tt,
- *tm = &tt;
+ double fsec;
+ struct tm tt,
+ *tm = &tt;
if (!PointerIsValid(datetime))
{
@@ -540,39 +540,39 @@ datetime_abstime(DateTime * datetime)
/* abstime_datetime()
* Convert datetime to abstime.
*/
-DateTime *
+DateTime *
abstime_datetime(AbsoluteTime abstime)
{
- DateTime *result;
+ DateTime *result;
if (!PointerIsValid(result = PALLOCTYPE(DateTime)))
elog(WARN, "Unable to allocate space to convert abstime to datetime", NULL);
switch (abstime)
{
- case INVALID_ABSTIME:
- DATETIME_INVALID(*result);
- break;
+ case INVALID_ABSTIME:
+ DATETIME_INVALID(*result);
+ break;
- case NOSTART_ABSTIME:
- DATETIME_NOBEGIN(*result);
- break;
+ case NOSTART_ABSTIME:
+ DATETIME_NOBEGIN(*result);
+ break;
- case NOEND_ABSTIME:
- DATETIME_NOEND(*result);
- break;
+ case NOEND_ABSTIME:
+ DATETIME_NOEND(*result);
+ break;
- case EPOCH_ABSTIME:
- DATETIME_EPOCH(*result);
- break;
+ case EPOCH_ABSTIME:
+ DATETIME_EPOCH(*result);
+ break;
- case CURRENT_ABSTIME:
- DATETIME_CURRENT(*result);
- break;
+ case CURRENT_ABSTIME:
+ DATETIME_CURRENT(*result);
+ break;
- default:
- *result = abstime + ((date2j(1970, 1, 1) - date2j(2000, 1, 1)) * 86400);
- break;
+ default:
+ *result = abstime + ((date2j(1970, 1, 1) - date2j(2000, 1, 1)) * 86400);
+ break;
};
return (result);
diff --git a/src/backend/utils/adt/name.c b/src/backend/utils/adt/name.c
index b0de03ff602..1c8f4563f7b 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.7 1997/09/07 04:50:27 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/name.c,v 1.8 1997/09/08 02:30:50 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -32,10 +32,10 @@
* [Old] Currently if strlen(s) < NAMEDATALEN, the extra chars are nulls
* Now, always NULL terminated
*/
-NameData *
+NameData *
namein(char *s)
{
- NameData *result;
+ NameData *result;
if (s == NULL)
return (NULL);
@@ -48,7 +48,7 @@ namein(char *s)
/*
* nameout - converts internal reprsentation to "..."
*/
-char *
+char *
nameout(NameData * s)
{
if (s == NULL)
@@ -167,9 +167,9 @@ namestrcpy(Name name, char *str)
int
namestrcat(Name name, char *str)
{
- int i;
- char *p,
- *q;
+ int i;
+ char *p,
+ *q;
if (!name || !str)
return (-1);
@@ -206,8 +206,8 @@ namestrcmp(Name name, char *str)
uint32
NameComputeLength(Name name)
{
- char *charP;
- int length;
+ char *charP;
+ int length;
for (length = 0, charP = name->data;
length < NAMEDATALEN && *charP != '\0';
diff --git a/src/backend/utils/adt/not_in.c b/src/backend/utils/adt/not_in.c
index 0bc51eb6f19..eb8f6533277 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.4 1997/09/07 04:50:29 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.5 1997/09/08 02:30:52 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -29,7 +29,7 @@
#include "access/relscan.h"
#include "utils/builtins.h" /* where function decls go */
-static int my_varattno(Relation rd, char *a);
+static int my_varattno(Relation rd, char *a);
/* ----------------------------------------------------------------
*
@@ -38,20 +38,20 @@ static int my_varattno(Relation rd, char *a);
bool
int4notin(int16 not_in_arg, char *relation_and_attr)
{
- Relation relation_to_scan;
- int left_side_argument,
- integer_value;
- HeapTuple current_tuple;
- HeapScanDesc scan_descriptor;
- bool dummy,
- retval;
- int attrid;
- char *relation,
- *attribute;
- char my_copy[32];
- Datum value;
- NameData relNameData;
- ScanKeyData skeyData;
+ Relation relation_to_scan;
+ int left_side_argument,
+ integer_value;
+ HeapTuple current_tuple;
+ HeapScanDesc scan_descriptor;
+ bool dummy,
+ retval;
+ int attrid;
+ char *relation,
+ *attribute;
+ char my_copy[32];
+ Datum value;
+ NameData relNameData;
+ ScanKeyData skeyData;
strcpy(my_copy, relation_and_attr);
@@ -116,7 +116,7 @@ oidnotin(Oid the_oid, char *compare)
static int
my_varattno(Relation rd, char *a)
{
- int i;
+ int i;
for (i = 0; i < rd->rd_rel->relnatts; i++)
{
diff --git a/src/backend/utils/adt/numutils.c b/src/backend/utils/adt/numutils.c
index 3fd4ae382be..3c698c93c4b 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.14 1997/09/07 04:50:33 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.15 1997/09/08 02:30:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -29,8 +29,8 @@
int32
pg_atoi(char *s, int size, int c)
{
- long l;
- char *badp = (char *) NULL;
+ long l;
+ char *badp = (char *) NULL;
Assert(s);
@@ -43,47 +43,47 @@ pg_atoi(char *s, int size, int c)
switch (size)
{
- case sizeof(int32):
+ case sizeof(int32):
#ifdef HAS_LONG_LONG
- /* won't get ERANGE on these with 64-bit longs... */
- if (l < -0x80000000L)
- {
- errno = ERANGE;
- elog(WARN, "pg_atoi: error reading \"%s\": %m", s);
- }
- if (l > 0x7fffffffL)
- {
- errno = ERANGE;
- elog(WARN, "pg_atoi: error reading \"%s\": %m", s);
- }
+ /* won't get ERANGE on these with 64-bit longs... */
+ if (l < -0x80000000L)
+ {
+ errno = ERANGE;
+ elog(WARN, "pg_atoi: error reading \"%s\": %m", s);
+ }
+ if (l > 0x7fffffffL)
+ {
+ errno = ERANGE;
+ elog(WARN, "pg_atoi: error reading \"%s\": %m", s);
+ }
#endif /* HAS_LONG_LONG */
- break;
- case sizeof(int16):
- if (l < -0x8000)
- {
- errno = ERANGE;
- elog(WARN, "pg_atoi: error reading \"%s\": %m", s);
- }
- if (l > 0x7fff)
- {
- errno = ERANGE;
- elog(WARN, "pg_atoi: error reading \"%s\": %m", s);
- }
- break;
- case sizeof(int8):
- if (l < -0x80)
- {
- errno = ERANGE;
- elog(WARN, "pg_atoi: error reading \"%s\": %m", s);
- }
- if (l > 0x7f)
- {
- errno = ERANGE;
- elog(WARN, "pg_atoi: error reading \"%s\": %m", s);
- }
- break;
- default:
- elog(WARN, "pg_atoi: invalid result size: %d", size);
+ break;
+ case sizeof(int16):
+ if (l < -0x8000)
+ {
+ errno = ERANGE;
+ elog(WARN, "pg_atoi: error reading \"%s\": %m", s);
+ }
+ if (l > 0x7fff)
+ {
+ errno = ERANGE;
+ elog(WARN, "pg_atoi: error reading \"%s\": %m", s);
+ }
+ break;
+ case sizeof(int8):
+ if (l < -0x80)
+ {
+ errno = ERANGE;
+ elog(WARN, "pg_atoi: error reading \"%s\": %m", s);
+ }
+ if (l > 0x7f)
+ {
+ errno = ERANGE;
+ elog(WARN, "pg_atoi: error reading \"%s\": %m", s);
+ }
+ break;
+ default:
+ elog(WARN, "pg_atoi: invalid result size: %d", size);
}
return ((int32) l);
}
@@ -146,9 +146,9 @@ int
ftoa(double value, char *ascii, int width, int prec1, char format)
{
#ifndef HAVE_FCVT
- char out[256];
- char fmt[256];
- int ret;
+ char out[256];
+ char fmt[256];
+ int ret;
sprintf(fmt, "%%%d.%d%c", width, prec1, format);
sprintf(out, fmt, value);
@@ -161,14 +161,14 @@ ftoa(double value, char *ascii, int width, int prec1, char format)
strcpy(ascii, out);
return (ret);
#else
- auto int expon;
- auto int sign;
- register int avail = 0;
- register char *a = NULL;
- register char *p = NULL;
- char mode;
- int lowercase;
- int prec;
+ auto int expon;
+ auto int sign;
+ register int avail = 0;
+ register char *a = NULL;
+ register char *p = NULL;
+ char mode;
+ int lowercase;
+ int prec;
/* extern char *ecvt(), *fcvt();*/
@@ -349,13 +349,13 @@ frac_out:
int
atof1(char *str, double *val)
{
- register char *p;
- double v;
- double fact;
- int minus;
- register char c;
- int expon;
- register int gotmant;
+ register char *p;
+ double v;
+ double fact;
+ int minus;
+ register char c;
+ int expon;
+ register int gotmant;
v = 0.0;
p = str;
@@ -372,11 +372,11 @@ atof1(char *str, double *val)
/* handle possible sign */
switch (c)
{
- case '-':
- minus++;
+ case '-':
+ minus++;
- case '+':
- p++;
+ case '+':
+ p++;
}
/* skip blanks after sign */
diff --git a/src/backend/utils/adt/oid.c b/src/backend/utils/adt/oid.c
index 864c272c793..0e064b44a38 100644
--- a/src/backend/utils/adt/oid.c
+++ b/src/backend/utils/adt/oid.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/oid.c,v 1.9 1997/09/07 04:50:34 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/oid.c,v 1.10 1997/09/08 02:30:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,11 +28,11 @@
* Note:
* Fills any nonexistent digits with NULL oids.
*/
-Oid *
+Oid *
oid8in(char *oidString)
{
- register Oid(*result)[];
- int nums;
+ register Oid(*result)[];
+ int nums;
if (oidString == NULL)
return (NULL);
@@ -57,13 +57,13 @@ oid8in(char *oidString)
/*
* oid8out - converts internal form to "num num ..."
*/
-char *
+char *
oid8out(Oid(*oidArray)[])
{
- register int num;
- register Oid *sp;
- register char *rp;
- char *result;
+ register int num;
+ register Oid *sp;
+ register char *rp;
+ char *result;
if (oidArray == NULL)
{
@@ -93,7 +93,7 @@ oidin(char *s)
return (int4in(s));
}
-char *
+char *
oidout(Oid o)
{
return (int4out(o));
diff --git a/src/backend/utils/adt/oidint2.c b/src/backend/utils/adt/oidint2.c
index 009ab233f78..d40dae7a6cc 100644
--- a/src/backend/utils/adt/oidint2.c
+++ b/src/backend/utils/adt/oidint2.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/oidint2.c,v 1.2 1997/09/07 04:50:35 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/oidint2.c,v 1.3 1997/09/08 02:30:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -21,8 +21,8 @@
OidInt2
oidint2in(char *o)
{
- OidInt2 oi;
- char *p;
+ OidInt2 oi;
+ char *p;
oi = (OidInt2) palloc(sizeof(OidInt2Data));
@@ -42,10 +42,10 @@ oidint2in(char *o)
return (oi);
}
-char *
+char *
oidint2out(OidInt2 o)
{
- char *r;
+ char *r;
/*
* -2147483647/-32767 0 1 1234567890123456789
@@ -111,7 +111,7 @@ oidint2cmp(OidInt2 o1, OidInt2 o2)
OidInt2
mkoidint2(Oid v_oid, uint16 v_int2)
{
- OidInt2 o;
+ OidInt2 o;
o = (OidInt2) palloc(sizeof(OidInt2Data));
o->oi_oid = v_oid;
diff --git a/src/backend/utils/adt/oidint4.c b/src/backend/utils/adt/oidint4.c
index c4da5141acf..18931efc69a 100644
--- a/src/backend/utils/adt/oidint4.c
+++ b/src/backend/utils/adt/oidint4.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/oidint4.c,v 1.2 1997/09/07 04:50:36 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/oidint4.c,v 1.3 1997/09/08 02:30:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -20,8 +20,8 @@
OidInt4
oidint4in(char *o)
{
- OidInt4 oi;
- char *p;
+ OidInt4 oi;
+ char *p;
oi = (OidInt4) palloc(sizeof(OidInt4Data));
@@ -41,10 +41,10 @@ oidint4in(char *o)
return (oi);
}
-char *
+char *
oidint4out(OidInt4 o)
{
- char *r;
+ char *r;
/*
* -2147483647/-2147483647 0 1 2
@@ -60,8 +60,8 @@ bool
oidint4lt(OidInt4 o1, OidInt4 o2)
{
return
- ((bool) (o1->oi_oid < o2->oi_oid ||
- (o1->oi_oid == o2->oi_oid && o1->oi_int4 < o2->oi_int4)));
+ ((bool) (o1->oi_oid < o2->oi_oid ||
+ (o1->oi_oid == o2->oi_oid && o1->oi_int4 < o2->oi_int4)));
}
bool
@@ -111,7 +111,7 @@ oidint4cmp(OidInt4 o1, OidInt4 o2)
OidInt4
mkoidint4(Oid v_oid, uint32 v_int4)
{
- OidInt4 o;
+ OidInt4 o;
o = (OidInt4) palloc(sizeof(OidInt4Data));
o->oi_oid = v_oid;
diff --git a/src/backend/utils/adt/oidname.c b/src/backend/utils/adt/oidname.c
index 30a081f2531..915b953ae49 100644
--- a/src/backend/utils/adt/oidname.c
+++ b/src/backend/utils/adt/oidname.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/oidname.c,v 1.5 1997/09/07 04:50:36 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/oidname.c,v 1.6 1997/09/08 02:30:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -23,8 +23,8 @@
OidName
oidnamein(char *inStr)
{
- OidName oc;
- char *inptr;
+ OidName oc;
+ char *inptr;
oc = (OidName) palloc(sizeof(OidNameData));
@@ -45,12 +45,12 @@ oidnamein(char *inStr)
return oc;
}
-char *
+char *
oidnameout(OidName oidname)
{
- char buf[30 + NAMEDATALEN]; /* oidname length + oid
- * length + some safety */
- char *res;
+ char buf[30 + NAMEDATALEN]; /* oidname length + oid length +
+ * some safety */
+ char *res;
sprintf(buf, "%d,%s", oidname->id, oidname->name.data);
res = pstrdup(buf);
@@ -115,7 +115,7 @@ oidnamecmp(OidName o1, OidName o2)
OidName
mkoidname(Oid id, char *name)
{
- OidName oidname;
+ OidName oidname;
oidname = (OidName) palloc(sizeof(Oid) + NAMEDATALEN);
diff --git a/src/backend/utils/adt/oracle_compat.c b/src/backend/utils/adt/oracle_compat.c
index 99acb57b58f..fb8a512ed79 100644
--- a/src/backend/utils/adt/oracle_compat.c
+++ b/src/backend/utils/adt/oracle_compat.c
@@ -1,7 +1,7 @@
/*
* Edmund Mergl <E.Mergl@bawue.de>
*
- * $Id: oracle_compat.c,v 1.8 1997/09/07 04:50:38 momjian Exp $
+ * $Id: oracle_compat.c,v 1.9 1997/09/08 02:30:57 momjian Exp $
*
*/
@@ -10,16 +10,16 @@
#include "postgres.h"
-text *lower(text * string);
-text *upper(text * string);
-text *initcap(text * string);
-text *lpad(text * string1, int4 len, text * string2);
-text *rpad(text * string1, int4 len, text * string2);
-text *btrim(text * string, text * set);
-text *ltrim(text * string, text * set);
-text *rtrim(text * string, text * set);
-text *substr(text * string, int4 m, int4 n);
-text *translate(text * string, char from, char to);
+text *lower(text * string);
+text *upper(text * string);
+text *initcap(text * string);
+text *lpad(text * string1, int4 len, text * string2);
+text *rpad(text * string1, int4 len, text * string2);
+text *btrim(text * string, text * set);
+text *ltrim(text * string, text * set);
+text *rtrim(text * string, text * set);
+text *substr(text * string, int4 m, int4 n);
+text *translate(text * string, char from, char to);
/********************************************************************
@@ -36,13 +36,13 @@ text *translate(text * string, char from, char to);
*
********************************************************************/
-text *
+text *
lower(text * string)
{
- text *ret;
- char *ptr,
- *ptr_ret;
- int m;
+ text *ret;
+ char *ptr,
+ *ptr_ret;
+ int m;
if ((string == (text *) NULL) || ((m = VARSIZE(string) - VARHDRSZ) <= 0))
return string;
@@ -76,13 +76,13 @@ lower(text * string)
*
********************************************************************/
-text *
+text *
upper(text * string)
{
- text *ret;
- char *ptr,
- *ptr_ret;
- int m;
+ text *ret;
+ char *ptr,
+ *ptr_ret;
+ int m;
if ((string == (text *) NULL) || ((m = VARSIZE(string) - VARHDRSZ) <= 0))
return string;
@@ -118,13 +118,13 @@ upper(text * string)
*
********************************************************************/
-text *
+text *
initcap(text * string)
{
- text *ret;
- char *ptr,
- *ptr_ret;
- int m;
+ text *ret;
+ char *ptr,
+ *ptr_ret;
+ int m;
if ((string == (text *) NULL) || ((m = VARSIZE(string) - VARHDRSZ) <= 0))
return string;
@@ -169,15 +169,15 @@ initcap(text * string)
*
********************************************************************/
-text *
+text *
lpad(text * string1, int4 len, text * string2)
{
- text *ret;
- char *ptr1,
- *ptr2,
- *ptr_ret;
- int m,
- n;
+ text *ret;
+ char *ptr1,
+ *ptr2,
+ *ptr_ret;
+ int m,
+ n;
if ((string1 == (text *) NULL) ||
(len <= (VARSIZE(string1) - VARHDRSZ)) ||
@@ -225,15 +225,15 @@ lpad(text * string1, int4 len, text * string2)
*
********************************************************************/
-text *
+text *
rpad(text * string1, int4 len, text * string2)
{
- text *ret;
- char *ptr1,
- *ptr2,
- *ptr_ret;
- int m,
- n;
+ text *ret;
+ char *ptr1,
+ *ptr2,
+ *ptr_ret;
+ int m,
+ n;
if ((string1 == (text *) NULL) ||
(len <= (VARSIZE(string1) - VARHDRSZ)) ||
@@ -281,15 +281,15 @@ rpad(text * string1, int4 len, text * string2)
*
********************************************************************/
-text *
+text *
btrim(text * string, text * set)
{
- text *ret;
- char *ptr,
- *end,
- *ptr2,
- *end2;
- int m;
+ text *ret;
+ char *ptr,
+ *end,
+ *ptr2,
+ *end2;
+ int m;
if ((string == (text *) NULL) ||
((m = VARSIZE(string) - VARHDRSZ) <= 0) ||
@@ -367,14 +367,14 @@ btrim(text * string, text * set)
*
********************************************************************/
-text *
+text *
ltrim(text * string, text * set)
{
- text *ret;
- char *ptr,
- *ptr2,
- *end2;
- int m;
+ text *ret;
+ char *ptr,
+ *ptr2,
+ *end2;
+ int m;
if ((string == (text *) NULL) ||
((m = VARSIZE(string) - VARHDRSZ) <= 0) ||
@@ -430,15 +430,15 @@ ltrim(text * string, text * set)
*
********************************************************************/
-text *
+text *
rtrim(text * string, text * set)
{
- text *ret;
- char *ptr,
- *ptr2,
- *end2,
- *ptr_ret;
- int m;
+ text *ret;
+ char *ptr,
+ *ptr2,
+ *end2,
+ *ptr_ret;
+ int m;
if ((string == (text *) NULL) ||
((m = VARSIZE(string) - VARHDRSZ) <= 0) ||
@@ -502,13 +502,13 @@ rtrim(text * string, text * set)
*
********************************************************************/
-text *
+text *
substr(text * string, int4 m, int4 n)
{
- text *ret;
- char *ptr,
- *ptr_ret;
- int len;
+ text *ret;
+ char *ptr,
+ *ptr_ret;
+ int len;
if ((string == (text *) NULL) ||
(m <= 0) || (n <= 0) ||
@@ -548,13 +548,13 @@ substr(text * string, int4 m, int4 n)
*
********************************************************************/
-text *
+text *
translate(text * string, char from, char to)
{
- text *ret;
- char *ptr,
- *ptr_ret;
- int m;
+ text *ret;
+ char *ptr,
+ *ptr_ret;
+ int m;
if ((string == (text *) NULL) ||
((m = VARSIZE(string) - VARHDRSZ) <= 0))
diff --git a/src/backend/utils/adt/regexp.c b/src/backend/utils/adt/regexp.c
index e7d982785ba..5c94ca8bb8d 100644
--- a/src/backend/utils/adt/regexp.c
+++ b/src/backend/utils/adt/regexp.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.8 1997/09/07 04:50:39 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.9 1997/09/08 02:30:58 momjian Exp $
*
* Alistair Crooks added the code for the regex caching
* agc - cached the regular expressions used - there's a good chance
@@ -47,13 +47,13 @@
struct cached_re_str
{
struct varlena *cre_text; /* pattern as a text* */
- char *cre_s; /* pattern as null-terminated string */
- int cre_type; /* compiled-type: extended,icase etc */
- regex_t cre_re; /* the compiled regular expression */
- unsigned long cre_lru; /* lru tag */
+ char *cre_s; /* pattern as null-terminated string */
+ int cre_type; /* compiled-type: extended,icase etc */
+ regex_t cre_re; /* the compiled regular expression */
+ unsigned long cre_lru; /* lru tag */
};
-static int rec = 0; /* # of cached re's */
+static int rec = 0; /* # of cached re's */
static struct cached_re_str rev[MAX_CACHED_RES]; /* cached re's */
static unsigned long lru; /* system lru tag */
@@ -62,11 +62,11 @@ static unsigned long lru; /* system lru tag */
static int
RE_compile_and_execute(struct varlena * text_re, char *text, int cflags)
{
- int oldest;
- int n;
- int i;
- char *re;
- int regcomp_result;
+ int oldest;
+ int n;
+ int i;
+ char *re;
+ int regcomp_result;
re = textout(text_re);
/* find a previously compiled regular expression */
@@ -151,7 +151,7 @@ RE_compile_and_execute(struct varlena * text_re, char *text, int cflags)
}
else
{
- char errMsg[1000];
+ char errMsg[1000];
/* re didn't compile */
rev[oldest].cre_s = (char *) NULL;
@@ -178,11 +178,11 @@ RE_compile_and_execute(struct varlena * text_re, char *text, int cflags)
p - the pattern
charlen - the length of the string
*/
-static bool
+static bool
fixedlen_regexeq(char *s, struct varlena * p, int charlen, int cflags)
{
- char *sterm;
- int result;
+ char *sterm;
+ int result;
if (!s || !p)
return FALSE;
@@ -206,7 +206,7 @@ fixedlen_regexeq(char *s, struct varlena * p, int charlen, int cflags)
bool
char2regexeq(uint16 arg1, struct varlena * p)
{
- char *s = (char *) &arg1;
+ char *s = (char *) &arg1;
return (fixedlen_regexeq(s, p, 2, REG_EXTENDED));
}
@@ -220,7 +220,7 @@ char2regexne(uint16 arg1, struct varlena * p)
bool
char4regexeq(uint32 arg1, struct varlena * p)
{
- char *s = (char *) &arg1;
+ char *s = (char *) &arg1;
return (fixedlen_regexeq(s, p, 4, REG_EXTENDED));
}
@@ -291,7 +291,7 @@ textregexne(struct varlena * s, struct varlena * p)
bool
char2icregexeq(uint16 arg1, struct varlena * p)
{
- char *s = (char *) &arg1;
+ char *s = (char *) &arg1;
return (fixedlen_regexeq(s, p, 2, REG_ICASE | REG_EXTENDED));
}
@@ -306,7 +306,7 @@ char2icregexne(uint16 arg1, struct varlena * p)
bool
char4icregexeq(uint32 arg1, struct varlena * p)
{
- char *s = (char *) &arg1;
+ char *s = (char *) &arg1;
return (fixedlen_regexeq(s, p, 4, REG_ICASE | REG_EXTENDED));
}
diff --git a/src/backend/utils/adt/regproc.c b/src/backend/utils/adt/regproc.c
index 6a4e8b01e50..ea3a66fe05e 100644
--- a/src/backend/utils/adt/regproc.c
+++ b/src/backend/utils/adt/regproc.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.6 1997/09/07 04:50:41 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.7 1997/09/08 02:30:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -33,12 +33,12 @@
int32
regprocin(char *proname)
{
- Relation proc;
- HeapScanDesc procscan;
- HeapTuple proctup;
- ScanKeyData key;
- RegProcedure result = (Oid) 0;
- bool isnull;
+ Relation proc;
+ HeapScanDesc procscan;
+ HeapTuple proctup;
+ ScanKeyData key;
+ RegProcedure result = (Oid) 0;
+ bool isnull;
if (proname == NULL)
return (0);
@@ -66,21 +66,21 @@ regprocin(char *proname)
proctup = heap_getnext(procscan, 0, (Buffer *) NULL);
switch (HeapTupleIsValid(proctup))
{
- case 1:
- result = (RegProcedure) heap_getattr(proctup,
- InvalidBuffer,
- ObjectIdAttributeNumber,
+ case 1:
+ result = (RegProcedure) heap_getattr(proctup,
+ InvalidBuffer,
+ ObjectIdAttributeNumber,
RelationGetTupleDescriptor(proc),
- &isnull);
- if (isnull)
- {
- elog(FATAL, "regprocin: null procedure %s", proname);
- }
- break;
- case 0:
- result = (RegProcedure) 0;
+ &isnull);
+ if (isnull)
+ {
+ elog(FATAL, "regprocin: null procedure %s", proname);
+ }
+ break;
+ case 0:
+ result = (RegProcedure) 0;
#ifdef EBUG
- elog(DEBUG, "regprocin: no such procedure %s", proname);
+ elog(DEBUG, "regprocin: no such procedure %s", proname);
#endif /* defined(EBUG) */
}
heap_endscan(procscan);
@@ -91,14 +91,14 @@ regprocin(char *proname)
/*
* regprocout - converts proid to "proname"
*/
-char *
+char *
regprocout(RegProcedure proid)
{
- Relation proc;
- HeapScanDesc procscan;
- HeapTuple proctup;
- char *result;
- ScanKeyData key;
+ Relation proc;
+ HeapScanDesc procscan;
+ HeapTuple proctup;
+ char *result;
+ ScanKeyData key;
result = (char *) palloc(NAMEDATALEN);
proc = heap_openr(ProcedureRelationName);
@@ -125,24 +125,24 @@ regprocout(RegProcedure proid)
proctup = heap_getnext(procscan, 0, (Buffer *) NULL);
switch (HeapTupleIsValid(proctup))
{
- char *s;
- bool isnull;
+ char *s;
+ bool isnull;
- case 1:
- s = (char *) heap_getattr(proctup, InvalidBuffer, 1,
+ case 1:
+ s = (char *) heap_getattr(proctup, InvalidBuffer, 1,
RelationGetTupleDescriptor(proc), &isnull);
- if (!isnull)
- {
- strNcpy(result, s, 16);
- break;
- }
- elog(FATAL, "regprocout: null procedure %d", proid);
- /* FALLTHROUGH */
- case 0:
- result[0] = '-';
- result[1] = '\0';
+ if (!isnull)
+ {
+ strNcpy(result, s, 16);
+ break;
+ }
+ elog(FATAL, "regprocout: null procedure %d", proid);
+ /* FALLTHROUGH */
+ case 0:
+ result[0] = '-';
+ result[1] = '\0';
#ifdef EBUG
- elog(DEBUG, "regprocout: no such procedure %d", proid);
+ elog(DEBUG, "regprocout: no such procedure %d", proid);
#endif /* defined(EBUG) */
}
heap_endscan(procscan);
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
index 3f8c225ca9e..e58bdf11b8f 100644
--- a/src/backend/utils/adt/selfuncs.c
+++ b/src/backend/utils/adt/selfuncs.c
@@ -12,7 +12,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.9 1997/09/07 04:50:42 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.10 1997/09/08 02:31:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -57,7 +57,7 @@ eqsel(Oid opid,
char *value,
int32 flag)
{
- float64 result;
+ float64 result;
result = (float64) palloc(sizeof(float64data));
if (NONVALUE(attno) || NONVALUE(relid))
@@ -77,7 +77,7 @@ neqsel(Oid opid,
char *value,
int32 flag)
{
- float64 result;
+ float64 result;
result = eqsel(opid, relid, attno, value, flag);
*result = 1.0 - *result;
@@ -95,14 +95,14 @@ intltsel(Oid opid,
int32 value,
int32 flag)
{
- float64 result;
- char *highchar,
- *lowchar;
- long val,
- high,
- low,
- top,
- bottom;
+ float64 result;
+ char *highchar,
+ *lowchar;
+ long val,
+ high,
+ low,
+ top,
+ bottom;
result = (float64) palloc(sizeof(float64data));
if (NONVALUE(attno) || NONVALUE(relid))
@@ -122,7 +122,7 @@ intltsel(Oid opid,
if ((flag & SEL_RIGHT && val < low) ||
(!(flag & SEL_RIGHT) && val > high))
{
- float32data nvals;
+ float32data nvals;
nvals = getattdisbursion(relid, (int) attno);
if (nvals == 0)
@@ -167,8 +167,8 @@ intgtsel(Oid opid,
int32 value,
int32 flag)
{
- float64 result;
- int notflag;
+ float64 result;
+ int notflag;
if (flag & 0)
notflag = flag & ~SEL_RIGHT;
@@ -188,10 +188,10 @@ eqjoinsel(Oid opid,
Oid relid2,
AttrNumber attno2)
{
- float64 result;
- float32data num1,
- num2,
- max;
+ float64 result;
+ float32data num1,
+ num2,
+ max;
result = (float64) palloc(sizeof(float64data));
if (NONVALUE(attno1) || NONVALUE(relid1) ||
@@ -220,7 +220,7 @@ neqjoinsel(Oid opid,
Oid relid2,
AttrNumber attno2)
{
- float64 result;
+ float64 result;
result = eqjoinsel(opid, relid1, attno1, relid2, attno2);
*result = 1.0 - *result;
@@ -237,7 +237,7 @@ intltjoinsel(Oid opid,
Oid relid2,
AttrNumber attno2)
{
- float64 result;
+ float64 result;
result = (float64) palloc(sizeof(float64data));
*result = 1.0 / 3.0;
@@ -254,7 +254,7 @@ intgtjoinsel(Oid opid,
Oid relid2,
AttrNumber attno2)
{
- float64 result;
+ float64 result;
result = (float64) palloc(sizeof(float64data));
*result = 1.0 / 3.0;
@@ -275,12 +275,12 @@ intgtjoinsel(Oid opid,
* more efficient. However, the cast will not work
* for gethilokey which accesses stahikey in struct statistic.
*/
-static float32data
+static float32data
getattdisbursion(Oid relid, AttrNumber attnum)
{
- HeapTuple atp;
- float32data nvals;
- int32 ntuples;
+ HeapTuple atp;
+ float32data nvals;
+ int32 ntuples;
atp = SearchSysCacheTuple(ATTNUM,
ObjectIdGetDatum(relid),
@@ -342,8 +342,8 @@ gethilokey(Oid relid,
{0, Anum_pg_statistic_staattnum, F_INT2EQ},
{0, Anum_pg_statistic_staop, F_OIDEQ}
};
- bool isnull;
- HeapTuple tuple;
+ bool isnull;
+ HeapTuple tuple;
rdesc = heap_openr(StatisticRelationName);
@@ -392,8 +392,8 @@ btreesel(Oid operatorObjectId,
int32 nIndexKeys,
Oid indexrelid)
{
- float64 result;
- float64data resultData;
+ float64 result;
+ float64data resultData;
if (FunctionalSelectivity(nIndexKeys, attributeNumber))
{
@@ -434,11 +434,11 @@ btreenpage(Oid operatorObjectId,
int32 nIndexKeys,
Oid indexrelid)
{
- float64 temp,
- result;
- float64data tempData;
- HeapTuple atp;
- int npage;
+ float64 temp,
+ result;
+ float64data tempData;
+ HeapTuple atp;
+ int npage;
if (FunctionalSelectivity(nIndexKeys, attributeNumber))
{
@@ -486,10 +486,10 @@ hashsel(Oid operatorObjectId,
Oid indexrelid)
{
- float64 result;
- float64data resultData;
- HeapTuple atp;
- int ntuples;
+ float64 result;
+ float64data resultData;
+ HeapTuple atp;
+ int ntuples;
if (FunctionalSelectivity(nIndexKeys, attributeNumber))
{
@@ -549,12 +549,12 @@ hashnpage(Oid operatorObjectId,
int32 nIndexKeys,
Oid indexrelid)
{
- float64 temp,
- result;
- float64data tempData;
- HeapTuple atp;
- int npage;
- int ntuples;
+ float64 temp,
+ result;
+ float64data tempData;
+ HeapTuple atp;
+ int npage;
+ int ntuples;
atp = SearchSysCacheTuple(RELOID, ObjectIdGetDatum(indexrelid),
0, 0, 0);
diff --git a/src/backend/utils/adt/sets.c b/src/backend/utils/adt/sets.c
index 72f0a615a66..70bfecc9774 100644
--- a/src/backend/utils/adt/sets.c
+++ b/src/backend/utils/adt/sets.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.6 1997/09/07 04:50:43 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.7 1997/09/08 02:31:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -42,20 +42,20 @@ extern CommandDest whereToSendOutput; /* defined in tcop/postgres.c */
Oid
SetDefine(char *querystr, char *typename)
{
- Oid setoid;
- char *procname = GENERICSETNAME;
- char *fileName = "-";
- char realprocname[16];
- HeapTuple tup,
- newtup = NULL;
- Form_pg_proc proc;
- Relation procrel;
- int i;
- Datum replValue[Natts_pg_proc];
- char replNull[Natts_pg_proc];
- char repl[Natts_pg_proc];
- HeapScanDesc pg_proc_scan;
- Buffer buffer;
+ Oid setoid;
+ char *procname = GENERICSETNAME;
+ char *fileName = "-";
+ char realprocname[16];
+ HeapTuple tup,
+ newtup = NULL;
+ Form_pg_proc proc;
+ Relation procrel;
+ int i;
+ Datum replValue[Natts_pg_proc];
+ char replNull[Natts_pg_proc];
+ char repl[Natts_pg_proc];
+ HeapScanDesc pg_proc_scan;
+ Buffer buffer;
ItemPointerData ipdata;
static ScanKeyData oidKey[1] = {
@@ -149,7 +149,7 @@ SetDefine(char *querystr, char *typename)
if (RelationGetRelationTupleForm(procrel)->relhasindex)
{
- Relation idescs[Num_pg_proc_indices];
+ Relation idescs[Num_pg_proc_indices];
CatalogOpenIndices(Num_pg_proc_indices, Name_pg_proc_indices, idescs);
CatalogIndexInsert(idescs, Num_pg_proc_indices, procrel, newtup);
diff --git a/src/backend/utils/adt/tid.c b/src/backend/utils/adt/tid.c
index fe10f2b58e3..f394f081622 100644
--- a/src/backend/utils/adt/tid.c
+++ b/src/backend/utils/adt/tid.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/tid.c,v 1.3 1997/09/07 04:50:46 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/tid.c,v 1.4 1997/09/08 02:31:03 momjian Exp $
*
* NOTES
* input routine largely stolen from boxin().
@@ -35,13 +35,13 @@
ItemPointer
tidin(char *str)
{
- char *p,
- *coord[NTIDARGS];
- int i;
- ItemPointer result;
+ char *p,
+ *coord[NTIDARGS];
+ int i;
+ ItemPointer result;
- BlockNumber blockNumber;
- OffsetNumber offsetNumber;
+ BlockNumber blockNumber;
+ OffsetNumber offsetNumber;
if (str == NULL)
return NULL;
@@ -67,14 +67,14 @@ tidin(char *str)
* tidout
* ----------------------------------------------------------------
*/
-char *
+char *
tidout(ItemPointer itemPtr)
{
- BlockNumber blockNumber;
- OffsetNumber offsetNumber;
- BlockId blockId;
- char buf[32];
- char *str;
+ BlockNumber blockNumber;
+ OffsetNumber offsetNumber;
+ BlockId blockId;
+ char buf[32];
+ char *str;
blockId = &(itemPtr->ip_blkid);
diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c
index d9ed6d299c5..09fabfe72a0 100644
--- a/src/backend/utils/adt/timestamp.c
+++ b/src/backend/utils/adt/timestamp.c
@@ -16,7 +16,7 @@
static const char *
cpstr(const char *s, char *buf)
{
- char in = 0;
+ char in = 0;
while (isspace(*s))
s++;
@@ -43,12 +43,12 @@ cpstr(const char *s, char *buf)
time_t
timestamp_in(const char *timestamp_str)
{
- int4 result;
+ int4 result;
#if FALSE
- struct tm input_time;
- char buf[18];
- const char *p;
+ struct tm input_time;
+ char buf[18];
+ const char *p;
static const char *mstr[] = {
"january", "february", "march", "april", "may", "june",
"july", "august", "september", "october", "november", "december"
@@ -72,7 +72,7 @@ timestamp_in(const char *timestamp_str)
}
else
{
- int i;
+ int i;
for (i = 0; i < 12; i++)
if (strncmp(mstr[i], buf, strlen(buf)) == 0)
@@ -86,7 +86,7 @@ timestamp_in(const char *timestamp_str)
else
/* must be month/dd/yyyy */
{
- int i;
+ int i;
for (i = 0; i < 12; i++)
if (strncmp(mstr[i], buf, strlen(buf)) == 0)
@@ -126,17 +126,17 @@ timestamp_in(const char *timestamp_str)
return result;
}
-char *
+char *
timestamp_out(time_t timestamp)
{
- char *result;
- int tz;
- double fsec = 0;
- struct tm tt,
- *tm = &tt;
- char buf[MAXDATELEN + 1];
- char zone[MAXDATELEN + 1],
- *tzn = zone;
+ char *result;
+ int tz;
+ double fsec = 0;
+ struct tm tt,
+ *tm = &tt;
+ char buf[MAXDATELEN + 1];
+ char zone[MAXDATELEN + 1],
+ *tzn = zone;
#if FALSE
time = localtime(&timestamp);
@@ -156,7 +156,7 @@ timestamp_out(time_t timestamp)
time_t
now(void)
{
- time_t sec;
+ time_t sec;
time(&sec);
return (sec);
@@ -198,13 +198,13 @@ timestampge(time_t t1, time_t t2)
return difftime(t1, t2) <= 0;
}
-DateTime *
+DateTime *
timestamp_datetime(time_t timestamp)
{
- DateTime *result;
+ DateTime *result;
- double fsec = 0;
- struct tm *tm;
+ double fsec = 0;
+ struct tm *tm;
if (!PointerIsValid(result = PALLOCTYPE(DateTime)))
elog(WARN, "Memory allocation failed, can't convert timestamp to datetime", NULL);
diff --git a/src/backend/utils/adt/varchar.c b/src/backend/utils/adt/varchar.c
index 106ff5dad26..a9977fa6414 100644
--- a/src/backend/utils/adt/varchar.c
+++ b/src/backend/utils/adt/varchar.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.9 1997/09/07 04:52:53 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.10 1997/09/08 02:31:05 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -49,13 +49,13 @@
* len is the length specified in () plus 4 bytes. (XXX dummy is here
* because we pass typelem as the second argument for array_in.)
*/
-char *
+char *
bpcharin(char *s, int dummy, int typlen)
{
- char *result,
- *r;
- int len = typlen - 4;
- int i;
+ char *result,
+ *r;
+ int len = typlen - 4;
+ int i;
if (s == NULL)
return ((char *) NULL);
@@ -90,11 +90,11 @@ bpcharin(char *s, int dummy, int typlen)
return (result);
}
-char *
+char *
bpcharout(char *s)
{
- char *result;
- int len;
+ char *result;
+ int len;
if (s == NULL)
{
@@ -121,11 +121,11 @@ bpcharout(char *s)
* len is the length specified in () plus 4 bytes. (XXX dummy is here
* because we pass typelem as the second argument for array_in.)
*/
-char *
+char *
varcharin(char *s, int dummy, int typlen)
{
- char *result;
- int len = typlen - 4;
+ char *result;
+ int len = typlen - 4;
if (s == NULL)
return ((char *) NULL);
@@ -150,11 +150,11 @@ varcharin(char *s, int dummy, int typlen)
return (result);
}
-char *
+char *
varcharout(char *s)
{
- char *result;
- int len;
+ char *result;
+ int len;
if (s == NULL)
{
@@ -178,9 +178,9 @@ varcharout(char *s)
static int
bcTruelen(char *arg)
{
- char *s = arg + 4;
- int i;
- int len;
+ char *s = arg + 4;
+ int i;
+ int len;
len = *(int32 *) arg - 4;
for (i = len - 1; i >= 0; i--)
@@ -194,8 +194,8 @@ bcTruelen(char *arg)
bool
bpchareq(char *arg1, char *arg2)
{
- int len1,
- len2;
+ int len1,
+ len2;
if (arg1 == NULL || arg2 == NULL)
return ((bool) 0);
@@ -211,8 +211,8 @@ bpchareq(char *arg1, char *arg2)
bool
bpcharne(char *arg1, char *arg2)
{
- int len1,
- len2;
+ int len1,
+ len2;
if (arg1 == NULL || arg2 == NULL)
return ((bool) 0);
@@ -228,9 +228,9 @@ bpcharne(char *arg1, char *arg2)
bool
bpcharlt(char *arg1, char *arg2)
{
- int len1,
- len2;
- int cmp;
+ int len1,
+ len2;
+ int cmp;
if (arg1 == NULL || arg2 == NULL)
return ((bool) 0);
@@ -247,9 +247,9 @@ bpcharlt(char *arg1, char *arg2)
bool
bpcharle(char *arg1, char *arg2)
{
- int len1,
- len2;
- int cmp;
+ int len1,
+ len2;
+ int cmp;
if (arg1 == NULL || arg2 == NULL)
return ((bool) 0);
@@ -266,9 +266,9 @@ bpcharle(char *arg1, char *arg2)
bool
bpchargt(char *arg1, char *arg2)
{
- int len1,
- len2;
- int cmp;
+ int len1,
+ len2;
+ int cmp;
if (arg1 == NULL || arg2 == NULL)
return ((bool) 0);
@@ -285,9 +285,9 @@ bpchargt(char *arg1, char *arg2)
bool
bpcharge(char *arg1, char *arg2)
{
- int len1,
- len2;
- int cmp;
+ int len1,
+ len2;
+ int cmp;
if (arg1 == NULL || arg2 == NULL)
return ((bool) 0);
@@ -304,9 +304,9 @@ bpcharge(char *arg1, char *arg2)
int32
bpcharcmp(char *arg1, char *arg2)
{
- int len1,
- len2;
- int cmp;
+ int len1,
+ len2;
+ int cmp;
len1 = bcTruelen(arg1);
len2 = bcTruelen(arg2);
@@ -325,9 +325,9 @@ bpcharcmp(char *arg1, char *arg2)
static int
vcTruelen(char *arg)
{
- char *s = arg + 4;
- int i;
- int len;
+ char *s = arg + 4;
+ int i;
+ int len;
len = *(int32 *) arg - 4;
for (i = 0; i < len; i++)
@@ -341,8 +341,8 @@ vcTruelen(char *arg)
bool
varchareq(char *arg1, char *arg2)
{
- int len1,
- len2;
+ int len1,
+ len2;
if (arg1 == NULL || arg2 == NULL)
return ((bool) 0);
@@ -358,8 +358,8 @@ varchareq(char *arg1, char *arg2)
bool
varcharne(char *arg1, char *arg2)
{
- int len1,
- len2;
+ int len1,
+ len2;
if (arg1 == NULL || arg2 == NULL)
return ((bool) 0);
@@ -375,9 +375,9 @@ varcharne(char *arg1, char *arg2)
bool
varcharlt(char *arg1, char *arg2)
{
- int len1,
- len2;
- int cmp;
+ int len1,
+ len2;
+ int cmp;
if (arg1 == NULL || arg2 == NULL)
return ((bool) 0);
@@ -394,9 +394,9 @@ varcharlt(char *arg1, char *arg2)
bool
varcharle(char *arg1, char *arg2)
{
- int len1,
- len2;
- int cmp;
+ int len1,
+ len2;
+ int cmp;
if (arg1 == NULL || arg2 == NULL)
return ((bool) 0);
@@ -413,9 +413,9 @@ varcharle(char *arg1, char *arg2)
bool
varchargt(char *arg1, char *arg2)
{
- int len1,
- len2;
- int cmp;
+ int len1,
+ len2;
+ int cmp;
if (arg1 == NULL || arg2 == NULL)
return ((bool) 0);
@@ -432,9 +432,9 @@ varchargt(char *arg1, char *arg2)
bool
varcharge(char *arg1, char *arg2)
{
- int len1,
- len2;
- int cmp;
+ int len1,
+ len2;
+ int cmp;
if (arg1 == NULL || arg2 == NULL)
return ((bool) 0);
@@ -452,9 +452,9 @@ varcharge(char *arg1, char *arg2)
int32
varcharcmp(char *arg1, char *arg2)
{
- int len1,
- len2;
- int cmp;
+ int len1,
+ len2;
+ int cmp;
len1 = vcTruelen(arg1);
len2 = vcTruelen(arg2);
@@ -472,10 +472,10 @@ varcharcmp(char *arg1, char *arg2)
uint32
hashbpchar(struct varlena * key)
{
- int keylen;
- char *keydata;
- uint32 n;
- int loop;
+ int keylen;
+ char *keydata;
+ uint32 n;
+ int loop;
keydata = VARDATA(key);
keylen = bcTruelen((char *) key);
@@ -489,25 +489,25 @@ hashbpchar(struct varlena * key)
switch (keylen & (8 - 1))
{
- case 0:
- do
- { /* All fall throughs */
- HASHC;
- case 7:
- HASHC;
- case 6:
- HASHC;
- case 5:
- HASHC;
- case 4:
- HASHC;
- case 3:
- HASHC;
- case 2:
- HASHC;
- case 1:
- HASHC;
- } while (--loop);
+ case 0:
+ do
+ { /* All fall throughs */
+ HASHC;
+ case 7:
+ HASHC;
+ case 6:
+ HASHC;
+ case 5:
+ HASHC;
+ case 4:
+ HASHC;
+ case 3:
+ HASHC;
+ case 2:
+ HASHC;
+ case 1:
+ HASHC;
+ } while (--loop);
}
}
return (n);
@@ -516,10 +516,10 @@ hashbpchar(struct varlena * key)
uint32
hashvarchar(struct varlena * key)
{
- int keylen;
- char *keydata;
- uint32 n;
- int loop;
+ int keylen;
+ char *keydata;
+ uint32 n;
+ int loop;
keydata = VARDATA(key);
keylen = vcTruelen((char *) key);
@@ -533,25 +533,25 @@ hashvarchar(struct varlena * key)
switch (keylen & (8 - 1))
{
- case 0:
- do
- { /* All fall throughs */
- HASHC;
- case 7:
- HASHC;
- case 6:
- HASHC;
- case 5:
- HASHC;
- case 4:
- HASHC;
- case 3:
- HASHC;
- case 2:
- HASHC;
- case 1:
- HASHC;
- } while (--loop);
+ case 0:
+ do
+ { /* All fall throughs */
+ HASHC;
+ case 7:
+ HASHC;
+ case 6:
+ HASHC;
+ case 5:
+ HASHC;
+ case 4:
+ HASHC;
+ case 3:
+ HASHC;
+ case 2:
+ HASHC;
+ case 1:
+ HASHC;
+ } while (--loop);
}
}
return (n);
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 273fae92e9e..ccd4b9c0acd 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.19 1997/09/07 04:52:54 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.20 1997/09/08 02:31:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -40,9 +40,9 @@
struct varlena *
byteain(char *inputText)
{
- register char *tp;
- register char *rp;
- register int byte;
+ register char *tp;
+ register char *rp;
+ register int byte;
struct varlena *result;
if (inputText == NULL)
@@ -107,15 +107,15 @@ shove_bytes(unsigned char *stuff, int len)
*
* NULL vlena should be an error--returning string with NULL for now.
*/
-char *
+char *
byteaout(struct varlena * vlena)
{
- register char *vp;
- register char *rp;
- register int val; /* holds unprintable chars */
- int i;
- int len;
- static char *result;
+ register char *vp;
+ register char *rp;
+ register int val; /* holds unprintable chars */
+ int i;
+ int len;
+ static char *result;
if (vlena == NULL)
{
@@ -168,7 +168,7 @@ struct varlena *
textin(char *inputText)
{
struct varlena *result;
- int len;
+ int len;
if (inputText == NULL)
return (NULL);
@@ -182,11 +182,11 @@ textin(char *inputText)
/*
* textout - converts internal representation to "..."
*/
-char *
+char *
textout(struct varlena * vlena)
{
- int len;
- char *result;
+ int len;
+ char *result;
if (vlena == NULL)
{
@@ -214,9 +214,9 @@ textout(struct varlena * vlena)
int
textlen(text * t)
{
- int i = 0;
- int max = VARSIZE(t) - VARHDRSZ;
- char *ptr = VARDATA(t);
+ int i = 0;
+ int max = VARSIZE(t) - VARHDRSZ;
+ char *ptr = VARDATA(t);
while (i < max && *ptr++)
i++;
@@ -238,14 +238,14 @@ textlen(text * t)
* Is this OK?
*/
-text *
+text *
textcat(text * t1, text * t2)
{
- int len1,
- len2,
- len;
- char *ptr;
- text *result;
+ int len1,
+ len2,
+ len;
+ char *ptr;
+ text *result;
if (!PointerIsValid(t1) && !PointerIsValid(t2))
return (NULL);
@@ -283,13 +283,13 @@ textcat(text * t1, text * t2)
int32
textpos(text * t1, text * t2)
{
- int pos;
- int px,
- p;
- int len1,
- len2;
- char *p1,
- *p2;
+ int pos;
+ int px,
+ p;
+ int len1,
+ len2;
+ char *p1,
+ *p2;
if (!PointerIsValid(t1) || !PointerIsValid(t2))
return (0);
@@ -322,9 +322,9 @@ textpos(text * t1, text * t2)
bool
texteq(struct varlena * arg1, struct varlena * arg2)
{
- register int len;
- register char *a1p,
- *a2p;
+ register int len;
+ register char *a1p,
+ *a2p;
if (arg1 == NULL || arg2 == NULL)
return ((bool) NULL);
@@ -361,15 +361,15 @@ textne(struct varlena * arg1, struct varlena * arg2)
bool
text_lt(struct varlena * arg1, struct varlena * arg2)
{
- bool result;
+ bool result;
#ifdef USE_LOCALE
- int cval;
+ int cval;
#endif
- int len;
- unsigned char *a1p,
- *a2p;
+ int len;
+ unsigned char *a1p,
+ *a2p;
if (arg1 == NULL || arg2 == NULL)
return ((bool) FALSE);
@@ -417,15 +417,15 @@ text_lt(struct varlena * arg1, struct varlena * arg2)
bool
text_le(struct varlena * arg1, struct varlena * arg2)
{
- bool result;
+ bool result;
#ifdef USE_LOCALE
- int cval;
+ int cval;
#endif
- int len;
- unsigned char *a1p,
- *a2p;
+ int len;
+ unsigned char *a1p,
+ *a2p;
if (arg1 == NULL || arg2 == NULL)
return ((bool) 0);
@@ -484,7 +484,7 @@ text_ge(struct varlena * arg1, struct varlena * arg2)
int32
byteaGetSize(struct varlena * v)
{
- register int len;
+ register int len;
len = v->vl_len - sizeof(v->vl_len);
@@ -502,8 +502,8 @@ byteaGetSize(struct varlena * v)
int32
byteaGetByte(struct varlena * v, int32 n)
{
- int len;
- int byte;
+ int len;
+ int byte;
len = byteaGetSize(v);
@@ -530,9 +530,9 @@ byteaGetByte(struct varlena * v, int32 n)
int32
byteaGetBit(struct varlena * v, int32 n)
{
- int byteNo,
- bitNo;
- int byte;
+ int byteNo,
+ bitNo;
+ int byte;
byteNo = n / 8;
bitNo = n % 8;
@@ -560,7 +560,7 @@ byteaGetBit(struct varlena * v, int32 n)
struct varlena *
byteaSetByte(struct varlena * v, int32 n, int32 newByte)
{
- int len;
+ int len;
struct varlena *res;
len = byteaGetSize(v);
@@ -603,10 +603,10 @@ struct varlena *
byteaSetBit(struct varlena * v, int32 n, int32 newBit)
{
struct varlena *res;
- int oldByte,
- newByte;
- int byteNo,
- bitNo;
+ int oldByte,
+ newByte;
+ int byteNo,
+ bitNo;
/*
* sanity check!
diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c
index 3edddd3c1aa..c1510f0ecc4 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.11 1997/09/07 04:52:56 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.12 1997/09/08 02:31:09 momjian Exp $
*
* Notes:
* XXX This needs to use exception.h to handle recovery when
@@ -34,15 +34,15 @@
#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 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);
+static long comphash(long l, char *v);
/* ----------------
* variables, macros and other stuff
@@ -68,17 +68,17 @@ static long comphash(long l, char *v);
#define CACHE6_elog(a,b,c,d,e,f,g)
#endif
-CatCache *Caches = NULL;
-GlobalMemory CacheCxt;
+CatCache *Caches = NULL;
+GlobalMemory CacheCxt;
-static int DisableCache;
+static int DisableCache;
/* ----------------
* EQPROC is used in CatalogCacheInitializeCache
* XXX this should be replaced by catalog lookups soon
* ----------------
*/
-static long eqproc[] = {
+static long eqproc[] = {
F_BOOLEQ, 0l, F_CHAREQ, F_CHAR16EQ, 0l,
F_INT2EQ, F_KEYFIRSTEQ, F_INT4EQ, 0l, F_TEXTEQ,
F_OIDEQ, 0l, 0l, 0l, F_OID8EQ
@@ -120,10 +120,10 @@ static void
CatalogCacheInitializeCache(struct catcache * cache,
Relation relation)
{
- MemoryContext oldcxt;
- short didopen = 0;
- short i;
- TupleDesc tupdesc;
+ MemoryContext oldcxt;
+ short didopen = 0;
+ short i;
+ TupleDesc tupdesc;
CatalogCacheInitializeCache_DEBUG1;
@@ -289,17 +289,17 @@ CatalogCacheSetId(CatCache * cacheInOutP, int id)
static long
comphash(long l, register char *v)
{
- long i;
- NameData n;
+ long i;
+ NameData n;
CACHE3_elog(DEBUG, "comphash (%d,%x)", l, v);
switch (l)
{
- case 1:
- case 2:
- case 4:
- return ((long) v);
+ case 1:
+ case 2:
+ case 4:
+ return ((long) v);
}
if (l == NAMEDATALEN)
@@ -329,10 +329,10 @@ comphash(long l, register char *v)
* CatalogCacheComputeHashIndex
* --------------------------------
*/
-static Index
+static Index
CatalogCacheComputeHashIndex(struct catcache * cacheInP)
{
- Index hashIndex;
+ Index hashIndex;
hashIndex = 0x0;
CACHE6_elog(DEBUG, "CatalogCacheComputeHashIndex %s %d %d %d %x",
@@ -344,25 +344,25 @@ CatalogCacheComputeHashIndex(struct catcache * cacheInP)
switch (cacheInP->cc_nkeys)
{
- case 4:
- hashIndex ^= comphash(cacheInP->cc_klen[3],
+ case 4:
+ hashIndex ^= comphash(cacheInP->cc_klen[3],
(char *) cacheInP->cc_skey[3].sk_argument) << 9;
- /* FALLTHROUGH */
- case 3:
- hashIndex ^= comphash(cacheInP->cc_klen[2],
+ /* FALLTHROUGH */
+ case 3:
+ hashIndex ^= comphash(cacheInP->cc_klen[2],
(char *) cacheInP->cc_skey[2].sk_argument) << 6;
- /* FALLTHROUGH */
- case 2:
- hashIndex ^= comphash(cacheInP->cc_klen[1],
+ /* FALLTHROUGH */
+ case 2:
+ hashIndex ^= comphash(cacheInP->cc_klen[1],
(char *) cacheInP->cc_skey[1].sk_argument) << 3;
- /* FALLTHROUGH */
- case 1:
- hashIndex ^= comphash(cacheInP->cc_klen[0],
+ /* FALLTHROUGH */
+ case 1:
+ hashIndex ^= comphash(cacheInP->cc_klen[0],
(char *) cacheInP->cc_skey[0].sk_argument);
- break;
- default:
- elog(FATAL, "CCComputeHashIndex: %d cc_nkeys", cacheInP->cc_nkeys);
- break;
+ break;
+ default:
+ elog(FATAL, "CCComputeHashIndex: %d cc_nkeys", cacheInP->cc_nkeys);
+ break;
}
hashIndex %= cacheInP->cc_size;
return (hashIndex);
@@ -372,62 +372,62 @@ CatalogCacheComputeHashIndex(struct catcache * cacheInP)
* CatalogCacheComputeTupleHashIndex
* --------------------------------
*/
-static Index
+static Index
CatalogCacheComputeTupleHashIndex(struct catcache * cacheInOutP,
Relation relation,
HeapTuple tuple)
{
- bool isNull = '\0';
+ bool isNull = '\0';
if (cacheInOutP->relationId == InvalidOid)
CatalogCacheInitializeCache(cacheInOutP, relation);
switch (cacheInOutP->cc_nkeys)
{
- case 4:
- cacheInOutP->cc_skey[3].sk_argument =
- (cacheInOutP->cc_key[3] == ObjectIdAttributeNumber)
- ? (Datum) tuple->t_oid
- : (Datum) fastgetattr(tuple,
- cacheInOutP->cc_key[3],
- RelationGetTupleDescriptor(relation),
- &isNull);
- Assert(!isNull);
- /* FALLTHROUGH */
- case 3:
- cacheInOutP->cc_skey[2].sk_argument =
- (cacheInOutP->cc_key[2] == ObjectIdAttributeNumber)
- ? (Datum) tuple->t_oid
- : (Datum) fastgetattr(tuple,
- cacheInOutP->cc_key[2],
- RelationGetTupleDescriptor(relation),
- &isNull);
- Assert(!isNull);
- /* FALLTHROUGH */
- case 2:
- cacheInOutP->cc_skey[1].sk_argument =
- (cacheInOutP->cc_key[1] == ObjectIdAttributeNumber)
- ? (Datum) tuple->t_oid
- : (Datum) fastgetattr(tuple,
- cacheInOutP->cc_key[1],
- RelationGetTupleDescriptor(relation),
- &isNull);
- Assert(!isNull);
- /* FALLTHROUGH */
- case 1:
- cacheInOutP->cc_skey[0].sk_argument =
- (cacheInOutP->cc_key[0] == ObjectIdAttributeNumber)
- ? (Datum) tuple->t_oid
- : (Datum) fastgetattr(tuple,
- cacheInOutP->cc_key[0],
- RelationGetTupleDescriptor(relation),
- &isNull);
- Assert(!isNull);
- break;
- default:
- elog(FATAL, "CCComputeTupleHashIndex: %d cc_nkeys",
- cacheInOutP->cc_nkeys
- );
- break;
+ case 4:
+ cacheInOutP->cc_skey[3].sk_argument =
+ (cacheInOutP->cc_key[3] == ObjectIdAttributeNumber)
+ ? (Datum) tuple->t_oid
+ : (Datum) fastgetattr(tuple,
+ cacheInOutP->cc_key[3],
+ RelationGetTupleDescriptor(relation),
+ &isNull);
+ Assert(!isNull);
+ /* FALLTHROUGH */
+ case 3:
+ cacheInOutP->cc_skey[2].sk_argument =
+ (cacheInOutP->cc_key[2] == ObjectIdAttributeNumber)
+ ? (Datum) tuple->t_oid
+ : (Datum) fastgetattr(tuple,
+ cacheInOutP->cc_key[2],
+ RelationGetTupleDescriptor(relation),
+ &isNull);
+ Assert(!isNull);
+ /* FALLTHROUGH */
+ case 2:
+ cacheInOutP->cc_skey[1].sk_argument =
+ (cacheInOutP->cc_key[1] == ObjectIdAttributeNumber)
+ ? (Datum) tuple->t_oid
+ : (Datum) fastgetattr(tuple,
+ cacheInOutP->cc_key[1],
+ RelationGetTupleDescriptor(relation),
+ &isNull);
+ Assert(!isNull);
+ /* FALLTHROUGH */
+ case 1:
+ cacheInOutP->cc_skey[0].sk_argument =
+ (cacheInOutP->cc_key[0] == ObjectIdAttributeNumber)
+ ? (Datum) tuple->t_oid
+ : (Datum) fastgetattr(tuple,
+ cacheInOutP->cc_key[0],
+ RelationGetTupleDescriptor(relation),
+ &isNull);
+ Assert(!isNull);
+ break;
+ default:
+ elog(FATAL, "CCComputeTupleHashIndex: %d cc_nkeys",
+ cacheInOutP->cc_nkeys
+ );
+ break;
}
return
@@ -441,9 +441,9 @@ CatalogCacheComputeTupleHashIndex(struct catcache * cacheInOutP,
static void
CatCacheRemoveCTup(CatCache * cache, Dlelem * elt)
{
- CatCTup *ct;
- CatCTup *other_ct;
- Dlelem *other_elt;
+ CatCTup *ct;
+ CatCTup *other_ct;
+ Dlelem *other_elt;
if (elt)
ct = (CatCTup *) DLE_VAL(elt);
@@ -475,10 +475,10 @@ CatalogCacheIdInvalidate(int cacheId, /* XXX */
Index hashIndex,
ItemPointer pointer)
{
- CatCache *ccp;
- CatCTup *ct;
- Dlelem *elt;
- MemoryContext oldcxt;
+ CatCache *ccp;
+ CatCTup *ct;
+ Dlelem *elt;
+ MemoryContext oldcxt;
/* ----------------
* sanity checks
@@ -558,7 +558,7 @@ CatalogCacheIdInvalidate(int cacheId, /* XXX */
void
ResetSystemCache()
{
- MemoryContext oldcxt;
+ MemoryContext oldcxt;
struct catcache *cache;
/* ----------------
@@ -593,12 +593,12 @@ ResetSystemCache()
*/
for (cache = Caches; PointerIsValid(cache); cache = cache->cc_next)
{
- int hash;
+ int hash;
for (hash = 0; hash < NCCBUCK; hash += 1)
{
- Dlelem *elt,
- *nextelt;
+ Dlelem *elt,
+ *nextelt;
for (elt = DLGetHead(cache->cc_cache[hash]); elt; elt = nextelt)
{
@@ -645,7 +645,7 @@ elog(DEBUG, "InitSysCache: rid=%d id=%d nkeys=%d size=%d\n", \
#define InitSysCache_DEBUG1
#endif
-CatCache *
+CatCache *
InitSysCache(char *relname,
char *iname,
int id,
@@ -653,11 +653,11 @@ InitSysCache(char *relname,
int key[],
HeapTuple(*iScanfuncP) ())
{
- CatCache *cp;
- register int i;
- MemoryContext oldcxt;
+ CatCache *cp;
+ register int i;
+ MemoryContext oldcxt;
- char *indname;
+ char *indname;
indname = (iname) ? iname : NULL;
@@ -691,7 +691,7 @@ InitSysCache(char *relname,
* We could move this to dllist.c, but the way we do this is not
* dynamic/portabl, so why allow other routines to use it.
*/
- Dllist *cache_begin = malloc((NCCBUCK + 1) * sizeof(Dllist));
+ Dllist *cache_begin = malloc((NCCBUCK + 1) * sizeof(Dllist));
for (i = 0; i <= NCCBUCK; ++i)
{
@@ -798,16 +798,16 @@ SearchSysCache(struct catcache * cache,
Datum v3,
Datum v4)
{
- unsigned hash;
- CatCTup *ct = NULL;
- CatCTup *nct;
- CatCTup *nct2;
- Dlelem *elt;
- HeapTuple ntp = 0;
- Buffer buffer;
+ unsigned hash;
+ CatCTup *ct = NULL;
+ CatCTup *nct;
+ CatCTup *nct2;
+ Dlelem *elt;
+ HeapTuple ntp = 0;
+ Buffer buffer;
- Relation relation;
- MemoryContext oldcxt;
+ Relation relation;
+ MemoryContext oldcxt;
/* ----------------
* sanity checks
@@ -859,7 +859,7 @@ SearchSysCache(struct catcache * cache,
*/
if (elt)
{
- Dlelem *old_lru_elt;
+ Dlelem *old_lru_elt;
old_lru_elt = ((CatCTup *) DLE_VAL(elt))->ct_node;
DLRemove(old_lru_elt);
@@ -932,18 +932,18 @@ SearchSysCache(struct catcache * cache,
Assert(cache->cc_iscanfunc);
switch (cache->cc_nkeys)
{
- case 4:
- ntp = cache->cc_iscanfunc(relation, v1, v2, v3, v4);
- break;
- case 3:
- ntp = cache->cc_iscanfunc(relation, v1, v2, v3);
- break;
- case 2:
- ntp = cache->cc_iscanfunc(relation, v1, v2);
- break;
- case 1:
- ntp = cache->cc_iscanfunc(relation, v1);
- break;
+ case 4:
+ ntp = cache->cc_iscanfunc(relation, v1, v2, v3, v4);
+ break;
+ case 3:
+ ntp = cache->cc_iscanfunc(relation, v1, v2, v3);
+ break;
+ case 2:
+ ntp = cache->cc_iscanfunc(relation, v1, v2);
+ break;
+ case 1:
+ ntp = cache->cc_iscanfunc(relation, v1);
+ break;
}
/* ----------
* Back to Cache context. If we got a tuple copy it
@@ -959,7 +959,7 @@ SearchSysCache(struct catcache * cache,
}
else
{
- HeapScanDesc sd;
+ HeapScanDesc sd;
/* ----------
* As above do the lookup in the callers memory
@@ -1004,7 +1004,7 @@ SearchSysCache(struct catcache * cache,
* to the heap tuple there and initialize the list pointers.
* ----------------
*/
- Dlelem *lru_elt;
+ Dlelem *lru_elt;
/*
* this is a little cumbersome here because we want the Dlelem's
@@ -1030,7 +1030,7 @@ SearchSysCache(struct catcache * cache,
*/
if (++cache->cc_ntup > cache->cc_maxtup)
{
- CatCTup *ct;
+ CatCTup *ct;
elt = DLGetTail(cache->cc_lrulist);
ct = (CatCTup *) DLE_VAL(elt);
@@ -1078,8 +1078,8 @@ RelationInvalidateCatalogCacheTuple(Relation relation,
void (*function) (int, Index, ItemPointer))
{
struct catcache *ccp;
- MemoryContext oldcxt;
- Oid relationId;
+ MemoryContext oldcxt;
+ Oid relationId;
/* ----------------
* sanity checks
diff --git a/src/backend/utils/cache/fcache.c b/src/backend/utils/cache/fcache.c
index ad174c6fdf5..96c0102c1cf 100644
--- a/src/backend/utils/cache/fcache.c
+++ b/src/backend/utils/cache/fcache.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.5 1997/09/07 04:52:59 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.6 1997/09/08 02:31:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -35,7 +35,7 @@
#include <string.h>
#endif
-static Oid GetDynamicFuncArgType(Var * arg, ExprContext * econtext);
+static Oid GetDynamicFuncArgType(Var * arg, ExprContext * econtext);
static FunctionCachePtr
init_fcache(Oid foid,
bool use_syscache,
@@ -55,12 +55,12 @@ init_fcache(Oid foid,
#define FuncArgTypeIsDynamic(arg) \
(IsA(arg,Var) && ((Var*)arg)->varattno == InvalidAttrNumber)
-static Oid
+static Oid
GetDynamicFuncArgType(Var * arg, ExprContext * econtext)
{
- char *relname;
- int rtid;
- HeapTuple tup;
+ char *relname;
+ int rtid;
+ HeapTuple tup;
Assert(IsA(arg, Var));
@@ -77,19 +77,19 @@ GetDynamicFuncArgType(Var * arg, ExprContext * econtext)
return tup->t_oid;
}
-static FunctionCachePtr
+static FunctionCachePtr
init_fcache(Oid foid,
bool use_syscache,
List * argList,
ExprContext * econtext)
{
- HeapTuple procedureTuple;
- HeapTuple typeTuple;
- Form_pg_proc procedureStruct;
- TypeTupleForm typeStruct;
+ HeapTuple procedureTuple;
+ HeapTuple typeTuple;
+ Form_pg_proc procedureStruct;
+ TypeTupleForm typeStruct;
FunctionCachePtr retval;
- text *tmp;
- int nargs;
+ text *tmp;
+ int nargs;
/* ----------------
* get the procedure tuple corresponding to the given
@@ -173,9 +173,9 @@ init_fcache(Oid foid,
(retval->oneResult) &&
!(retval->typbyval))
{
- Form_pg_class relationStruct;
- HeapTuple relationTuple;
- TupleDesc td;
+ Form_pg_class relationStruct;
+ HeapTuple relationTuple;
+ TupleDesc td;
TupleTableSlot *slot;
slot = makeNode(TupleTableSlot);
@@ -209,14 +209,14 @@ init_fcache(Oid foid,
if (nargs > 0)
{
- Oid *argTypes;
+ Oid *argTypes;
retval->nullVect = (bool *) palloc((retval->nargs) * sizeof(bool));
if (retval->language == SQLlanguageId)
{
- int i;
- List *oneArg;
+ int i;
+ List *oneArg;
retval->argOidVect =
(Oid *) palloc(retval->nargs * sizeof(Oid));
@@ -293,8 +293,8 @@ init_fcache(Oid foid,
void
setFcache(Node * node, Oid foid, List * argList, ExprContext * econtext)
{
- Func *fnode;
- Oper *onode;
+ Func *fnode;
+ Oper *onode;
FunctionCachePtr fcache;
fcache = init_fcache(foid, true, argList, econtext);
diff --git a/src/backend/utils/cache/inval.c b/src/backend/utils/cache/inval.c
index 4fb8a5eb6ed..cc343f4d3e1 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.5 1997/09/07 04:53:01 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.6 1997/09/08 02:31:12 momjian Exp $
*
* Note - this code is real crufty...
*
@@ -32,11 +32,11 @@
#include "utils/syscache.h" /* XXX to support the hacks below */
static InvalidationEntry InvalidationEntryAllocate(uint16 size);
-static void LocalInvalidInvalidate(LocalInvalid invalid, void (*function) ());
+static void LocalInvalidInvalidate(LocalInvalid invalid, void (*function) ());
static LocalInvalid
LocalInvalidRegister(LocalInvalid invalid,
InvalidationEntry entry);
-static void getmyrelids(void);
+static void getmyrelids(void);
/* ----------------
@@ -45,28 +45,28 @@ static void getmyrelids(void);
*/
typedef struct CatalogInvalidationData
{
- Index cacheId;
- Index hashIndex;
+ Index cacheId;
+ Index hashIndex;
ItemPointerData pointerData;
-} CatalogInvalidationData;
+} CatalogInvalidationData;
typedef struct RelationInvalidationData
{
- Oid relationId;
- Oid objectId;
-} RelationInvalidationData;
+ Oid relationId;
+ Oid objectId;
+} RelationInvalidationData;
typedef union AnyInvalidation
{
CatalogInvalidationData catalog;
RelationInvalidationData relation;
-} AnyInvalidation;
+} AnyInvalidation;
typedef struct InvalidationMessageData
{
- char kind;
+ char kind;
AnyInvalidation any;
-} InvalidationMessageData;
+} InvalidationMessageData;
typedef InvalidationMessageData *InvalidationMessage;
@@ -75,12 +75,12 @@ typedef InvalidationMessageData *InvalidationMessage;
* ----------------
*/
static LocalInvalid Invalid = EmptyLocalInvalid; /* XXX global */
-static bool RefreshWhenInvalidate = false;
+static bool RefreshWhenInvalidate = false;
-Oid MyRelationRelationId = InvalidOid;
-Oid MyAttributeRelationId = InvalidOid;
-Oid MyAMRelationId = InvalidOid;
-Oid MyAMOPRelationId = InvalidOid;
+Oid MyRelationRelationId = InvalidOid;
+Oid MyAttributeRelationId = InvalidOid;
+Oid MyAMRelationId = InvalidOid;
+Oid MyAMOPRelationId = InvalidOid;
#define ValidateHacks() \
if (!OidIsValid(MyRelationRelationId)) getmyrelids()
@@ -95,7 +95,7 @@ Oid MyAMOPRelationId = InvalidOid;
* Allocates an invalidation entry.
* --------------------------------
*/
-static InvalidationEntry
+static InvalidationEntry
InvalidationEntryAllocate(uint16 size)
{
InvalidationEntryData *entryDataP;
@@ -111,7 +111,7 @@ InvalidationEntryAllocate(uint16 size)
* Returns a new local cache invalidation state containing a new entry.
* --------------------------------
*/
-static LocalInvalid
+static LocalInvalid
LocalInvalidRegister(LocalInvalid invalid,
InvalidationEntry entry)
{
@@ -248,7 +248,7 @@ RelationIdRegisterLocalInvalid(Oid relationId, Oid objectId)
static void
getmyrelids()
{
- HeapTuple tuple;
+ HeapTuple tuple;
tuple = SearchSysCacheTuple(RELNAME,
PointerGetDatum(RelationRelationName),
@@ -391,26 +391,26 @@ InvalidationMessageRegisterSharedInvalid(InvalidationMessage message)
switch (message->kind)
{
- case 'c': /* cached system catalog tuple */
- InvalidationMessageRegisterSharedInvalid_DEBUG1;
-
- RegisterSharedInvalid(message->any.catalog.cacheId,
- message->any.catalog.hashIndex,
- &message->any.catalog.pointerData);
- break;
-
- case 'r': /* cached relation descriptor */
- InvalidationMessageRegisterSharedInvalid_DEBUG2;
-
- RegisterSharedInvalid(message->any.relation.relationId,
- message->any.relation.objectId,
- (ItemPointer) NULL);
- break;
-
- default:
- elog(FATAL,
- "InvalidationMessageRegisterSharedInvalid: `%c' kind",
- message->kind);
+ case 'c': /* cached system catalog tuple */
+ InvalidationMessageRegisterSharedInvalid_DEBUG1;
+
+ RegisterSharedInvalid(message->any.catalog.cacheId,
+ message->any.catalog.hashIndex,
+ &message->any.catalog.pointerData);
+ break;
+
+ case 'r': /* cached relation descriptor */
+ InvalidationMessageRegisterSharedInvalid_DEBUG2;
+
+ RegisterSharedInvalid(message->any.relation.relationId,
+ message->any.relation.objectId,
+ (ItemPointer) NULL);
+ break;
+
+ default:
+ elog(FATAL,
+ "InvalidationMessageRegisterSharedInvalid: `%c' kind",
+ message->kind);
}
}
@@ -441,23 +441,23 @@ InvalidationMessageCacheInvalidate(InvalidationMessage message)
switch (message->kind)
{
- case 'c': /* cached system catalog tuple */
- InvalidationMessageCacheInvalidate_DEBUG1;
+ case 'c': /* cached system catalog tuple */
+ InvalidationMessageCacheInvalidate_DEBUG1;
- CatalogCacheIdInvalidate(message->any.catalog.cacheId,
- message->any.catalog.hashIndex,
- &message->any.catalog.pointerData);
- break;
+ CatalogCacheIdInvalidate(message->any.catalog.cacheId,
+ message->any.catalog.hashIndex,
+ &message->any.catalog.pointerData);
+ break;
- case 'r': /* cached relation descriptor */
- InvalidationMessageCacheInvalidate_DEBUG2;
+ case 'r': /* cached relation descriptor */
+ InvalidationMessageCacheInvalidate_DEBUG2;
- /* XXX ignore this--is this correct ??? */
- break;
+ /* XXX ignore this--is this correct ??? */
+ break;
- default:
- elog(FATAL, "InvalidationMessageCacheInvalidate: `%c' kind",
- message->kind);
+ default:
+ elog(FATAL, "InvalidationMessageCacheInvalidate: `%c' kind",
+ message->kind);
}
}
@@ -470,8 +470,8 @@ RelationInvalidateRelationCache(Relation relation,
HeapTuple tuple,
void (*function) ())
{
- Oid relationId;
- Oid objectId = (Oid) 0;
+ Oid relationId;
+ Oid objectId = (Oid) 0;
/* ----------------
* get the relation object id
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c
index 37280036970..123e7c1462c 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.4 1997/09/07 04:53:04 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.5 1997/09/08 02:31:14 momjian Exp $
*
* NOTES
* Eventually, the index information should go through here, too.
@@ -67,11 +67,11 @@ op_class(Oid opno, int32 opclass, Oid amopid)
* return the "attname" field from the attribute relation.
*
*/
-char *
+char *
get_attname(Oid relid, AttrNumber attnum)
{
FormData_pg_attribute att_tup;
- char *retval;
+ char *retval;
if (SearchSysCacheStruct(ATTNUM,
(char *) &att_tup,
@@ -137,8 +137,8 @@ get_atttype(Oid relid, AttrNumber attnum)
bool
get_attisset(Oid relid, char *attname)
{
- HeapTuple htup;
- AttrNumber attno;
+ HeapTuple htup;
+ AttrNumber attno;
AttributeTupleForm att_tup;
attno = get_attnum(relid, attname);
@@ -192,7 +192,7 @@ get_opcode(Oid opno)
*
* Note: return the struct so that it gets copied.
*/
-char *
+char *
get_opname(Oid opno)
{
FormData_pg_operator optup;
@@ -284,7 +284,7 @@ get_commutator(Oid opno)
HeapTuple
get_operator_tuple(Oid opno)
{
- HeapTuple optup;
+ HeapTuple optup;
if ((optup = SearchSysCacheTuple(OPROID,
ObjectIdGetDatum(opno),
@@ -378,7 +378,7 @@ get_relnatts(Oid relid)
* Returns the name of a given relation.
*
*/
-char *
+char *
get_rel_name(Oid relid)
{
FormData_pg_class reltup;
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index 704d673279b..4b1f5e251c6 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.21 1997/09/07 04:53:08 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.22 1997/09/08 02:31:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -91,8 +91,8 @@ static void
RelationFlushRelation(Relation * relationPtr,
bool onlyFlushReferenceCountZero);
static Relation RelationNameCacheGetRelation(char *relationName);
-static void init_irels(void);
-static void write_irels(void);
+static void init_irels(void);
+static void write_irels(void);
/* ----------------
* defines
@@ -105,7 +105,7 @@ static void write_irels(void);
* externs
* ----------------
*/
-extern bool AMI_OVERRIDE; /* XXX style */
+extern bool AMI_OVERRIDE; /* XXX style */
extern GlobalMemory CacheCxt; /* from utils/cache/catcache.c */
/* ----------------
@@ -127,8 +127,8 @@ FormData_pg_attribute Desc_pg_time[Natts_pg_time] = {Schema_pg_time};
* thus there are two hash tables for referencing them.
* ----------------
*/
-HTAB *RelationNameCache;
-HTAB *RelationIdCache;
+HTAB *RelationNameCache;
+HTAB *RelationIdCache;
/* ----------------
* RelationBuildDescInfo exists so code can be shared
@@ -137,27 +137,27 @@ HTAB *RelationIdCache;
*/
typedef struct RelationBuildDescInfo
{
- int infotype; /* lookup by id or by name */
+ int infotype; /* lookup by id or by name */
#define INFO_RELID 1
#define INFO_RELNAME 2
union
{
- Oid info_id;/* relation object id */
- char *info_name; /* relation name */
- } i;
-} RelationBuildDescInfo;
+ Oid info_id; /* relation object id */
+ char *info_name; /* relation name */
+ } i;
+} RelationBuildDescInfo;
typedef struct relidcacheent
{
- Oid reloid;
- Relation reldesc;
-} RelIdCacheEnt;
+ Oid reloid;
+ Relation reldesc;
+} RelIdCacheEnt;
typedef struct relnamecacheent
{
- NameData relname;
- Relation reldesc;
-} RelNameCacheEnt;
+ NameData relname;
+ Relation reldesc;
+} RelNameCacheEnt;
/* -----------------
* macros to manipulate name cache and id cache
@@ -251,7 +251,7 @@ formrdesc(char *relationName, u_int natts,
FormData_pg_attribute att[]);
#if 0 /* See comments at line 1304 */
-static void RelationFlushIndexes(Relation * r, Oid accessMethodId);
+static void RelationFlushIndexes(Relation * r, Oid accessMethodId);
#endif
@@ -269,19 +269,19 @@ static void
build_tupdesc_ind(RelationBuildDescInfo buildinfo,
Relation relation, u_int natts);
static Relation RelationBuildDesc(RelationBuildDescInfo buildinfo);
-static void IndexedAccessMethodInitialize(Relation relation);
-static void AttrDefaultFetch(Relation relation);
-static void RelCheckFetch(Relation relation);
+static void IndexedAccessMethodInitialize(Relation relation);
+static void AttrDefaultFetch(Relation relation);
+static void RelCheckFetch(Relation relation);
-extern void RelationBuildTriggers(Relation relation);
-extern void FreeTriggerDesc(Relation relation);
+extern void RelationBuildTriggers(Relation relation);
+extern void FreeTriggerDesc(Relation relation);
/*
* newlyCreatedRelns -
* relations created during this transaction. We need to keep track of
* these.
*/
-static List *newlyCreatedRelns = NULL;
+static List *newlyCreatedRelns = NULL;
/* ----------------------------------------------------------------
* RelationIdGetRelation() and RelationNameGetRelation()
@@ -297,20 +297,20 @@ static List *newlyCreatedRelns = NULL;
* the buildinfo passed to it
* --------------------------------
*/
-static char *
+static char *
BuildDescInfoError(RelationBuildDescInfo buildinfo)
{
- static char errBuf[64];
+ static char errBuf[64];
memset(errBuf, 0, (int) sizeof(errBuf));
switch (buildinfo.infotype)
{
- case INFO_RELID:
- sprintf(errBuf, "(relation id %d)", buildinfo.i.info_id);
- break;
- case INFO_RELNAME:
- sprintf(errBuf, "(relation name %s)", buildinfo.i.info_name);
- break;
+ case INFO_RELID:
+ sprintf(errBuf, "(relation id %d)", buildinfo.i.info_id);
+ break;
+ case INFO_RELNAME:
+ sprintf(errBuf, "(relation name %s)", buildinfo.i.info_name);
+ break;
}
return errBuf;
@@ -326,7 +326,7 @@ BuildDescInfoError(RelationBuildDescInfo buildinfo)
* as specified in buildinfo.
* --------------------------------
*/
-static HeapTuple
+static HeapTuple
ScanPgRelation(RelationBuildDescInfo buildinfo)
{
@@ -342,15 +342,15 @@ ScanPgRelation(RelationBuildDescInfo buildinfo)
return (scan_pg_rel_ind(buildinfo));
}
-static HeapTuple
+static HeapTuple
scan_pg_rel_seq(RelationBuildDescInfo buildinfo)
{
- HeapTuple pg_class_tuple;
- HeapTuple return_tuple;
- Relation pg_class_desc;
- HeapScanDesc pg_class_scan;
- ScanKeyData key;
- Buffer buf;
+ HeapTuple pg_class_tuple;
+ HeapTuple return_tuple;
+ Relation pg_class_desc;
+ HeapScanDesc pg_class_scan;
+ ScanKeyData key;
+ Buffer buf;
/* ----------------
* form a scan key
@@ -358,23 +358,23 @@ scan_pg_rel_seq(RelationBuildDescInfo buildinfo)
*/
switch (buildinfo.infotype)
{
- case INFO_RELID:
- ScanKeyEntryInitialize(&key, 0,
- ObjectIdAttributeNumber,
- ObjectIdEqualRegProcedure,
- ObjectIdGetDatum(buildinfo.i.info_id));
- break;
-
- case INFO_RELNAME:
- ScanKeyEntryInitialize(&key, 0,
- Anum_pg_class_relname,
- Character16EqualRegProcedure,
- NameGetDatum(buildinfo.i.info_name));
- break;
-
- default:
- elog(WARN, "ScanPgRelation: bad buildinfo");
- return NULL;
+ case INFO_RELID:
+ ScanKeyEntryInitialize(&key, 0,
+ ObjectIdAttributeNumber,
+ ObjectIdEqualRegProcedure,
+ ObjectIdGetDatum(buildinfo.i.info_id));
+ break;
+
+ case INFO_RELNAME:
+ ScanKeyEntryInitialize(&key, 0,
+ Anum_pg_class_relname,
+ Character16EqualRegProcedure,
+ NameGetDatum(buildinfo.i.info_name));
+ break;
+
+ default:
+ elog(WARN, "ScanPgRelation: bad buildinfo");
+ return NULL;
}
/* ----------------
@@ -421,11 +421,11 @@ scan_pg_rel_seq(RelationBuildDescInfo buildinfo)
return return_tuple;
}
-static HeapTuple
+static HeapTuple
scan_pg_rel_ind(RelationBuildDescInfo buildinfo)
{
- Relation pg_class_desc;
- HeapTuple return_tuple;
+ Relation pg_class_desc;
+ HeapTuple return_tuple;
pg_class_desc = heap_openr(RelationRelationName);
if (!IsInitProcessingMode())
@@ -433,23 +433,23 @@ scan_pg_rel_ind(RelationBuildDescInfo buildinfo)
switch (buildinfo.infotype)
{
- case INFO_RELID:
- return_tuple = ClassOidIndexScan(pg_class_desc, buildinfo.i.info_id);
- break;
+ case INFO_RELID:
+ return_tuple = ClassOidIndexScan(pg_class_desc, buildinfo.i.info_id);
+ break;
- case INFO_RELNAME:
- return_tuple = ClassNameIndexScan(pg_class_desc,
- buildinfo.i.info_name);
- break;
+ case INFO_RELNAME:
+ return_tuple = ClassNameIndexScan(pg_class_desc,
+ buildinfo.i.info_name);
+ break;
- default:
- elog(WARN, "ScanPgRelation: bad buildinfo");
+ default:
+ elog(WARN, "ScanPgRelation: bad buildinfo");
- /*
- * XXX I hope this is right. It seems better than returning an
- * uninitialized value
- */
- return_tuple = NULL;
+ /*
+ * XXX I hope this is right. It seems better than returning
+ * an uninitialized value
+ */
+ return_tuple = NULL;
}
/* all done */
@@ -467,12 +467,12 @@ scan_pg_rel_ind(RelationBuildDescInfo buildinfo)
* and initialize the rd_rel field.
* ----------------
*/
-static Relation
+static Relation
AllocateRelationDesc(u_int natts, Form_pg_class relp)
{
- Relation relation;
- Size len;
- Form_pg_class relationTupleForm;
+ Relation relation;
+ Size len;
+ Form_pg_class relationTupleForm;
/* ----------------
* allocate space for the relation tuple form
@@ -535,12 +535,12 @@ build_tupdesc_seq(RelationBuildDescInfo buildinfo,
Relation relation,
u_int natts)
{
- HeapTuple pg_attribute_tuple;
- Relation pg_attribute_desc;
- HeapScanDesc pg_attribute_scan;
+ HeapTuple pg_attribute_tuple;
+ Relation pg_attribute_desc;
+ HeapScanDesc pg_attribute_scan;
AttributeTupleForm attp;
- ScanKeyData key;
- int need;
+ ScanKeyData key;
+ int need;
/* ----------------
* form a scan key
@@ -601,13 +601,13 @@ build_tupdesc_ind(RelationBuildDescInfo buildinfo,
Relation relation,
u_int natts)
{
- Relation attrel;
- HeapTuple atttup;
+ Relation attrel;
+ HeapTuple atttup;
AttributeTupleForm attp;
- TupleConstr *constr = (TupleConstr *) palloc(sizeof(TupleConstr));
- AttrDefault *attrdef = NULL;
- int ndef = 0;
- int i;
+ TupleConstr *constr = (TupleConstr *) palloc(sizeof(TupleConstr));
+ AttrDefault *attrdef = NULL;
+ int ndef = 0;
+ int i;
constr->has_not_null = false;
@@ -694,15 +694,15 @@ build_tupdesc_ind(RelationBuildDescInfo buildinfo,
static void
RelationBuildRuleLock(Relation relation)
{
- HeapTuple pg_rewrite_tuple;
- Relation pg_rewrite_desc;
- TupleDesc pg_rewrite_tupdesc;
- HeapScanDesc pg_rewrite_scan;
- ScanKeyData key;
- RuleLock *rulelock;
- int numlocks;
- RewriteRule **rules;
- int maxlocks;
+ HeapTuple pg_rewrite_tuple;
+ Relation pg_rewrite_desc;
+ TupleDesc pg_rewrite_tupdesc;
+ HeapScanDesc pg_rewrite_scan;
+ ScanKeyData key;
+ RuleLock *rulelock;
+ int numlocks;
+ RewriteRule **rules;
+ int maxlocks;
/* ----------------
* form an array to hold the rewrite rules (the array is extended if
@@ -739,10 +739,10 @@ RelationBuildRuleLock(Relation relation)
while ((pg_rewrite_tuple = heap_getnext(pg_rewrite_scan, 0,
(Buffer *) NULL)) != NULL)
{
- bool isnull;
- char *ruleaction = NULL;
- char *rule_evqual_string;
- RewriteRule *rule;
+ bool isnull;
+ char *ruleaction = NULL;
+ char *rule_evqual_string;
+ RewriteRule *rule;
rule = (RewriteRule *) palloc(sizeof(RewriteRule));
@@ -828,19 +828,19 @@ RelationBuildRuleLock(Relation relation)
* -cim 2/4/91
* --------------------------------
*/
-static Relation
+static Relation
RelationBuildDesc(RelationBuildDescInfo buildinfo)
{
- File fd;
- Relation relation;
- u_int natts;
- Oid relid;
- Oid relam;
- Form_pg_class relp;
+ File fd;
+ Relation relation;
+ u_int natts;
+ Oid relid;
+ Oid relam;
+ Form_pg_class relp;
- MemoryContext oldcxt;
+ MemoryContext oldcxt;
- HeapTuple pg_class_tuple;
+ HeapTuple pg_class_tuple;
oldcxt = MemoryContextSwitchTo((MemoryContext) CacheCxt);
@@ -986,13 +986,13 @@ RelationBuildDesc(RelationBuildDescInfo buildinfo)
static void
IndexedAccessMethodInitialize(Relation relation)
{
- IndexStrategy strategy;
- RegProcedure *support;
- int natts;
- Size stratSize;
- Size supportSize;
- uint16 relamstrategies;
- uint16 relamsupport;
+ IndexStrategy strategy;
+ RegProcedure *support;
+ int natts;
+ Size stratSize;
+ Size supportSize;
+ uint16 relamstrategies;
+ uint16 relamsupport;
natts = relation->rd_rel->relnatts;
relamstrategies = relation->rd_am->amstrategies;
@@ -1033,9 +1033,9 @@ formrdesc(char *relationName,
u_int natts,
FormData_pg_attribute att[])
{
- Relation relation;
- Size len;
- int i;
+ Relation relation;
+ Size len;
+ int i;
/* ----------------
* allocate new relation desc
@@ -1151,7 +1151,7 @@ formrdesc(char *relationName,
Relation
RelationIdCacheGetRelation(Oid relationId)
{
- Relation rd;
+ Relation rd;
RelationIdCacheLookup(relationId, rd);
@@ -1175,11 +1175,11 @@ RelationIdCacheGetRelation(Oid relationId)
* RelationNameCacheGetRelation
* --------------------------------
*/
-static Relation
+static Relation
RelationNameCacheGetRelation(char *relationName)
{
- Relation rd;
- NameData name;
+ Relation rd;
+ NameData name;
/*
* make sure that the name key used for hash lookup is properly
@@ -1214,7 +1214,7 @@ RelationNameCacheGetRelation(char *relationName)
Relation
RelationIdGetRelation(Oid relationId)
{
- Relation rd;
+ Relation rd;
RelationBuildDescInfo buildinfo;
/* ----------------
@@ -1255,7 +1255,7 @@ RelationIdGetRelation(Oid relationId)
Relation
RelationNameGetRelation(char *relationName)
{
- Relation rd;
+ Relation rd;
RelationBuildDescInfo buildinfo;
/* ----------------
@@ -1332,8 +1332,8 @@ static void
RelationFlushRelation(Relation * relationPtr,
bool onlyFlushReferenceCountZero)
{
- MemoryContext oldcxt;
- Relation relation = *relationPtr;
+ MemoryContext oldcxt;
+ Relation relation = *relationPtr;
if (relation->rd_isnailed)
{
@@ -1356,7 +1356,7 @@ RelationFlushRelation(Relation * relationPtr,
#if 0
if (relation->rd_rules)
{
- int j;
+ int j;
for (j = 0; j < relation->rd_rules->numLocks; j++)
{
@@ -1384,22 +1384,22 @@ RelationFlushRelation(Relation * relationPtr,
void
RelationForgetRelation(Oid rid)
{
- Relation relation;
+ Relation relation;
RelationIdCacheLookup(rid, relation);
Assert(PointerIsValid(relation));
if (relation->rd_islocal)
{
- MemoryContext oldcxt;
- List *curr;
- List *prev = NIL;
+ MemoryContext oldcxt;
+ List *curr;
+ List *prev = NIL;
oldcxt = MemoryContextSwitchTo((MemoryContext) CacheCxt);
foreach(curr, newlyCreatedRelns)
{
- Relation reln = lfirst(curr);
+ Relation reln = lfirst(curr);
Assert(reln != NULL && reln->rd_islocal);
if (reln->rd_id == rid)
@@ -1427,7 +1427,7 @@ RelationForgetRelation(Oid rid)
void
RelationIdInvalidateRelationCacheByRelationId(Oid relationId)
{
- Relation relation;
+ Relation relation;
RelationIdCacheLookup(relationId, relation);
@@ -1462,7 +1462,7 @@ static void
RelationFlushIndexes(Relation * r,
Oid accessMethodId)
{
- Relation relation = *r;
+ Relation relation = *r;
if (!RelationIsValid(relation))
{
@@ -1536,7 +1536,7 @@ RelationCacheInvalidate(bool onlyFlushReferenceCountZero)
void
RelationRegisterRelation(Relation relation)
{
- MemoryContext oldcxt;
+ MemoryContext oldcxt;
oldcxt = MemoryContextSwitchTo((MemoryContext) CacheCxt);
@@ -1571,7 +1571,7 @@ RelationRegisterRelation(Relation relation)
void
RelationPurgeLocalRelation(bool xactCommitted)
{
- MemoryContext oldcxt;
+ MemoryContext oldcxt;
if (newlyCreatedRelns == NULL)
return;
@@ -1580,8 +1580,8 @@ RelationPurgeLocalRelation(bool xactCommitted)
while (newlyCreatedRelns)
{
- List *l = newlyCreatedRelns;
- Relation reln = lfirst(l);
+ List *l = newlyCreatedRelns;
+ Relation reln = lfirst(l);
Assert(reln != NULL && reln->rd_islocal);
@@ -1641,8 +1641,8 @@ RelationPurgeLocalRelation(bool xactCommitted)
void
RelationInitialize(void)
{
- MemoryContext oldcxt;
- HASHCTL ctl;
+ MemoryContext oldcxt;
+ HASHCTL ctl;
/* ----------------
* switch to cache memory context
@@ -1697,21 +1697,21 @@ RelationInitialize(void)
static void
AttrDefaultFetch(Relation relation)
{
- AttrDefault *attrdef = relation->rd_att->constr->defval;
- int ndef = relation->rd_att->constr->num_defval;
- Relation adrel;
- Relation irel;
- ScanKeyData skey;
- HeapTuple tuple;
+ AttrDefault *attrdef = relation->rd_att->constr->defval;
+ int ndef = relation->rd_att->constr->num_defval;
+ Relation adrel;
+ Relation irel;
+ ScanKeyData skey;
+ HeapTuple tuple;
Form_pg_attrdef adform;
- IndexScanDesc sd;
+ IndexScanDesc sd;
RetrieveIndexResult indexRes;
- Buffer buffer;
- ItemPointer iptr;
+ Buffer buffer;
+ ItemPointer iptr;
struct varlena *val;
- bool isnull;
- int found;
- int i;
+ bool isnull;
+ int found;
+ int i;
ScanKeyEntryInitialize(&skey,
(bits16) 0x0,
@@ -1787,20 +1787,20 @@ AttrDefaultFetch(Relation relation)
static void
RelCheckFetch(Relation relation)
{
- ConstrCheck *check = relation->rd_att->constr->check;
- int ncheck = relation->rd_att->constr->num_check;
- Relation rcrel;
- Relation irel;
- ScanKeyData skey;
- HeapTuple tuple;
- IndexScanDesc sd;
+ ConstrCheck *check = relation->rd_att->constr->check;
+ int ncheck = relation->rd_att->constr->num_check;
+ Relation rcrel;
+ Relation irel;
+ ScanKeyData skey;
+ HeapTuple tuple;
+ IndexScanDesc sd;
RetrieveIndexResult indexRes;
- Buffer buffer;
- ItemPointer iptr;
- Name rcname;
+ Buffer buffer;
+ ItemPointer iptr;
+ Name rcname;
struct varlena *val;
- bool isnull;
- int found;
+ bool isnull;
+ int found;
ScanKeyEntryInitialize(&skey,
(bits16) 0x0,
@@ -1902,17 +1902,17 @@ RelCheckFetch(Relation relation)
static void
init_irels(void)
{
- Size len;
- int nread;
- File fd;
- Relation irel[Num_indices_bootstrap];
- Relation ird;
- Form_pg_am am;
- Form_pg_class relform;
- IndexStrategy strat;
- RegProcedure *support;
- int i;
- int relno;
+ Size len;
+ int nread;
+ File fd;
+ Relation irel[Num_indices_bootstrap];
+ Relation ird;
+ Form_pg_am am;
+ Form_pg_class relform;
+ IndexStrategy strat;
+ RegProcedure *support;
+ int i;
+ int relno;
if ((fd = FileNameOpenFile(INIT_FILENAME, O_RDONLY, 0600)) < 0)
{
@@ -2057,18 +2057,18 @@ init_irels(void)
static void
write_irels(void)
{
- int len;
- int nwritten;
- File fd;
- Relation irel[Num_indices_bootstrap];
- Relation ird;
- Form_pg_am am;
- Form_pg_class relform;
- IndexStrategy strat;
- RegProcedure *support;
- ProcessingMode oldmode;
- int i;
- int relno;
+ int len;
+ int nwritten;
+ File fd;
+ Relation irel[Num_indices_bootstrap];
+ Relation ird;
+ Form_pg_am am;
+ Form_pg_class relform;
+ IndexStrategy strat;
+ RegProcedure *support;
+ ProcessingMode oldmode;
+ int i;
+ int relno;
RelationBuildDescInfo bi;
fd = FileNameOpenFile(INIT_FILENAME, O_WRONLY | O_CREAT | O_TRUNC, 0600);
diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c
index 5f6c22b95fc..75bd7bfcb43 100644
--- a/src/backend/utils/cache/syscache.c
+++ b/src/backend/utils/cache/syscache.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.5 1997/09/07 04:53:10 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.6 1997/09/08 02:31:21 momjian Exp $
*
* NOTES
* These routines allow the parser/planner/executor to perform
@@ -52,12 +52,12 @@
#include "storage/large_object.h"
#include "catalog/pg_listener.h"
-extern bool AMI_OVERRIDE; /* XXX style */
+extern bool AMI_OVERRIDE; /* XXX style */
#include "utils/syscache.h"
#include "catalog/indexing.h"
-typedef HeapTuple(*ScanFunc) ();
+typedef HeapTuple(*ScanFunc) ();
/* ----------------
* Warning: cacheinfo[] below is changed, then be sure and
@@ -321,7 +321,7 @@ static struct cachedesc cacheinfo[] = {
static struct catcache *SysCache[
lengthof(cacheinfo)];
-static int32 SysCacheSize = lengthof(cacheinfo);
+static int32 SysCacheSize = lengthof(cacheinfo);
/*
@@ -344,7 +344,7 @@ zerocaches()
void
InitCatalogCache()
{
- int cacheId; /* XXX type */
+ int cacheId; /* XXX type */
if (!AMI_OVERRIDE)
{
@@ -456,7 +456,7 @@ SearchSysCacheStruct(int cacheId, /* cache selection code */
Datum key3,
Datum key4)
{
- HeapTuple tp;
+ HeapTuple tp;
if (!PointerIsValid(returnStruct))
{
@@ -480,7 +480,7 @@ SearchSysCacheStruct(int cacheId, /* cache selection code */
*
* [callers all assume this returns a (struct varlena *). -ay 10/94]
*/
-void *
+void *
SearchSysCacheGetAttribute(int cacheId,
AttrNumber attributeNumber,
Datum key1,
@@ -488,14 +488,14 @@ SearchSysCacheGetAttribute(int cacheId,
Datum key3,
Datum key4)
{
- HeapTuple tp;
- char *cacheName;
- Relation relation;
- int32 attributeLength,
- attributeByValue;
- bool isNull;
- char *attributeValue;
- void *returnValue;
+ HeapTuple tp;
+ char *cacheName;
+ Relation relation;
+ int32 attributeLength,
+ attributeByValue;
+ bool isNull;
+ char *attributeValue;
+ void *returnValue;
tp = SearchSysCacheTuple(cacheId, key1, key2, key3, key4);
cacheName = cacheinfo[cacheId].name;
@@ -556,8 +556,8 @@ SearchSysCacheGetAttribute(int cacheId,
}
else
{
- char *tmp;
- int size = (attributeLength < 0)
+ char *tmp;
+ int size = (attributeLength < 0)
? VARSIZE((struct varlena *) attributeValue) /* variable length */
: attributeLength; /* fixed length */
@@ -583,16 +583,16 @@ SearchSysCacheGetAttribute(int cacheId,
* [identical to get_typdefault, expecting a (struct varlena *) as ret val.
* some day, either of the functions should be removed -ay 10/94]
*/
-void *
+void *
TypeDefaultRetrieve(Oid typId)
{
- HeapTuple typeTuple;
- TypeTupleForm type;
- int32 typByVal,
- typLen;
+ HeapTuple typeTuple;
+ TypeTupleForm type;
+ int32 typByVal,
+ typLen;
struct varlena *typDefault;
- int32 dataSize;
- void *returnValue;
+ int32 dataSize;
+ void *returnValue;
typeTuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(typId),
@@ -631,25 +631,25 @@ TypeDefaultRetrieve(Oid typId)
if (typByVal)
{
- int8 i8;
- int16 i16;
- int32 i32;
+ int8 i8;
+ int16 i16;
+ int32 i32;
if (dataSize == typLen)
{
switch (typLen)
{
- case sizeof(int8):
- memmove((char *) &i8, VARDATA(typDefault), sizeof(int8));
- i32 = i8;
- break;
- case sizeof(int16):
- memmove((char *) &i16, VARDATA(typDefault), sizeof(int16));
- i32 = i16;
- break;
- case sizeof(int32):
- memmove((char *) &i32, VARDATA(typDefault), sizeof(int32));
- break;
+ case sizeof(int8):
+ memmove((char *) &i8, VARDATA(typDefault), sizeof(int8));
+ i32 = i8;
+ break;
+ case sizeof(int16):
+ memmove((char *) &i16, VARDATA(typDefault), sizeof(int16));
+ i32 = i16;
+ break;
+ case sizeof(int32):
+ memmove((char *) &i32, VARDATA(typDefault), sizeof(int32));
+ break;
}
returnValue = (void *) i32;
}
diff --git a/src/backend/utils/error/assert.c b/src/backend/utils/error/assert.c
index 2c46dde02b8..1e3276fe5cf 100644
--- a/src/backend/utils/error/assert.c
+++ b/src/backend/utils/error/assert.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/error/assert.c,v 1.5 1997/09/07 04:53:11 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/error/assert.c,v 1.6 1997/09/08 02:31:25 momjian Exp $
*
* NOTE
* This should eventually work with elog(), dlog(), etc.
@@ -28,8 +28,8 @@ ExceptionalCondition(char *conditionName,
char *fileName,
int lineNumber)
{
- extern char *ExcFileName;/* XXX */
- extern Index ExcLineNumber; /* XXX */
+ extern char *ExcFileName; /* XXX */
+ extern Index ExcLineNumber; /* XXX */
ExcFileName = fileName;
ExcLineNumber = lineNumber;
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index e4cdc6d595b..5acc371f01c 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.18 1997/09/07 04:53:15 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.19 1997/09/08 02:31:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -29,11 +29,11 @@
#include "libpq/libpq.h"
#include "storage/proc.h"
-static int Debugfile = -1;
-static int Err_file = -1;
-static int ElogDebugIndentLevel = 0;
+static int Debugfile = -1;
+static int Err_file = -1;
+static int ElogDebugIndentLevel = 0;
-extern char OutputFileName[];
+extern char OutputFileName[];
/*
* elog --
@@ -42,24 +42,24 @@ extern char OutputFileName[];
void
elog(int lev, const char *fmt,...)
{
- va_list ap;
- char buf[ELOG_MAXLEN],
- line[ELOG_MAXLEN];
- register char *bp;
+ va_list ap;
+ char buf[ELOG_MAXLEN],
+ line[ELOG_MAXLEN];
+ register char *bp;
register const char *cp;
- extern int errno,
- sys_nerr;
+ extern int errno,
+ sys_nerr;
#ifndef PG_STANDALONE
- extern FILE *Pfout;
+ extern FILE *Pfout;
#endif /* !PG_STANDALONE */
#ifdef ELOG_TIMESTAMPS
- time_t tim;
+ time_t tim;
#endif
- int len;
- int i = 0;
+ int len;
+ int i = 0;
va_start(ap, fmt);
if (lev == DEBUG && Debugfile < 0)
@@ -68,31 +68,31 @@ elog(int lev, const char *fmt,...)
}
switch (lev)
{
- case NOIND:
- i = ElogDebugIndentLevel - 1;
- if (i < 0)
- i = 0;
- if (i > 30)
- i = i % 30;
- cp = "DEBUG:";
- break;
- case DEBUG:
- i = ElogDebugIndentLevel;
- if (i < 0)
- i = 0;
- if (i > 30)
- i = i % 30;
- cp = "DEBUG:";
- break;
- case NOTICE:
- cp = "NOTICE:";
- break;
- case WARN:
- cp = "WARN:";
- break;
- default:
- sprintf(line, "FATAL %d:", lev);
- cp = line;
+ case NOIND:
+ i = ElogDebugIndentLevel - 1;
+ if (i < 0)
+ i = 0;
+ if (i > 30)
+ i = i % 30;
+ cp = "DEBUG:";
+ break;
+ case DEBUG:
+ i = ElogDebugIndentLevel;
+ if (i < 0)
+ i = 0;
+ if (i > 30)
+ i = i % 30;
+ cp = "DEBUG:";
+ break;
+ case NOTICE:
+ cp = "NOTICE:";
+ break;
+ case WARN:
+ cp = "WARN:";
+ break;
+ default:
+ sprintf(line, "FATAL %d:", lev);
+ cp = line;
}
#ifdef ELOG_TIMESTAMPS
time(&tim);
@@ -166,7 +166,7 @@ elog(int lev, const char *fmt,...)
if (lev == WARN)
{
- extern int InWarn;
+ extern int InWarn;
ProcReleaseSpins(NULL); /* get rid of spinlocks we hold */
if (!InWarn)
@@ -209,8 +209,8 @@ elog(int lev, const char *fmt,...)
int
DebugFileOpen(void)
{
- int fd,
- istty;
+ int fd,
+ istty;
Err_file = Debugfile = -1;
ElogDebugIndentLevel = 0;
diff --git a/src/backend/utils/error/exc.c b/src/backend/utils/error/exc.c
index fd169b94a18..cfa0176440d 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.16 1997/09/07 04:53:16 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/exc.c,v 1.17 1997/09/08 02:31:29 momjian Exp $
*
* NOTE
* XXX this code needs improvement--check for state violations and
@@ -34,16 +34,16 @@ ExcPrint(Exception * excP, ExcDetail detail, ExcData data,
/*
* Global Variables
*/
-static bool ExceptionHandlingEnabled = false;
+static bool ExceptionHandlingEnabled = false;
-char *ExcFileName = NULL;
-Index ExcLineNumber = 0;
+char *ExcFileName = NULL;
+Index ExcLineNumber = 0;
-ExcFrame *ExcCurFrameP = NULL;
+ExcFrame *ExcCurFrameP = NULL;
static ExcProc *ExcUnCaughtP = NULL;
-extern char *ProgramName;
+extern char *ProgramName;
/*
* Exported Functions
@@ -103,8 +103,8 @@ ExcPrint(Exception * excP,
ExcData data,
ExcMessage message)
{
- extern int errno;
- extern int sys_nerr;
+ extern int errno;
+ extern int sys_nerr;
#ifdef lint
data = data;
@@ -141,7 +141,7 @@ ExcPrint(Exception * excP,
}
#ifdef NOT_USED
-ExcProc *
+ExcProc *
ExcGetUnCaught(void)
{
return (ExcUnCaughtP);
@@ -150,10 +150,10 @@ ExcGetUnCaught(void)
#endif
#ifdef NOT_USED
-ExcProc *
+ExcProc *
ExcSetUnCaught(ExcProc * newP)
{
- ExcProc *oldP = ExcUnCaughtP;
+ ExcProc *oldP = ExcUnCaughtP;
ExcUnCaughtP = newP;
diff --git a/src/backend/utils/error/excid.c b/src/backend/utils/error/excid.c
index ada9dabed70..b75a6f46b02 100644
--- a/src/backend/utils/error/excid.c
+++ b/src/backend/utils/error/excid.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/excid.c,v 1.3 1997/09/07 04:53:19 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/excid.c,v 1.4 1997/09/08 02:31:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -25,19 +25,19 @@
* FailedAssertion --
* Indicates an Assert(...) failed.
*/
-Exception FailedAssertion = {"Failed Assertion"};
+Exception FailedAssertion = {"Failed Assertion"};
/*
* BadState --
* Indicates a function call request is inconsistent with module state.
*/
-Exception BadState = {"Bad State for Function Call"};
+Exception BadState = {"Bad State for Function Call"};
/*
* BadArg --
* Indicates a function call argument or arguments is out-of-bounds.
*/
-Exception BadArg = {"Bad Argument to Function Call"};
+Exception BadArg = {"Bad Argument to Function Call"};
/*****************************************************************************
* Specific Recoverable Exceptions *
@@ -47,21 +47,21 @@ Exception BadArg = {"Bad Argument to Function Call"};
* BadAllocSize --
* Indicates that an allocation request is of unreasonable size.
*/
-Exception BadAllocSize = {"Too Large Allocation Request"};
+Exception BadAllocSize = {"Too Large Allocation Request"};
/*
* ExhaustedMemory --
* Indicates an dynamic memory allocation failed.
*/
-Exception ExhaustedMemory = {"Memory Allocation Failed"};
+Exception ExhaustedMemory = {"Memory Allocation Failed"};
/*
* Unimplemented --
* Indicates a function call request requires unimplemented code.
*/
-Exception Unimplemented = {"Unimplemented Functionality"};
+Exception Unimplemented = {"Unimplemented Functionality"};
-Exception CatalogFailure = {"Catalog failure"}; /* XXX inconsistent */
-Exception InternalError = {"Internal Error"}; /* XXX inconsistent */
-Exception SemanticError = {"Semantic Error"}; /* XXX inconsistent */
-Exception SystemError = {"System Error"}; /* XXX inconsistent */
+Exception CatalogFailure = {"Catalog failure"}; /* XXX inconsistent */
+Exception InternalError = {"Internal Error"}; /* XXX inconsistent */
+Exception SemanticError = {"Semantic Error"}; /* XXX inconsistent */
+Exception SystemError = {"System Error"}; /* XXX inconsistent */
diff --git a/src/backend/utils/error/format.c b/src/backend/utils/error/format.c
index f996dbb8eb7..384da49a6f5 100644
--- a/src/backend/utils/error/format.c
+++ b/src/backend/utils/error/format.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/format.c,v 1.4 1997/09/07 04:53:20 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/format.c,v 1.5 1997/09/08 02:31:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -18,17 +18,17 @@
#define FormMaxSize 1024
#define FormMinSize (FormMaxSize / 8)
-static char FormBuf[FormMaxSize];
+static char FormBuf[FormMaxSize];
/* ----------------
* form
* ----------------
*/
-char *
+char *
form(const char *fmt,...)
{
- va_list args;
+ va_list args;
va_start(args, fmt);
diff --git a/src/backend/utils/fmgr/dfmgr.c b/src/backend/utils/fmgr/dfmgr.c
index 0be7524290f..2fc776945f3 100644
--- a/src/backend/utils/fmgr/dfmgr.c
+++ b/src/backend/utils/fmgr/dfmgr.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.10 1997/09/07 04:53:24 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.11 1997/09/08 02:31:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -41,24 +41,24 @@ static DynamicFileList *file_tail = (DynamicFileList *) NULL;
#define NOT_EQUAL(A, B) (((A).st_ino != (B).inode) \
|| ((A).st_dev != (B).device))
-static Oid procedureId_save = -1;
-static int pronargs_save;
+static Oid procedureId_save = -1;
+static int pronargs_save;
static func_ptr user_fn_save = (func_ptr) NULL;
static func_ptr handle_load(char *filename, char *funcname);
-func_ptr trigger_dynamic(char *filename, char *funcname);
+func_ptr trigger_dynamic(char *filename, char *funcname);
func_ptr
fmgr_dynamic(Oid procedureId, int *pronargs)
{
- HeapTuple procedureTuple;
- Form_pg_proc procedureStruct;
- char *proname;
- char *probinattr,
- *probinstring;
- func_ptr user_fn;
- Relation rdesc;
- bool isnull;
+ HeapTuple procedureTuple;
+ Form_pg_proc procedureStruct;
+ char *proname;
+ char *probinattr,
+ *probinstring;
+ func_ptr user_fn;
+ Relation rdesc;
+ bool isnull;
if (procedureId == procedureId_save)
{
@@ -118,13 +118,13 @@ fmgr_dynamic(Oid procedureId, int *pronargs)
return (user_fn);
}
-static func_ptr
+static func_ptr
handle_load(char *filename, char *funcname)
{
DynamicFileList *file_scanner = (DynamicFileList *) NULL;
- func_ptr retval = (func_ptr) NULL;
- char *load_error;
- struct stat stat_buf;
+ func_ptr retval = (func_ptr) NULL;
+ char *load_error;
+ struct stat stat_buf;
/*
* Do this because loading files may screw up the dynamic function
@@ -247,10 +247,10 @@ void
load_file(char *filename)
{
DynamicFileList *file_scanner,
- *p;
- struct stat stat_buf;
+ *p;
+ struct stat stat_buf;
- int done = 0;
+ int done = 0;
if (stat(filename, &stat_buf) == -1)
{
@@ -298,7 +298,7 @@ load_file(char *filename)
func_ptr
trigger_dynamic(char *filename, char *funcname)
{
- func_ptr trigger_fn;
+ func_ptr trigger_fn;
trigger_fn = handle_load(filename, funcname);
diff --git a/src/backend/utils/fmgr/fmgr.c b/src/backend/utils/fmgr/fmgr.c
index f7d7b29d0a6..73238f0e15a 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.4 1997/09/07 04:53:30 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.5 1997/09/08 02:31:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -29,14 +29,14 @@
#include "utils/elog.h"
-char *
+char *
fmgr_c(func_ptr user_fn,
Oid func_id,
int n_arguments,
FmgrValues * values,
bool * isNull)
{
- char *returnValue = (char *) NULL;
+ char *returnValue = (char *) NULL;
if (user_fn == (func_ptr) NULL)
@@ -52,63 +52,64 @@ fmgr_c(func_ptr user_fn,
switch (n_arguments)
{
- case 0:
- returnValue = (*user_fn) ();
- break;
- case 1:
- /* NullValue() uses isNull to check if args[0] is NULL */
- returnValue = (*user_fn) (values->data[0], isNull);
- break;
- case 2:
- returnValue = (*user_fn) (values->data[0], values->data[1]);
- break;
- case 3:
- returnValue = (*user_fn) (values->data[0], values->data[1],
- values->data[2]);
- break;
- case 4:
- returnValue = (*user_fn) (values->data[0], values->data[1],
- values->data[2], values->data[3]);
- break;
- case 5:
- returnValue = (*user_fn) (values->data[0], values->data[1],
- values->data[2], values->data[3],
- values->data[4]);
- break;
- case 6:
- returnValue = (*user_fn) (values->data[0], values->data[1],
- values->data[2], values->data[3],
- values->data[4], values->data[5]);
- break;
- case 7:
- returnValue = (*user_fn) (values->data[0], values->data[1],
- values->data[2], values->data[3],
- values->data[4], values->data[5],
- values->data[6]);
- break;
- case 8:
- returnValue = (*user_fn) (values->data[0], values->data[1],
- values->data[2], values->data[3],
- values->data[4], values->data[5],
- values->data[6], values->data[7]);
- break;
- case 9:
+ case 0:
+ returnValue = (*user_fn) ();
+ break;
+ case 1:
+ /* NullValue() uses isNull to check if args[0] is NULL */
+ returnValue = (*user_fn) (values->data[0], isNull);
+ break;
+ case 2:
+ returnValue = (*user_fn) (values->data[0], values->data[1]);
+ break;
+ case 3:
+ returnValue = (*user_fn) (values->data[0], values->data[1],
+ values->data[2]);
+ break;
+ case 4:
+ returnValue = (*user_fn) (values->data[0], values->data[1],
+ values->data[2], values->data[3]);
+ break;
+ case 5:
+ returnValue = (*user_fn) (values->data[0], values->data[1],
+ values->data[2], values->data[3],
+ values->data[4]);
+ break;
+ case 6:
+ returnValue = (*user_fn) (values->data[0], values->data[1],
+ values->data[2], values->data[3],
+ values->data[4], values->data[5]);
+ break;
+ case 7:
+ returnValue = (*user_fn) (values->data[0], values->data[1],
+ values->data[2], values->data[3],
+ values->data[4], values->data[5],
+ values->data[6]);
+ break;
+ case 8:
+ returnValue = (*user_fn) (values->data[0], values->data[1],
+ values->data[2], values->data[3],
+ values->data[4], values->data[5],
+ values->data[6], values->data[7]);
+ break;
+ case 9:
- /*
- * XXX Note that functions with >8 arguments can only be called
- * from inside the system, not from the user level, since the
- * catalogs only store 8 argument types for user type-checking!
- */
- returnValue = (*user_fn) (values->data[0], values->data[1],
- values->data[2], values->data[3],
- values->data[4], values->data[5],
- values->data[6], values->data[7],
- values->data[8]);
- break;
- default:
- elog(WARN, "fmgr_c: function %d: too many arguments (%d > %d)",
- func_id, n_arguments, MAXFMGRARGS);
- break;
+ /*
+ * XXX Note that functions with >8 arguments can only be
+ * called from inside the system, not from the user level,
+ * since the catalogs only store 8 argument types for user
+ * type-checking!
+ */
+ returnValue = (*user_fn) (values->data[0], values->data[1],
+ values->data[2], values->data[3],
+ values->data[4], values->data[5],
+ values->data[6], values->data[7],
+ values->data[8]);
+ break;
+ default:
+ elog(WARN, "fmgr_c: function %d: too many arguments (%d > %d)",
+ func_id, n_arguments, MAXFMGRARGS);
+ break;
}
return (returnValue);
}
@@ -116,11 +117,11 @@ fmgr_c(func_ptr user_fn,
void
fmgr_info(Oid procedureId, func_ptr * function, int *nargs)
{
- func_ptr user_fn = NULL;
- FmgrCall *fcp;
- HeapTuple procedureTuple;
+ func_ptr user_fn = NULL;
+ FmgrCall *fcp;
+ HeapTuple procedureTuple;
FormData_pg_proc *procedureStruct;
- Oid language;
+ Oid language;
if (!(fcp = fmgr_isbuiltin(procedureId)))
{
@@ -143,22 +144,22 @@ fmgr_info(Oid procedureId, func_ptr * function, int *nargs)
language = procedureStruct->prolang;
switch (language)
{
- case INTERNALlanguageId:
- user_fn = fmgr_lookupByName(procedureStruct->proname.data);
- if (!user_fn)
- elog(WARN, "fmgr_info: function %s: not in internal table",
- procedureStruct->proname.data);
- break;
- case ClanguageId:
- user_fn = fmgr_dynamic(procedureId, nargs);
- break;
- case SQLlanguageId:
- user_fn = (func_ptr) NULL;
- *nargs = procedureStruct->pronargs;
- break;
- default:
- elog(WARN, "fmgr_info: function %d: unknown language %d",
- procedureId, language);
+ case INTERNALlanguageId:
+ user_fn = fmgr_lookupByName(procedureStruct->proname.data);
+ if (!user_fn)
+ elog(WARN, "fmgr_info: function %s: not in internal table",
+ procedureStruct->proname.data);
+ break;
+ case ClanguageId:
+ user_fn = fmgr_dynamic(procedureId, nargs);
+ break;
+ case SQLlanguageId:
+ user_fn = (func_ptr) NULL;
+ *nargs = procedureStruct->pronargs;
+ break;
+ default:
+ elog(WARN, "fmgr_info: function %d: unknown language %d",
+ procedureId, language);
}
}
else
@@ -180,15 +181,15 @@ fmgr_info(Oid procedureId, func_ptr * function, int *nargs)
* Returns the return value of the invoked function if succesful,
* 0 if unsuccessful.
*/
-char *
+char *
fmgr(Oid procedureId,...)
{
- va_list pvar;
- register i;
- int pronargs;
- FmgrValues values;
- func_ptr user_fn;
- bool isNull = false;
+ va_list pvar;
+ register i;
+ int pronargs;
+ FmgrValues values;
+ func_ptr user_fn;
+ bool isNull = false;
va_start(pvar, procedureId);
@@ -218,14 +219,14 @@ fmgr(Oid procedureId,...)
* func_ptr, func_id, n_arguments, args...
*/
#ifdef NOT_USED
-char *
+char *
fmgr_ptr(func_ptr user_fn, Oid func_id,...)
{
- va_list pvar;
- register i;
- int n_arguments;
- FmgrValues values;
- bool isNull = false;
+ va_list pvar;
+ register i;
+ int n_arguments;
+ FmgrValues values;
+ bool isNull = false;
va_start(pvar, func_id);
n_arguments = va_arg(pvar, int);
@@ -250,11 +251,11 @@ fmgr_ptr(func_ptr user_fn, Oid func_id,...)
* function pointer field to FuncIndexInfo, it will be replace by calls
* to fmgr_c().
*/
-char *
+char *
fmgr_array_args(Oid procedureId, int nargs, char *args[], bool * isNull)
{
- func_ptr user_fn;
- int true_arguments;
+ func_ptr user_fn;
+ int true_arguments;
fmgr_info(procedureId, &user_fn, &true_arguments);
diff --git a/src/backend/utils/hash/dynahash.c b/src/backend/utils/hash/dynahash.c
index 736ca39d09f..8f306ff9a80 100644
--- a/src/backend/utils/hash/dynahash.c
+++ b/src/backend/utils/hash/dynahash.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/hash/dynahash.c,v 1.8 1997/09/07 04:53:33 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/hash/dynahash.c,v 1.9 1997/09/08 02:31:41 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -64,14 +64,14 @@
/*
* Private function prototypes
*/
-static long *DynaHashAlloc(unsigned int size);
-static void DynaHashFree(Pointer ptr);
-static uint32 call_hash(HTAB * hashp, char *k, int len);
+static long *DynaHashAlloc(unsigned int size);
+static void DynaHashFree(Pointer ptr);
+static uint32 call_hash(HTAB * hashp, char *k, int len);
static SEG_OFFSET seg_alloc(HTAB * hashp);
-static int bucket_alloc(HTAB * hashp);
-static int dir_realloc(HTAB * hashp);
+static int bucket_alloc(HTAB * hashp);
+static int dir_realloc(HTAB * hashp);
-typedef long *((*dhalloc_ptr) ());
+typedef long *((*dhalloc_ptr) ());
#ifndef FRONTEND
/* ----------------
@@ -89,9 +89,9 @@ typedef long *((*dhalloc_ptr) ());
* do the latter -cim 1/19/91
* ----------------
*/
-GlobalMemory DynaHashCxt = (GlobalMemory) NULL;
+GlobalMemory DynaHashCxt = (GlobalMemory) NULL;
-static long *
+static long *
DynaHashAlloc(unsigned int size)
{
if (!DynaHashCxt)
@@ -122,9 +122,9 @@ DynaHashFree(Pointer ptr)
* ----------------
*/
-static int expand_table(HTAB * hashp);
-static int hdefault(HTAB * hashp);
-static int init_htab(HTAB * hashp, int nelem);
+static int expand_table(HTAB * hashp);
+static int hdefault(HTAB * hashp);
+static int init_htab(HTAB * hashp, int nelem);
/*
@@ -146,19 +146,19 @@ static int init_htab(HTAB * hashp, int nelem);
( ((unsigned long) ptr) - ((unsigned long) (hp)->segbase) )
#if HASH_STATISTICS
-static long hash_accesses,
- hash_collisions,
- hash_expansions;
+static long hash_accesses,
+ hash_collisions,
+ hash_expansions;
#endif
/************************** CREATE ROUTINES **********************/
-HTAB *
+HTAB *
hash_create(int nelem, HASHCTL * info, int flags)
{
- register HHDR *hctl;
- HTAB *hashp;
+ register HHDR *hctl;
+ HTAB *hashp;
hashp = (HTAB *) MEM_ALLOC((unsigned long) sizeof(HTAB));
@@ -269,7 +269,7 @@ hash_create(int nelem, HASHCTL * info, int flags)
static int
hdefault(HTAB * hashp)
{
- HHDR *hctl;
+ HHDR *hctl;
memset(hashp->hctl, 0, sizeof(HHDR));
@@ -303,10 +303,10 @@ static int
init_htab(HTAB * hashp, int nelem)
{
register SEG_OFFSET *segp;
- register int nbuckets;
- register int nsegs;
- int l2;
- HHDR *hctl;
+ register int nbuckets;
+ register int nsegs;
+ int l2;
+ HHDR *hctl;
hctl = hashp->hctl;
@@ -388,13 +388,13 @@ hash_destroy(HTAB * hashp)
if (hashp != NULL)
{
register SEG_OFFSET segNum;
- SEGMENT segp;
- int nsegs = hashp->hctl->nsegs;
- int j;
- BUCKET_INDEX *elp,
- p,
- q;
- ELEMENT *curr;
+ SEGMENT segp;
+ int nsegs = hashp->hctl->nsegs;
+ int j;
+ BUCKET_INDEX *elp,
+ p,
+ q;
+ ELEMENT *curr;
for (segNum = 0; nsegs > 0; nsegs--, segNum++)
{
@@ -440,12 +440,12 @@ hash_stats(char *where, HTAB * hashp)
/*******************************SEARCH ROUTINES *****************************/
-static uint32
+static uint32
call_hash(HTAB * hashp, char *k, int len)
{
- long hash_val,
- bucket;
- HHDR *hctl;
+ long hash_val,
+ bucket;
+ HHDR *hctl;
hctl = hashp->hctl;
hash_val = hashp->hash(k, len);
@@ -469,28 +469,28 @@ call_hash(HTAB * hashp, char *k, int len)
* foundPtr is TRUE if we found an element in the table
* (FALSE if we entered one).
*/
-long *
+long *
hash_search(HTAB * hashp,
char *keyPtr,
HASHACTION action, /* HASH_FIND / HASH_ENTER / HASH_REMOVE
* HASH_FIND_SAVE / HASH_REMOVE_SAVED */
bool * foundPtr)
{
- uint32 bucket;
- long segment_num;
- long segment_ndx;
- SEGMENT segp;
+ uint32 bucket;
+ long segment_num;
+ long segment_ndx;
+ SEGMENT segp;
register ELEMENT *curr;
- HHDR *hctl;
- BUCKET_INDEX currIndex;
- BUCKET_INDEX *prevIndexPtr;
- char *destAddr;
+ HHDR *hctl;
+ BUCKET_INDEX currIndex;
+ BUCKET_INDEX *prevIndexPtr;
+ char *destAddr;
static struct State
{
- ELEMENT *currElem;
- BUCKET_INDEX currIndex;
- BUCKET_INDEX *prevIndex;
- } saveState;
+ ELEMENT *currElem;
+ BUCKET_INDEX currIndex;
+ BUCKET_INDEX *prevIndex;
+ } saveState;
Assert((hashp && keyPtr));
Assert((action == HASH_FIND) || (action == HASH_REMOVE) || (action == HASH_ENTER) || (action == HASH_FIND_SAVE) || (action == HASH_REMOVE_SAVED));
@@ -553,46 +553,46 @@ hash_search(HTAB * hashp,
*foundPtr = (bool) (currIndex != INVALID_INDEX);
switch (action)
{
- case HASH_ENTER:
- if (currIndex != INVALID_INDEX)
- return (&(curr->key));
- break;
- case HASH_REMOVE:
- case HASH_REMOVE_SAVED:
- if (currIndex != INVALID_INDEX)
- {
- Assert(hctl->nkeys > 0);
- hctl->nkeys--;
-
- /* add the bucket to the freelist for this table. */
- *prevIndexPtr = curr->next;
- curr->next = hctl->freeBucketIndex;
- hctl->freeBucketIndex = currIndex;
-
- /*
- * better hope the caller is synchronizing access to this
- * element, because someone else is going to reuse it the next
- * time something is added to the table
- */
- return (&(curr->key));
- }
- return ((long *) TRUE);
- case HASH_FIND:
- if (currIndex != INVALID_INDEX)
- return (&(curr->key));
- return ((long *) TRUE);
- case HASH_FIND_SAVE:
- if (currIndex != INVALID_INDEX)
- {
- saveState.currElem = curr;
- saveState.prevIndex = prevIndexPtr;
- saveState.currIndex = currIndex;
- return (&(curr->key));
- }
- return ((long *) TRUE);
- default:
- /* can't get here */
- return (NULL);
+ case HASH_ENTER:
+ if (currIndex != INVALID_INDEX)
+ return (&(curr->key));
+ break;
+ case HASH_REMOVE:
+ case HASH_REMOVE_SAVED:
+ if (currIndex != INVALID_INDEX)
+ {
+ Assert(hctl->nkeys > 0);
+ hctl->nkeys--;
+
+ /* add the bucket to the freelist for this table. */
+ *prevIndexPtr = curr->next;
+ curr->next = hctl->freeBucketIndex;
+ hctl->freeBucketIndex = currIndex;
+
+ /*
+ * better hope the caller is synchronizing access to this
+ * element, because someone else is going to reuse it the
+ * next time something is added to the table
+ */
+ return (&(curr->key));
+ }
+ return ((long *) TRUE);
+ case HASH_FIND:
+ if (currIndex != INVALID_INDEX)
+ return (&(curr->key));
+ return ((long *) TRUE);
+ case HASH_FIND_SAVE:
+ if (currIndex != INVALID_INDEX)
+ {
+ saveState.currElem = curr;
+ saveState.prevIndex = prevIndexPtr;
+ saveState.currIndex = currIndex;
+ return (&(curr->key));
+ }
+ return ((long *) TRUE);
+ default:
+ /* can't get here */
+ return (NULL);
}
/*
@@ -653,16 +653,16 @@ hash_search(HTAB * hashp,
* return TRUE in the end.
*
*/
-long *
+long *
hash_seq(HTAB * hashp)
{
- static uint32 curBucket = 0;
+ static uint32 curBucket = 0;
static BUCKET_INDEX curIndex;
- ELEMENT *curElem;
- long segment_num;
- long segment_ndx;
- SEGMENT segp;
- HHDR *hctl;
+ ELEMENT *curElem;
+ long segment_num;
+ long segment_ndx;
+ SEGMENT segp;
+ HHDR *hctl;
if (hashp == NULL)
{
@@ -723,20 +723,20 @@ hash_seq(HTAB * hashp)
static int
expand_table(HTAB * hashp)
{
- HHDR *hctl;
- SEGMENT old_seg,
- new_seg;
- long old_bucket,
- new_bucket;
- long new_segnum,
- new_segndx;
- long old_segnum,
- old_segndx;
- ELEMENT *chain;
- BUCKET_INDEX *old,
- *newbi;
+ HHDR *hctl;
+ SEGMENT old_seg,
+ new_seg;
+ long old_bucket,
+ new_bucket;
+ long new_segnum,
+ new_segndx;
+ long old_segnum,
+ old_segndx;
+ ELEMENT *chain;
+ BUCKET_INDEX *old,
+ *newbi;
register BUCKET_INDEX chainIndex,
- nextIndex;
+ nextIndex;
#ifdef HASH_STATISTICS
hash_expansions++;
@@ -811,10 +811,10 @@ expand_table(HTAB * hashp)
static int
dir_realloc(HTAB * hashp)
{
- register char *p;
- char **p_ptr;
- long old_dirsize;
- long new_dirsize;
+ register char *p;
+ char **p_ptr;
+ long old_dirsize;
+ long new_dirsize;
if (hashp->hctl->max_dsize != NO_MAX_DSIZE)
@@ -840,11 +840,11 @@ dir_realloc(HTAB * hashp)
}
-static SEG_OFFSET
+static SEG_OFFSET
seg_alloc(HTAB * hashp)
{
- SEGMENT segp;
- SEG_OFFSET segOffset;
+ SEGMENT segp;
+ SEG_OFFSET segOffset;
segp = (SEGMENT) hashp->alloc((unsigned long)
@@ -868,11 +868,11 @@ seg_alloc(HTAB * hashp)
static int
bucket_alloc(HTAB * hashp)
{
- int i;
- ELEMENT *tmpBucket;
- long bucketSize;
- BUCKET_INDEX tmpIndex,
- lastIndex;
+ int i;
+ ELEMENT *tmpBucket;
+ long bucketSize;
+ BUCKET_INDEX tmpIndex,
+ lastIndex;
bucketSize =
sizeof(BUCKET_INDEX) + hashp->hctl->keysize + hashp->hctl->datasize;
@@ -918,8 +918,8 @@ bucket_alloc(HTAB * hashp)
int
my_log2(long num)
{
- int i = 1;
- int limit;
+ int i = 1;
+ int limit;
for (i = 0, limit = 1; limit < num; limit = 2 * limit, i++);
return (i);
diff --git a/src/backend/utils/hash/hashfn.c b/src/backend/utils/hash/hashfn.c
index f7b8f3fde6e..a0439fb0baa 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.4 1997/09/07 04:53:38 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/hash/hashfn.c,v 1.5 1997/09/08 02:31:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,7 +24,7 @@
long
string_hash(char *key, int keysize)
{
- int h;
+ int h;
register unsigned char *k = (unsigned char *) key;
h = 0;
@@ -43,7 +43,7 @@ string_hash(char *key, int keysize)
long
tag_hash(int *key, int keysize)
{
- register long h = 0;
+ register long h = 0;
/*
* Convert tag to integer; Use four byte chunks in a "jump table" to
@@ -53,64 +53,64 @@ tag_hash(int *key, int keysize)
*/
switch (keysize)
{
- case 6 * sizeof(int):
- h = h * PRIME1 ^ (*key);
- key++;
- /* fall through */
-
- case 5 * sizeof(int):
- h = h * PRIME1 ^ (*key);
- key++;
- /* fall through */
-
- case 4 * sizeof(int):
- h = h * PRIME1 ^ (*key);
- key++;
- /* fall through */
-
- case 3 * sizeof(int):
- h = h * PRIME1 ^ (*key);
- key++;
- /* fall through */
-
- case 2 * sizeof(int):
- h = h * PRIME1 ^ (*key);
- key++;
- /* fall through */
-
- case sizeof(int):
- h = h * PRIME1 ^ (*key);
- key++;
- break;
-
- default:
- for (; keysize > (sizeof(int) - 1); keysize -= sizeof(int), key++)
+ case 6 * sizeof(int):
h = h * PRIME1 ^ (*key);
+ key++;
+ /* fall through */
- /*
- * now let's grab the last few bytes of the tag if the tag has
- * (size % 4) != 0 (which it sometimes will on a sun3).
- */
- if (keysize)
- {
- char *keytmp = (char *) key;
+ case 5 * sizeof(int):
+ h = h * PRIME1 ^ (*key);
+ key++;
+ /* fall through */
+
+ case 4 * sizeof(int):
+ h = h * PRIME1 ^ (*key);
+ key++;
+ /* fall through */
+
+ case 3 * sizeof(int):
+ h = h * PRIME1 ^ (*key);
+ key++;
+ /* fall through */
+
+ case 2 * sizeof(int):
+ h = h * PRIME1 ^ (*key);
+ key++;
+ /* fall through */
- switch (keysize)
+ case sizeof(int):
+ h = h * PRIME1 ^ (*key);
+ key++;
+ break;
+
+ default:
+ for (; keysize > (sizeof(int) - 1); keysize -= sizeof(int), key++)
+ h = h * PRIME1 ^ (*key);
+
+ /*
+ * now let's grab the last few bytes of the tag if the tag has
+ * (size % 4) != 0 (which it sometimes will on a sun3).
+ */
+ if (keysize)
{
- case 3:
- h = h * PRIME1 ^ (*keytmp);
- keytmp++;
- /* fall through */
- case 2:
- h = h * PRIME1 ^ (*keytmp);
- keytmp++;
- /* fall through */
- case 1:
- h = h * PRIME1 ^ (*keytmp);
- break;
+ char *keytmp = (char *) key;
+
+ switch (keysize)
+ {
+ case 3:
+ h = h * PRIME1 ^ (*keytmp);
+ keytmp++;
+ /* fall through */
+ case 2:
+ h = h * PRIME1 ^ (*keytmp);
+ keytmp++;
+ /* fall through */
+ case 1:
+ h = h * PRIME1 ^ (*keytmp);
+ break;
+ }
}
- }
- break;
+ break;
}
h %= PRIME2;
@@ -130,10 +130,10 @@ tag_hash(int *key, int keysize)
long
disk_hash(char *key)
{
- register int n = 0;
- register char *str = key;
- register int len = strlen(key);
- register int loop;
+ register int n = 0;
+ register char *str = key;
+ register int len = strlen(key);
+ register int loop;
#define HASHC n = *str++ + 65599 * n
@@ -143,25 +143,25 @@ disk_hash(char *key)
switch (len & (8 - 1))
{
- case 0:
- do
- { /* All fall throughs */
- HASHC;
- case 7:
- HASHC;
- case 6:
- HASHC;
- case 5:
- HASHC;
- case 4:
- HASHC;
- case 3:
- HASHC;
- case 2:
- HASHC;
- case 1:
- HASHC;
- } while (--loop);
+ case 0:
+ do
+ { /* All fall throughs */
+ HASHC;
+ case 7:
+ HASHC;
+ case 6:
+ HASHC;
+ case 5:
+ HASHC;
+ case 4:
+ HASHC;
+ case 3:
+ HASHC;
+ case 2:
+ HASHC;
+ case 1:
+ HASHC;
+ } while (--loop);
}
}
diff --git a/src/backend/utils/init/findbe.c b/src/backend/utils/init/findbe.c
index 5e6aa7412a6..e2cc9219a74 100644
--- a/src/backend/utils/init/findbe.c
+++ b/src/backend/utils/init/findbe.c
@@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/findbe.c,v 1.6 1997/09/07 04:53:45 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/findbe.c,v 1.7 1997/09/08 02:31:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -43,14 +43,14 @@
int
ValidateBackend(char *path)
{
- struct stat buf;
- uid_t euid;
- struct group *gp;
- struct passwd *pwp;
- int i;
- int is_r = 0;
- int is_x = 0;
- int in_grp = 0;
+ struct stat buf;
+ uid_t euid;
+ struct group *gp;
+ struct passwd *pwp;
+ int i;
+ int is_r = 0;
+ int is_x = 0;
+ int in_grp = 0;
/*
* Ensure that the file exists and is a regular file.
@@ -153,12 +153,12 @@ ValidateBackend(char *path)
int
FindBackend(char *backend, char *argv0)
{
- char buf[MAXPGPATH + 2];
- char *p;
- char *path,
- *startp,
- *endp;
- int pathlen;
+ char buf[MAXPGPATH + 2];
+ char *p;
+ char *path,
+ *startp,
+ *endp;
+ int pathlen;
/*
* for the postmaster: First try: use the backend that's located in
@@ -222,20 +222,20 @@ FindBackend(char *backend, char *argv0)
strcat(buf, "/postgres");
switch (ValidateBackend(buf))
{
- case 0: /* found ok */
- strncpy(backend, buf, MAXPGPATH);
- if (DebugLvl)
- fprintf(stderr, "FindBackend: found \"%s\" using PATH\n",
- backend);
- free(path);
- return (0);
- case -1: /* wasn't even a candidate, keep looking */
- break;
- case -2: /* found but disqualified */
- fprintf(stderr, "FindBackend: could not read backend \"%s\"\n",
- buf);
- free(path);
- return (-1);
+ case 0: /* found ok */
+ strncpy(backend, buf, MAXPGPATH);
+ if (DebugLvl)
+ fprintf(stderr, "FindBackend: found \"%s\" using PATH\n",
+ backend);
+ free(path);
+ return (0);
+ case -1: /* wasn't even a candidate, keep looking */
+ break;
+ case -2: /* found but disqualified */
+ fprintf(stderr, "FindBackend: could not read backend \"%s\"\n",
+ buf);
+ free(path);
+ return (-1);
}
if (!endp) /* last one */
break;
diff --git a/src/backend/utils/init/globals.c b/src/backend/utils/init/globals.c
index 2ed0c83e0b2..131e352ddfb 100644
--- a/src/backend/utils/init/globals.c
+++ b/src/backend/utils/init/globals.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.11 1997/09/07 04:53:48 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.12 1997/09/08 02:31:56 momjian Exp $
*
* NOTES
* Globals used all over the place should be declared here and not
@@ -36,52 +36,52 @@
#include "catalog/catname.h"
-int Portfd = -1;
-int Noversion = 0;
-int Quiet = 1;
+int Portfd = -1;
+int Noversion = 0;
+int Quiet = 1;
-int MasterPid;
-char *DataDir;
+int MasterPid;
+char *DataDir;
/*
* The PGDATA directory user says to use, or defaults to via environment
* variable. NULL if no option given and no environment variable set
*/
-Relation reldesc; /* current relation descriptor */
+Relation reldesc; /* current relation descriptor */
-char OutputFileName[MAXPGPATH] = "";
+char OutputFileName[MAXPGPATH] = "";
-BackendId MyBackendId;
-BackendTag MyBackendTag;
+BackendId MyBackendId;
+BackendTag MyBackendTag;
-char *UserName = NULL;
-char *DatabaseName = NULL;
-char *DatabasePath = NULL;
+char *UserName = NULL;
+char *DatabaseName = NULL;
+char *DatabasePath = NULL;
-bool MyDatabaseIdIsInitialized = false;
-Oid MyDatabaseId = InvalidOid;
-bool TransactionInitWasProcessed = false;
+bool MyDatabaseIdIsInitialized = false;
+Oid MyDatabaseId = InvalidOid;
+bool TransactionInitWasProcessed = false;
-bool IsUnderPostmaster = false;
-bool IsPostmaster = false;
+bool IsUnderPostmaster = false;
+bool IsPostmaster = false;
-short DebugLvl = 0;
+short DebugLvl = 0;
-int DateStyle = USE_POSTGRES_DATES;
-bool EuroDates = false;
-bool HasCTZSet = false;
-bool CDayLight = false;
-int CTimeZone = 0;
-char CTZName[MAXTZLEN + 1] = "";
+int DateStyle = USE_POSTGRES_DATES;
+bool EuroDates = false;
+bool HasCTZSet = false;
+bool CDayLight = false;
+int CTimeZone = 0;
+char CTZName[MAXTZLEN + 1] = "";
-char DateFormat[20] = "%d-%m-%Y"; /* mjl: sizes! or better
+char DateFormat[20] = "%d-%m-%Y"; /* mjl: sizes! or better
* malloc? XXX */
-char FloatFormat[20] = "%f";
+char FloatFormat[20] = "%f";
-int fsyncOff = 0;
-int SortMem = 512;
+int fsyncOff = 0;
+int SortMem = 512;
-char *IndexedCatalogNames[] = {
+char *IndexedCatalogNames[] = {
AttributeRelationName,
ProcedureRelationName,
TypeRelationName,
@@ -105,7 +105,7 @@ char *IndexedCatalogNames[] = {
* XXX this is a serious hack which should be fixed -cim 1/26/90
* ----------------
*/
-char *SharedSystemRelationNames[] = {
+char *SharedSystemRelationNames[] = {
DatabaseRelationName,
DefaultsRelationName,
DemonRelationName,
diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c
index 71efb80d120..e608bb484f8 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.7 1997/09/07 04:53:49 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.8 1997/09/08 02:31:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -44,12 +44,12 @@
*/
#define EnableAbortEnvVarName "POSTGRESABORT"
-extern char *getenv(const char *name); /* XXX STDLIB */
+extern char *getenv(const char *name); /* XXX STDLIB */
/* from globals.c */
-extern char *DatabaseName;
-extern char *UserName;
-extern char *DatabasePath;
+extern char *DatabaseName;
+extern char *UserName;
+extern char *DatabasePath;
/*
@@ -105,7 +105,7 @@ ExitPostgres(ExitStatus status)
void
AbortPostgres()
{
- char *abortValue = getenv(EnableAbortEnvVarName);
+ char *abortValue = getenv(EnableAbortEnvVarName);
#ifdef __SABER__
saber_stop();
@@ -223,7 +223,7 @@ GetProcessingMode()
* Returns path to database.
*
*/
-char *
+char *
GetDatabasePath()
{
return DatabasePath;
@@ -233,7 +233,7 @@ GetDatabasePath()
* GetDatabaseName --
* Returns name of database.
*/
-char *
+char *
GetDatabaseName()
{
return DatabaseName;
@@ -269,7 +269,7 @@ SetDatabaseName(char *name)
* in pg_proc.h). Define GetPgUserName() as a macro - tgl 97/04/26
* ----------------
*/
-char *
+char *
getpgusername()
{
return UserName;
@@ -279,8 +279,8 @@ void
SetPgUserName()
{
#ifndef NO_SECURITY
- char *p;
- struct passwd *pw;
+ char *p;
+ struct passwd *pw;
if (IsUnderPostmaster)
{
@@ -306,7 +306,7 @@ SetPgUserName()
* GetUserId and SetUserId
* ----------------------------------------------------------------
*/
-static Oid UserId = InvalidOid;
+static Oid UserId = InvalidOid;
Oid
GetUserId()
@@ -318,8 +318,8 @@ GetUserId()
void
SetUserId()
{
- HeapTuple userTup;
- char *userName;
+ HeapTuple userTup;
+ char *userName;
Assert(!OidIsValid(UserId));/* only once */
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index 5a8a1a83d4d..47e7842d451 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.13 1997/09/07 04:53:50 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.14 1997/09/08 02:31:58 momjian Exp $
*
* NOTES
* InitPostgres() is the function called from PostgresMain
@@ -70,13 +70,13 @@
#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 void InitCommunication(void);
+static void InitMyDatabaseId(void);
+static void InitStdio(void);
+static void InitUserid(void);
-static IPCKey PostgresIpcKey;
+static IPCKey PostgresIpcKey;
/* ----------------------------------------------------------------
* InitPostgres support
@@ -106,15 +106,15 @@ static IPCKey PostgresIpcKey;
static void
InitMyDatabaseId()
{
- int dbfd;
- int fileflags;
- int nbytes;
- int max,
- i;
- HeapTuple tup;
- Page pg;
- PageHeader ph;
- char *dbfname;
+ int dbfd;
+ int fileflags;
+ int nbytes;
+ int max,
+ i;
+ HeapTuple tup;
+ Page pg;
+ PageHeader ph;
+ char *dbfname;
Form_pg_database tup_db;
/*
@@ -165,7 +165,7 @@ InitMyDatabaseId()
/* look at each tuple on the page */
for (i = 0; i <= max; i++)
{
- int offset;
+ int offset;
/* if it's a freed tuple, ignore it */
if (!(ph->pd_linp[i].lp_flags & LP_USED))
@@ -253,11 +253,11 @@ done:
static void
DoChdirAndInitDatabaseNameAndPath(char *name)
{
- char *reason;
+ char *reason;
/* Failure reason returned by some function. NULL if no failure */
- int fd;
- char errormsg[1000];
+ int fd;
+ char errormsg[1000];
if ((fd = open(DataDir, O_RDONLY, 0)) == -1)
sprintf(errormsg, "Database system does not exist. "
@@ -266,8 +266,7 @@ DoChdirAndInitDatabaseNameAndPath(char *name)
DataDir);
else
{
- char myPath[MAXPGPATH]; /* DatabasePath points
- * here! */
+ char myPath[MAXPGPATH]; /* DatabasePath points here! */
close(fd);
if (strlen(DataDir) + strlen(name) + 10 > sizeof(myPath))
@@ -317,8 +316,8 @@ DoChdirAndInitDatabaseNameAndPath(char *name)
* The directories and PG_VERSION files are in
* order.
*/
- int rc; /* return code from some
- * function we call */
+ int rc; /* return code from some function
+ * we call */
SetDatabasePath(myPath);
SetDatabaseName(name);
@@ -368,9 +367,9 @@ InitUserid()
static void
InitCommunication()
{
- char *postid;
- char *postport;
- IPCKey key = 0;
+ char *postid;
+ char *postport;
+ IPCKey key = 0;
/* ----------------
* try and get the backend tag from POSTID
@@ -495,8 +494,8 @@ InitStdio()
* Be very careful with the order of calls in the InitPostgres function.
* --------------------------------
*/
-bool PostgresIsInitialized = false;
-extern int NBuffers;
+bool PostgresIsInitialized = false;
+extern int NBuffers;
/*
* this global is used by wei for testing his code, but must be declared
@@ -505,14 +504,14 @@ extern int NBuffers;
*/
/*int testFlag = 0;*/
-int lockingOff = 0;
+int lockingOff = 0;
/*
*/
void
InitPostgres(char *name) /* database name */
{
- bool bootstrap; /* true if BootstrapProcessing */
+ bool bootstrap; /* true if BootstrapProcessing */
/* ----------------
* see if we're running in BootstrapProcessing mode
diff --git a/src/backend/utils/misc/superuser.c b/src/backend/utils/misc/superuser.c
index 57a9950dea3..bfc6efdeae6 100644
--- a/src/backend/utils/misc/superuser.c
+++ b/src/backend/utils/misc/superuser.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/misc/superuser.c,v 1.3 1997/09/07 04:53:52 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/misc/superuser.c,v 1.4 1997/09/08 02:32:00 momjian Exp $
*
* DESCRIPTION
* See superuser().
@@ -26,9 +26,9 @@ superuser(void)
The Postgres user running this command has Postgres superuser
privileges.
--------------------------------------------------------------------------*/
- extern char *UserName; /* defined in global.c */
+ extern char *UserName; /* defined in global.c */
- HeapTuple utup;
+ HeapTuple utup;
utup = SearchSysCacheTuple(USENAME, PointerGetDatum(UserName),
0, 0, 0);
diff --git a/src/backend/utils/mmgr/aset.c b/src/backend/utils/mmgr/aset.c
index c07fb1bd587..f78d8b5f320 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.6 1997/09/07 04:54:01 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/aset.c,v 1.7 1997/09/08 02:32:05 momjian Exp $
*
* NOTE
* XXX This is a preliminary implementation which lacks fail-fast
@@ -25,7 +25,7 @@
#include <string.h>
#endif
-static void AllocPointerDump(AllocPointer pointer);
+static void AllocPointerDump(AllocPointer pointer);
static int
AllocSetIterate(AllocSet set,
void (*function) (AllocPointer pointer));
@@ -45,8 +45,8 @@ AllocSetIterate(AllocSet set,
typedef struct AllocElemData
{
OrderedElemData elemData; /* elem in AllocSet */
- Size size;
-} AllocElemData;
+ Size size;
+} AllocElemData;
typedef AllocElemData *AllocElem;
@@ -125,7 +125,7 @@ AllocSetInit(AllocSet set, AllocMode mode, Size limit)
void
AllocSetReset(AllocSet set)
{
- AllocPointer pointer;
+ AllocPointer pointer;
AssertArg(AllocSetIsValid(set));
@@ -139,7 +139,7 @@ AllocSetReset(AllocSet set)
void
AllocSetReset_debug(char *file, int line, AllocSet set)
{
- AllocPointer pointer;
+ AllocPointer pointer;
AssertArg(AllocSetIsValid(set));
@@ -181,7 +181,7 @@ AllocSetContains(AllocSet set, AllocPointer pointer)
AllocPointer
AllocSetAlloc(AllocSet set, Size size)
{
- AllocElem alloc;
+ AllocElem alloc;
AssertArg(AllocSetIsValid(set));
@@ -214,7 +214,7 @@ AllocSetAlloc(AllocSet set, Size size)
void
AllocSetFree(AllocSet set, AllocPointer pointer)
{
- AllocElem alloc;
+ AllocElem alloc;
/* AssertArg(AllocSetIsValid(set)); */
/* AssertArg(AllocPointerIsValid(pointer)); */
@@ -244,8 +244,8 @@ AllocSetFree(AllocSet set, AllocPointer pointer)
AllocPointer
AllocSetRealloc(AllocSet set, AllocPointer pointer, Size size)
{
- AllocPointer newPointer;
- AllocElem alloc;
+ AllocPointer newPointer;
+ AllocElem alloc;
/* AssertArg(AllocSetIsValid(set)); */
/* AssertArg(AllocPointerIsValid(pointer)); */
@@ -287,8 +287,8 @@ static int
AllocSetIterate(AllocSet set,
void (*function) (AllocPointer pointer))
{
- int count = 0;
- AllocPointer pointer;
+ int count = 0;
+ AllocPointer pointer;
AssertArg(AllocSetIsValid(set));
@@ -311,8 +311,8 @@ AllocSetIterate(AllocSet set,
int
AllocSetCount(AllocSet set)
{
- int count = 0;
- AllocPointer pointer;
+ int count = 0;
+ AllocPointer pointer;
AssertArg(AllocSetIsValid(set));
@@ -338,10 +338,10 @@ AllocSetCount(AllocSet set)
* Note:
* Assumes set is valid.
*/
-static AllocPointer
+static AllocPointer
AllocSetGetFirst(AllocSet set)
{
- AllocElem alloc;
+ AllocElem alloc;
alloc = (AllocElem) OrderedSetGetHead(&set->setData);
@@ -360,10 +360,10 @@ AllocSetGetFirst(AllocSet set)
* Note:
* Assumes pointer is valid.
*/
-static AllocPointer
+static AllocPointer
AllocPointerGetNext(AllocPointer pointer)
{
- AllocElem alloc;
+ AllocElem alloc;
alloc = (AllocElem)
OrderedElemGetSuccessor(&AllocPointerGetAllocElem(pointer)->elemData);
@@ -398,7 +398,7 @@ AllocPointerDump(AllocPointer pointer)
void
AllocSetDump(AllocSet set)
{
- int count;
+ int count;
count = AllocSetIterate(set, AllocPointerDump);
printf("\ttotal %d allocations\n", count);
diff --git a/src/backend/utils/mmgr/mcxt.c b/src/backend/utils/mmgr/mcxt.c
index dbd1b6e19f6..61cf729fa8b 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.4 1997/09/07 04:54:08 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/mcxt.c,v 1.5 1997/09/08 02:32:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -35,7 +35,7 @@
/*
* Global State
*/
-static int MemoryContextEnableCount = 0;
+static int MemoryContextEnableCount = 0;
#define MemoryContextEnabled (MemoryContextEnableCount > 0)
@@ -67,22 +67,22 @@ static OrderedSetData ActiveGlobalMemorySetData; /* uninitialized */
* CurrentMemoryContext --
* Memory context for general global allocations.
*/
-MemoryContext CurrentMemoryContext = NULL;
+MemoryContext CurrentMemoryContext = NULL;
/*****************************************************************************
* PRIVATE DEFINITIONS *
*****************************************************************************/
-static Pointer GlobalMemoryAlloc(GlobalMemory this, Size size);
-static void GlobalMemoryFree(GlobalMemory this, Pointer pointer);
+static Pointer GlobalMemoryAlloc(GlobalMemory this, Size size);
+static void GlobalMemoryFree(GlobalMemory this, Pointer pointer);
static Pointer
GlobalMemoryRealloc(GlobalMemory this, Pointer pointer,
Size size);
-static char *GlobalMemoryGetName(GlobalMemory this);
-static void GlobalMemoryDump(GlobalMemory this);
+static char *GlobalMemoryGetName(GlobalMemory this);
+static void GlobalMemoryDump(GlobalMemory this);
#ifdef NOT_USED
-static void DumpGlobalMemories(void);
+static void DumpGlobalMemories(void);
#endif
@@ -121,7 +121,7 @@ static struct GlobalMemory TopGlobalMemoryData = {
* allocate something here, you are expected to clean it up when
* appropriate.
*/
-MemoryContext TopMemoryContext = (MemoryContext) & TopGlobalMemoryData;
+MemoryContext TopMemoryContext = (MemoryContext) & TopGlobalMemoryData;
@@ -145,7 +145,7 @@ MemoryContext TopMemoryContext = (MemoryContext) & TopGlobalMemoryData;
void
EnableMemoryContext(bool on)
{
- static bool processing = false;
+ static bool processing = false;
AssertState(!processing);
AssertArg(BoolIsValid(on));
@@ -175,7 +175,7 @@ EnableMemoryContext(bool on)
}
else
{ /* cleanup */
- GlobalMemory context;
+ GlobalMemory context;
/* walk the list of allocations */
while (PointerIsValid(context = (GlobalMemory)
@@ -293,7 +293,7 @@ MemoryContextRealloc(MemoryContext context,
* BadArgumentsErr if firstTime is true for subsequent calls.
*/
#ifdef NOT_USED
-char *
+char *
MemoryContextGetName(MemoryContext context)
{
AssertState(MemoryContextEnabled);
@@ -341,7 +341,7 @@ PointerGetAllocSize(Pointer pointer)
MemoryContext
MemoryContextSwitchTo(MemoryContext context)
{
- MemoryContext old;
+ MemoryContext old;
AssertState(MemoryContextEnabled);
AssertArg(MemoryContextIsValid(context));
@@ -369,8 +369,8 @@ MemoryContextSwitchTo(MemoryContext context)
GlobalMemory
CreateGlobalMemory(char *name) /* XXX MemoryContextName */
{
- GlobalMemory context;
- MemoryContext savecxt;
+ GlobalMemory context;
+ MemoryContext savecxt;
AssertState(MemoryContextEnabled);
@@ -423,7 +423,7 @@ GlobalMemoryDestroy(GlobalMemory context)
* Exceptions:
* ExhaustedMemory if allocation fails.
*/
-static Pointer
+static Pointer
GlobalMemoryAlloc(GlobalMemory this, Size size)
{
return (AllocSetAlloc(&this->setData, size));
@@ -456,7 +456,7 @@ GlobalMemoryFree(GlobalMemory this,
* BadArgumentsErr if pointer is invalid.
* NoMoreMemoryErr if allocation fails.
*/
-static Pointer
+static Pointer
GlobalMemoryRealloc(GlobalMemory this,
Pointer pointer,
Size size)
@@ -471,7 +471,7 @@ GlobalMemoryRealloc(GlobalMemory this,
* Exceptions:
* ???
*/
-static char *
+static char *
GlobalMemoryGetName(GlobalMemory this)
{
return (this->name);
@@ -487,7 +487,7 @@ GlobalMemoryGetName(GlobalMemory this)
static void
GlobalMemoryDump(GlobalMemory this)
{
- GlobalMemory context;
+ GlobalMemory context;
printf("--\n%s:\n", GlobalMemoryGetName(this));
@@ -517,7 +517,7 @@ GlobalMemoryDump(GlobalMemory this)
static void
DumpGlobalMemories()
{
- GlobalMemory context;
+ GlobalMemory context;
context = (GlobalMemory) OrderedSetGetHead(&ActiveGlobalMemorySetData);
diff --git a/src/backend/utils/mmgr/oset.c b/src/backend/utils/mmgr/oset.c
index 758b701ff55..7def05f5656 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.4 1997/09/07 04:54:11 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/Attic/oset.c,v 1.5 1997/09/08 02:32:14 momjian Exp $
*
* NOTE
* XXX This is a preliminary implementation which lacks fail-fast
@@ -19,15 +19,15 @@
#include "utils/memutils.h" /* where declarations of this file goes */
-static Pointer OrderedElemGetBase(OrderedElem elem);
-static void OrderedElemPush(OrderedElem elem);
-static void OrderedElemPushHead(OrderedElem elem);
+static Pointer OrderedElemGetBase(OrderedElem elem);
+static void OrderedElemPush(OrderedElem elem);
+static void OrderedElemPushHead(OrderedElem elem);
/*
* OrderedElemGetBase --
* Returns base of enclosing structure.
*/
-static Pointer
+static Pointer
OrderedElemGetBase(OrderedElem elem)
{
if (elem == (OrderedElem) NULL)
diff --git a/src/backend/utils/mmgr/palloc.c b/src/backend/utils/mmgr/palloc.c
index f644706c911..bd680464b93 100644
--- a/src/backend/utils/mmgr/palloc.c
+++ b/src/backend/utils/mmgr/palloc.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/Attic/palloc.c,v 1.4 1997/09/07 04:54:12 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/Attic/palloc.c,v 1.5 1997/09/08 02:32:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -60,7 +60,7 @@
* NonallocatedPointer if pointer was not returned by palloc or repalloc
* or may have been subsequently freed.
*/
-void *
+void *
palloc(Size size)
{
#ifdef PALLOC_IS_MALLOC
@@ -94,7 +94,7 @@ pfree(void *pointer)
* NonallocatedPointer if pointer was not returned by palloc or repalloc
* or may have been freed already.
*/
-void *
+void *
repalloc(void *pointer, Size size)
{
#ifdef PALLOC_IS_MALLOC
@@ -107,10 +107,10 @@ repalloc(void *pointer, Size size)
/* pstrdup
allocates space for and copies a string
just like strdup except it uses palloc instead of malloc */
-char *
+char *
pstrdup(char *string)
{
- char *nstr;
+ char *nstr;
nstr = (char *) palloc(strlen(string) + 1);
strcpy(nstr, string);
diff --git a/src/backend/utils/mmgr/portalmem.c b/src/backend/utils/mmgr/portalmem.c
index 595153b0ce6..0cdd54d35bc 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.6 1997/09/07 04:54:13 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/portalmem.c,v 1.7 1997/09/08 02:32:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -91,11 +91,11 @@
#include "utils/portal.h"
-static void CollectNamedPortals(Portal * portalP, int destroy);
-static Portal PortalHeapMemoryGetPortal(PortalHeapMemory context);
+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);
+static void PortalResetHeapMemory(Portal portal);
+static Portal PortalVariableMemoryGetPortal(PortalVariableMemory context);
/* ----------------
* ALLOCFREE_ERROR_ABORT
@@ -110,19 +110,19 @@ static Portal PortalVariableMemoryGetPortal(PortalVariableMemory context);
* ----------------
*/
-static int PortalManagerEnableCount = 0;
+static int PortalManagerEnableCount = 0;
#define MAX_PORTALNAME_LEN 64 /* XXX LONGALIGNable value */
typedef struct portalhashent
{
- char portalname[MAX_PORTALNAME_LEN];
- Portal portal;
-} PortalHashEnt;
+ char portalname[MAX_PORTALNAME_LEN];
+ Portal portal;
+} PortalHashEnt;
#define PortalManagerEnabled (PortalManagerEnableCount >= 1)
-static HTAB *PortalHashTable = NULL;
+static HTAB *PortalHashTable = NULL;
#define PortalHashTableLookup(NAME, PORTAL) \
{ PortalHashEnt *hentry; bool found; char key[MAX_PORTALNAME_LEN]; \
@@ -162,9 +162,9 @@ static HTAB *PortalHashTable = NULL;
}
static GlobalMemory PortalMemory = NULL;
-static char PortalMemoryName[] = "Portal";
+static char PortalMemoryName[] = "Portal";
-static Portal BlankPortal = NULL;
+static Portal BlankPortal = NULL;
/* ----------------
* Internal class definitions
@@ -172,9 +172,9 @@ static Portal BlankPortal = NULL;
*/
typedef struct HeapMemoryBlockData
{
- AllocSetData setData;
- FixedItemData itemData;
-} HeapMemoryBlockData;
+ AllocSetData setData;
+ FixedItemData itemData;
+} HeapMemoryBlockData;
typedef HeapMemoryBlockData *HeapMemoryBlock;
@@ -189,7 +189,7 @@ typedef HeapMemoryBlockData *HeapMemoryBlock;
* PortalVariableMemoryAlloc
* ----------------
*/
-static Pointer
+static Pointer
PortalVariableMemoryAlloc(PortalVariableMemory this,
Size size)
{
@@ -211,7 +211,7 @@ PortalVariableMemoryFree(PortalVariableMemory this,
* PortalVariableMemoryRealloc
* ----------------
*/
-static Pointer
+static Pointer
PortalVariableMemoryRealloc(PortalVariableMemory this,
Pointer pointer,
Size size)
@@ -223,7 +223,7 @@ PortalVariableMemoryRealloc(PortalVariableMemory this,
* PortalVariableMemoryGetName
* ----------------
*/
-static char *
+static char *
PortalVariableMemoryGetName(PortalVariableMemory this)
{
return (form("%s-var", PortalVariableMemoryGetPortal(this)->name));
@@ -245,7 +245,7 @@ PortalVariableMemoryDump(PortalVariableMemory this)
* PortalHeapMemoryAlloc
* ----------------
*/
-static Pointer
+static Pointer
PortalHeapMemoryAlloc(PortalHeapMemory this,
Size size)
{
@@ -285,7 +285,7 @@ PortalHeapMemoryFree(PortalHeapMemory this,
* PortalHeapMemoryRealloc
* ----------------
*/
-static Pointer
+static Pointer
PortalHeapMemoryRealloc(PortalHeapMemory this,
Pointer pointer,
Size size)
@@ -301,7 +301,7 @@ PortalHeapMemoryRealloc(PortalHeapMemory this,
* PortalHeapMemoryGetName
* ----------------
*/
-static char *
+static char *
PortalHeapMemoryGetName(PortalHeapMemory this)
{
return (form("%s-heap", PortalHeapMemoryGetPortal(this)->name));
@@ -366,7 +366,7 @@ static struct MemoryContextMethodsData PortalHeapContextMethodsData = {
static void
CreateNewBlankPortal()
{
- Portal portal;
+ Portal portal;
AssertState(!PortalIsValid(BlankPortal));
@@ -428,16 +428,16 @@ PortalNameIsSpecial(char *pname)
static void
CollectNamedPortals(Portal * portalP, int destroy)
{
- static Portal *portalList = (Portal *) NULL;
- static int listIndex = 0;
- static int maxIndex = 9;
+ static Portal *portalList = (Portal *) NULL;
+ static int listIndex = 0;
+ static int maxIndex = 9;
if (portalList == (Portal *) NULL)
portalList = (Portal *) malloc(10 * sizeof(Portal));
if (destroy != 0)
{
- int i;
+ int i;
for (i = 0; i < listIndex; i++)
PortalDestroy(&portalList[i]);
@@ -515,8 +515,8 @@ DumpPortals()
void
EnablePortalManager(bool on)
{
- static bool processing = false;
- HASHCTL ctl;
+ static bool processing = false;
+ HASHCTL ctl;
AssertState(!processing);
AssertArg(BoolIsValid(on));
@@ -581,7 +581,7 @@ EnablePortalManager(bool on)
Portal
GetPortalByName(char *name)
{
- Portal portal;
+ Portal portal;
AssertState(PortalManagerEnabled);
@@ -615,8 +615,8 @@ GetPortalByName(char *name)
Portal
BlankPortalAssignName(char *name) /* XXX PortalName */
{
- Portal portal;
- uint16 length;
+ Portal portal;
+ uint16 length;
AssertState(PortalManagerEnabled);
AssertState(PortalIsValid(BlankPortal));
@@ -687,7 +687,7 @@ PortalSetQuery(Portal portal,
* BadState if called when disabled.
* BadArg if portal is invalid.
*/
-QueryDesc *
+QueryDesc *
PortalGetQueryDesc(Portal portal)
{
AssertState(PortalManagerEnabled);
@@ -704,7 +704,7 @@ PortalGetQueryDesc(Portal portal)
* BadState if called when disabled.
* BadArg if portal is invalid.
*/
-EState *
+EState *
PortalGetState(Portal portal)
{
AssertState(PortalManagerEnabled);
@@ -729,8 +729,8 @@ PortalGetState(Portal portal)
Portal
CreatePortal(char *name) /* XXX PortalName */
{
- Portal portal;
- uint16 length;
+ Portal portal;
+ uint16 length;
AssertState(PortalManagerEnabled);
AssertArg(PointerIsValid(name)); /* XXX PortalName */
@@ -788,7 +788,7 @@ CreatePortal(char *name) /* XXX PortalName */
void
PortalDestroy(Portal * portalP)
{
- Portal portal = *portalP;
+ Portal portal = *portalP;
AssertState(PortalManagerEnabled);
AssertArg(PortalIsValid(portal));
@@ -828,7 +828,7 @@ static void
PortalResetHeapMemory(Portal portal)
{
PortalHeapMemory context;
- MemoryContext currentContext;
+ MemoryContext currentContext;
context = PortalGetHeapMemory(portal);
@@ -955,7 +955,7 @@ PortalGetHeapMemory(Portal portal)
* BadState if called when disabled.
* BadArg if context is invalid.
*/
-static Portal
+static Portal
PortalVariableMemoryGetPortal(PortalVariableMemory context)
{
return ((Portal) ((char *) context - offsetof(PortalD, variable)));
@@ -969,7 +969,7 @@ PortalVariableMemoryGetPortal(PortalVariableMemory context)
* BadState if called when disabled.
* BadArg if context is invalid.
*/
-static Portal
+static Portal
PortalHeapMemoryGetPortal(PortalHeapMemory context)
{
return ((Portal) ((char *) context - offsetof(PortalD, heap)));
@@ -1002,7 +1002,7 @@ PortalVariableMemoryGetHeapMemory(PortalVariableMemory context)
* BadState if called when disabled.
* BadArg if context is invalid.
*/
-static PortalVariableMemory
+static PortalVariableMemory
PortalHeapMemoryGetVariableMemory(PortalHeapMemory context)
{
return ((PortalVariableMemory) ((char *) context
diff --git a/src/backend/utils/sort/lselect.c b/src/backend/utils/sort/lselect.c
index bc6948292b3..e4dab6583aa 100644
--- a/src/backend/utils/sort/lselect.c
+++ b/src/backend/utils/sort/lselect.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/lselect.c,v 1.6 1997/09/07 04:54:16 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/lselect.c,v 1.7 1997/09/08 02:32:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -47,9 +47,9 @@ struct leftist *
lmerge(struct leftist * pt, struct leftist * qt, LeftistContext context)
{
register struct leftist *root,
- *majorLeftist,
- *minorLeftist;
- int dist;
+ *majorLeftist,
+ *minorLeftist;
+ int dist;
if (tuplecmp(pt->lt_tuple, qt->lt_tuple, context))
{
@@ -86,7 +86,7 @@ static struct leftist *
linsert(struct leftist * root, struct leftist * new1, LeftistContext context)
{
register struct leftist *left,
- *right;
+ *right;
if (!tuplecmp(root->lt_tuple, new1->lt_tuple, context))
{
@@ -139,7 +139,7 @@ gettuple(struct leftist ** treep,
LeftistContext context)
{
register struct leftist *tp;
- HeapTuple tup;
+ HeapTuple tup;
tp = *treep;
tup = tp->lt_tuple;
@@ -197,11 +197,11 @@ puttuple(struct leftist ** treep,
int
tuplecmp(HeapTuple ltup, HeapTuple rtup, LeftistContext context)
{
- register char *lattr,
- *rattr;
- int nkey = 0;
- int result = 0;
- bool isnull;
+ register char *lattr,
+ *rattr;
+ int nkey = 0;
+ int result = 0;
+ bool isnull;
if (ltup == (HeapTuple) NULL)
return (0);
@@ -240,8 +240,8 @@ tuplecmp(HeapTuple ltup, HeapTuple rtup, LeftistContext context)
void
checktree(struct leftist * tree, LeftistContext context)
{
- int lnodes;
- int rnodes;
+ int lnodes;
+ int rnodes;
if (tree == NULL)
{
@@ -292,9 +292,9 @@ checktree(struct leftist * tree, LeftistContext context)
int
checktreer(struct leftist * tree, int level, LeftistContext context)
{
- int lnodes,
- rnodes;
- int error = 0;
+ int lnodes,
+ rnodes;
+ int error = 0;
if (tree == NULL)
return (0);
diff --git a/src/backend/utils/sort/psort.c b/src/backend/utils/sort/psort.c
index 00cbfbacba5..a84dabd1c76 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.19 1997/09/07 04:54:17 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.20 1997/09/08 02:32:29 momjian Exp $
*
* NOTES
* Sorts the first relation into the second relation.
@@ -64,21 +64,21 @@
#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 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 */
+static long shortzero = 0; /* used to delimit runs */
/*
* old psort global variables
@@ -125,7 +125,7 @@ static long shortzero = 0; /* used to delimit runs */
bool
psort_begin(Sort * node, int nkeys, ScanKey key)
{
- bool empty; /* to answer: is child node empty? */
+ bool empty; /* to answer: is child node empty? */
node->psortstate = (struct Psortstate *) palloc(sizeof(struct Psortstate));
if (node->psortstate == NULL)
@@ -172,7 +172,7 @@ psort_begin(Sort * node, int nkeys, ScanKey key)
static void
inittapes(Sort * node)
{
- register int i;
+ register int i;
register struct tape *tp;
Assert(node != (Sort *) NULL);
@@ -272,8 +272,8 @@ initialrun(Sort * node, bool * empty)
{
/* register struct tuple *tup; */
register struct tape *tp;
- int baseruns; /* D:(a) */
- int extrapasses;/* EOF */
+ int baseruns; /* D:(a) */
+ int extrapasses; /* EOF */
Assert(node != (Sort *) NULL);
Assert(PS(node) != (Psortstate *) NULL);
@@ -349,17 +349,16 @@ initialrun(Sort * node, bool * empty)
* FALSE iff process through end of relation
* Tuples contains the tuples for the following run upon exit
*/
-static bool
+static bool
createrun(Sort * node, FILE * file, bool * empty)
{
register HeapTuple lasttuple;
register HeapTuple tup;
struct leftist *nextrun;
- bool foundeor;
- short junk;
+ bool foundeor;
+ short junk;
- int cr_tuples = 0; /* Count tuples grabbed from
- * plannode */
+ int cr_tuples = 0; /* Count tuples grabbed from plannode */
TupleTableSlot *cr_slot;
Assert(node != (Sort *) NULL);
@@ -447,10 +446,10 @@ 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).
*/
-static HeapTuple
+static HeapTuple
tuplecopy(HeapTuple tup)
{
- HeapTuple rettup;
+ HeapTuple rettup;
if (!HeapTupleIsValid(tup))
{
@@ -468,7 +467,7 @@ tuplecopy(HeapTuple tup)
* Returns:
* file of tuples in order
*/
-static FILE *
+static FILE *
mergeruns(Sort * node)
{
register struct tape *tp;
@@ -502,11 +501,11 @@ merge(Sort * node, struct tape * dest)
register struct tape *lasttp; /* (TAPE[P]) */
register struct tape *tp;
struct leftist *tuples;
- FILE *destfile;
- int times; /* runs left to merge */
- int outdummy; /* complete dummy runs */
- short fromtape;
- long tuplen;
+ FILE *destfile;
+ int times; /* runs left to merge */
+ int outdummy; /* complete dummy runs */
+ short fromtape;
+ long tuplen;
Assert(node != (Sort *) NULL);
Assert(PS(node) != (Psortstate *) NULL);
@@ -608,9 +607,9 @@ dumptuples(FILE * file, Sort * node)
register struct leftist *tp;
register struct leftist *newp;
struct leftist **treep = &PS(node)->Tuples;
- LeftistContext context = &PS(node)->treeContext;
- HeapTuple tup;
- int memtupindex = 0;
+ LeftistContext context = &PS(node)->treeContext;
+ HeapTuple tup;
+ int memtupindex = 0;
if (!PS(node)->using_tape_files && PS(node)->tupcount)
{
@@ -652,7 +651,7 @@ HeapTuple
psort_grabtuple(Sort * node)
{
register HeapTuple tup;
- long tuplen;
+ long tuplen;
Assert(node != (Sort *) NULL);
Assert(PS(node) != (Psortstate *) NULL);
@@ -763,8 +762,8 @@ psort_end(Sort * node)
struct tapelst
{
- char *tl_name;
- int tl_fd;
+ char *tl_name;
+ int tl_fd;
struct tapelst *tl_next;
};
@@ -777,16 +776,16 @@ static struct tapelst *Tapes = NULL;
* Open stream for writing/reading.
* NULL if unable to open temporary file.
*/
-static FILE *
+static FILE *
gettape()
{
register struct tapelst *tp;
- FILE *file;
- static int tapeinit = 0;
- char *mktemp();
+ FILE *file;
+ static int tapeinit = 0;
+ char *mktemp();
static unsigned int uniqueFileId = 0;
- extern int errno;
- char uniqueName[MAXPGPATH];
+ extern int errno;
+ char uniqueName[MAXPGPATH];
tp = (struct tapelst *) palloc((unsigned) sizeof(struct tapelst));
@@ -823,7 +822,7 @@ static void
resettape(FILE * file)
{
register struct tapelst *tp;
- register int fd;
+ register int fd;
Assert(PointerIsValid(file));
@@ -855,8 +854,8 @@ static void
destroytape(FILE * file)
{
register struct tapelst *tp,
- *tq;
- register int fd;
+ *tq;
+ register int fd;
if ((tp = Tapes) == NULL)
elog(FATAL, "destroytape: tape not found");
diff --git a/src/backend/utils/time/tqual.c b/src/backend/utils/time/tqual.c
index 2a85ecd712b..e291e9c3441 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.5 1997/09/07 04:54:20 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.6 1997/09/08 02:32:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -29,18 +29,18 @@
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);
+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.
*/
-typedef uint16 TimeQualMode;
+typedef uint16 TimeQualMode;
#define TimeQualAt 0x1
#define TimeQualNewer 0x2
@@ -55,17 +55,17 @@ typedef uint16 TimeQualMode;
typedef struct TimeQualData
{
- AbsoluteTime start;
- AbsoluteTime end;
- TimeQualMode mode;
-} TimeQualData;
+ AbsoluteTime start;
+ AbsoluteTime end;
+ TimeQualMode mode;
+} TimeQualData;
typedef TimeQualData *InternalTimeQual;
static TimeQualData SelfTimeQualData;
-TimeQual SelfTimeQual = (Pointer) & SelfTimeQualData;
+TimeQual SelfTimeQual = (Pointer) & SelfTimeQualData;
-extern bool PostgresIsInitialized;
+extern bool PostgresIsInitialized;
/*
* XXX Transaction system override hacks start here
@@ -115,8 +115,8 @@ heapisoverride()
* XXX Transaction system override hacks end here
*/
-static bool HeapTupleSatisfiesItself(HeapTuple tuple);
-static bool HeapTupleSatisfiesNow(HeapTuple tuple);
+static bool HeapTupleSatisfiesItself(HeapTuple tuple);
+static bool HeapTupleSatisfiesNow(HeapTuple tuple);
static bool
HeapTupleSatisfiesSnapshotInternalTimeQual(HeapTuple tuple,
InternalTimeQual qual);
@@ -133,10 +133,10 @@ HeapTupleSatisfiesUpperUnboundedInternalTimeQual(HeapTuple tuple,
* TimeQualIsValid --
* True iff time qualification is valid.
*/
-static bool
+static bool
TimeQualIsValid(TimeQual qual)
{
- bool hasStartTime;
+ bool hasStartTime;
if (!PointerIsValid(qual) || qual == SelfTimeQual)
{
@@ -189,7 +189,7 @@ TimeQualIsValid(TimeQual qual)
* Note:
* Assumes time qualification is valid.
*/
-static bool
+static bool
TimeQualIsLegal(TimeQual qual)
{
Assert(TimeQualIsValid(qual));
@@ -202,8 +202,8 @@ TimeQualIsLegal(TimeQual qual)
/* TimeQualAt */
if (((InternalTimeQual) qual)->mode & TimeQualAt)
{
- AbsoluteTime a,
- b;
+ AbsoluteTime a,
+ b;
a = ((InternalTimeQual) qual)->start;
b = GetCurrentTransactionStartTime();
@@ -217,8 +217,8 @@ TimeQualIsLegal(TimeQual qual)
/* TimeQualOlder or TimeQualRange */
if (((InternalTimeQual) qual)->mode & TimeQualOlder)
{
- AbsoluteTime a,
- b;
+ AbsoluteTime a,
+ b;
a = ((InternalTimeQual) qual)->end;
b = GetCurrentTransactionStartTime();
@@ -232,8 +232,8 @@ TimeQualIsLegal(TimeQual qual)
/* TimeQualNewer */
if (((InternalTimeQual) qual)->mode & TimeQualNewer)
{
- AbsoluteTime a,
- b;
+ AbsoluteTime a,
+ b;
a = ((InternalTimeQual) qual)->start;
b = GetCurrentTransactionStartTime();
@@ -255,7 +255,7 @@ TimeQualIsLegal(TimeQual qual)
* Note:
* Assumes time qualification is valid.
*/
-static bool
+static bool
TimeQualIncludesNow(TimeQual qual)
{
Assert(TimeQualIsValid(qual));
@@ -312,7 +312,7 @@ TimeQualIncludesPast(TimeQual qual)
* Note:
* Assumes time qualification is valid.
*/
-static bool
+static bool
TimeQualIsSnapshot(TimeQual qual)
{
Assert(TimeQualIsValid(qual));
@@ -332,7 +332,7 @@ TimeQualIsSnapshot(TimeQual qual)
* Note:
* Assumes time qualification is valid.
*/
-static bool
+static bool
TimeQualIsRanged(TimeQual qual)
{
Assert(TimeQualIsValid(qual));
@@ -353,7 +353,7 @@ TimeQualIsRanged(TimeQual qual)
* Note:
* XXX This should not be implemented since this does not make sense.
*/
-static bool
+static bool
TimeQualIndicatesDisableValidityChecking(TimeQual qual)
{
Assert(TimeQualIsValid(qual));
@@ -377,7 +377,7 @@ TimeQualIndicatesDisableValidityChecking(TimeQual qual)
* Note:
* Assumes time qual is valid snapshot time qual.
*/
-static AbsoluteTime
+static AbsoluteTime
TimeQualGetSnapshotTime(TimeQual qual)
{
Assert(TimeQualIsSnapshot(qual));
@@ -392,7 +392,7 @@ TimeQualGetSnapshotTime(TimeQual qual)
* Note:
* Assumes time qual is valid ranged time qual.
*/
-static AbsoluteTime
+static AbsoluteTime
TimeQualGetStartTime(TimeQual qual)
{
Assert(TimeQualIsRanged(qual));
@@ -407,7 +407,7 @@ TimeQualGetStartTime(TimeQual qual)
* Note:
* Assumes time qual is valid ranged time qual.
*/
-static AbsoluteTime
+static AbsoluteTime
TimeQualGetEndTime(TimeQual qual)
{
Assert(TimeQualIsRanged(qual));
@@ -550,7 +550,7 @@ HeapTupleSatisfiesTimeQual(HeapTuple tuple, TimeQual qual)
* (Xmax != my-transaction && the row was deleted by another transaction
* Xmax is not committed))) that has not been committed
*/
-static bool
+static bool
HeapTupleSatisfiesItself(HeapTuple tuple)
{
@@ -647,7 +647,7 @@ HeapTupleSatisfiesItself(HeapTuple tuple)
* the serializability guarantees we provide don't extend to xacts
* that do catalog accesses. this is unfortunate, but not critical.
*/
-static bool
+static bool
HeapTupleSatisfiesNow(HeapTuple tuple)
{
if (AMI_OVERRIDE)
@@ -755,7 +755,7 @@ HeapTupleSatisfiesNow(HeapTuple tuple)
* (Xmax is null || (Xmax is not committed && Xmax != my-transaction) ||
* Tmax >= T))
*/
-static bool
+static bool
HeapTupleSatisfiesSnapshotInternalTimeQual(HeapTuple tuple,
InternalTimeQual qual)
{
@@ -816,7 +816,7 @@ HeapTupleSatisfiesSnapshotInternalTimeQual(HeapTuple tuple,
* (Xmax is null || (Xmax is not committed && Xmax != my-transaction) ||
* T1 is null || Tmax >= T1))
*/
-static bool
+static bool
HeapTupleSatisfiesUpperBoundedInternalTimeQual(HeapTuple tuple,
InternalTimeQual qual)
{
@@ -886,7 +886,7 @@ HeapTupleSatisfiesUpperBoundedInternalTimeQual(HeapTuple tuple,
* (Xmax is not committed && Xmax != my-transaction) ||
* T1 is null || Tmax >= T1)))
*/
-static bool
+static bool
HeapTupleSatisfiesUpperUnboundedInternalTimeQual(HeapTuple tuple,
InternalTimeQual qual)
{