1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +03:00

Another PGINDENT run that changes variable indenting and case label indenting. Also static variable indenting.

This commit is contained in:
Bruce Momjian
1997-09-08 02:41:22 +00:00
parent a90f12fd9d
commit 319dbfa736
632 changed files with 28301 additions and 28220 deletions

View File

@@ -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" */

File diff suppressed because it is too large Load Diff

View File

@@ -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);

View File

@@ -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';

View File

@@ -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 *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 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)

View File

@@ -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)
{

View File

@@ -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 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 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 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 i,
j,
n,
temp,
srcOff;
int chunk_st[MAXDIM];
int *C,
csize,
*dim,
*lb;
int PCHUNK[MAXDIM],
PC[MAXDIM];
int *C,
csize,
*dim,
*lb;
int PCHUNK[MAXDIM],
PC[MAXDIM];
CHUNK_INFO *A = (CHUNK_INFO *) ARR_DATA_PTR(array);
CHUNK_INFO *A = (CHUNK_INFO *) ARR_DATA_PTR(array);
n = ARR_NDIM(array);
lb = ARR_LBOUND(array);

View File

@@ -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",

View File

@@ -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);
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
*/
/*
* 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 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;
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;
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))
{

View File

@@ -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)
{

File diff suppressed because it is too large Load Diff

View File

@@ -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);

View File

@@ -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);

File diff suppressed because it is too large Load Diff

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;
}
}

View File

@@ -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;

View File

@@ -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);

View File

@@ -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';

View File

@@ -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++)
{

View File

@@ -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 */

View File

@@ -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));

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -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))

View File

@@ -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));
}

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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!

View File

@@ -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

View File

@@ -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);

View File

@@ -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;
case 'c': /* cached system catalog tuple */
InvalidationMessageRegisterSharedInvalid_DEBUG1;
RegisterSharedInvalid(message->any.catalog.cacheId,
message->any.catalog.hashIndex,
&message->any.catalog.pointerData);
break;
RegisterSharedInvalid(message->any.catalog.cacheId,
message->any.catalog.hashIndex,
&message->any.catalog.pointerData);
break;
case 'r': /* cached relation descriptor */
InvalidationMessageRegisterSharedInvalid_DEBUG2;
case 'r': /* cached relation descriptor */
InvalidationMessageRegisterSharedInvalid_DEBUG2;
RegisterSharedInvalid(message->any.relation.relationId,
message->any.relation.objectId,
(ItemPointer) NULL);
break;
RegisterSharedInvalid(message->any.relation.relationId,
message->any.relation.objectId,
(ItemPointer) NULL);
break;
default:
elog(FATAL,
"InvalidationMessageRegisterSharedInvalid: `%c' kind",
message->kind);
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

View File

@@ -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;

View File

@@ -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_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;
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;
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);

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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 */

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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--;
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;
/* 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);
/*
* 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);

View File

@@ -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 */
switch (keysize)
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++)
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);
}
}

View File

@@ -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;

View File

@@ -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,

View File

@@ -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 */

View File

@@ -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

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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)

View File

@@ -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);

View File

@@ -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

View File

@@ -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);

View File

@@ -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");

View File

@@ -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)
{