bool exists = false,
n,
inblock;
- int max_id = -1;
if (!(inblock = IsTransactionBlock()))
BeginTransactionBlock();
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.19 1997/12/04 00:26:50 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.20 1997/12/09 03:10:31 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
username, kusername);
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
- free(kusername);
+ pfree(kusername);
return (STATUS_ERROR);
}
- free(kusername);
+ pfree(kusername);
return (STATUS_OK);
}
#include <crypt.h>
#endif
-#include <postgres.h>
-#include <libpq/crypt.h>
-#include <utils/nabstime.h>
+#include "postgres.h"
+#include "libpq/crypt.h"
+#include "utils/nabstime.h"
+#include "utils/palloc.h"
+#include "storage/fd.h"
char* crypt_getpwdfilename() {
elog(FATAL, "crypt.c: PGDATA is not defined");
exit(-1);
}
- filename = (char*)malloc(strlen(env) + strlen(CRYPT_PWD_FILE) + 2);
+ filename = (char*)palloc(strlen(env) + strlen(CRYPT_PWD_FILE) + 2);
sprintf(filename, "%s/%s", env, CRYPT_PWD_FILE);
}
char* filename;
filename = crypt_getpwdfilename();
- return (fopen(filename, "r"));
+ return (AllocateFile(filename, "r"));
}
/*-------------------------------------------------------------------------*/
/* store a copy of user login to return
*/
count = strcspn(parse, "#");
- *login = (char*)malloc(count + 1);
+ *login = (char*)palloc(count + 1);
strncpy(*login, parse, count);
(*login)[count] = '\0';
parse += (count + 1);
/* store a copy of user password to return
*/
count = strcspn(parse, "#");
- *pwd = (char*)malloc(count + 1);
+ *pwd = (char*)palloc(count + 1);
strncpy(*pwd, parse, count);
(*pwd)[count] = '\0';
parse += (count + 1);
/* store a copy of date login becomes invalid
*/
count = strcspn(parse, "#");
- *valdate = (char*)malloc(count + 1);
+ *valdate = (char*)palloc(count + 1);
strncpy(*valdate, parse, count);
(*valdate)[count] = '\0';
parse += (count + 1);
while (!feof(datafile)) {
crypt_parsepwdfile(datafile, &login, &pwd, &valdate);
if (!strcmp(login, user)) {
- free((void*)login);
+ pfree((void*)login);
*passwd = pwd;
*valuntil = valdate;
fclose(datafile);
return;
}
- free((void*)login);
- free((void*)pwd);
- free((void*)valdate);
+ pfree((void*)login);
+ pfree((void*)pwd);
+ pfree((void*)valdate);
}
fclose(datafile);
}
crypt_getloginfo(user, &passwd, &valuntil);
if (passwd == NULL || *passwd == '\0') {
- if (passwd) free((void*)passwd);
- if (valuntil) free((void*)valuntil);
+ if (passwd) pfree((void*)passwd);
+ if (valuntil) pfree((void*)valuntil);
return STARTUP_UNSALT_MSG;
}
- free((void*)passwd);
- if (valuntil) free((void*)valuntil);
+ pfree((void*)passwd);
+ if (valuntil) pfree((void*)valuntil);
return STARTUP_SALT_MSG;
}
crypt_getloginfo(user, &passwd, &valuntil);
if (passwd == NULL || *passwd == '\0') {
- if (passwd) free((void*)passwd);
- if (valuntil) free((void*)valuntil);
+ if (passwd) pfree((void*)passwd);
+ if (valuntil) pfree((void*)valuntil);
return STATUS_ERROR;
}
retval = STATUS_OK;
}
- free((void*)passwd);
- if (valuntil) free((void*)valuntil);
+ pfree((void*)passwd);
+ if (valuntil) pfree((void*)valuntil);
return retval;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.24 1997/11/10 05:15:52 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.25 1997/12/09 03:10:38 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
/* put together the full pathname to the old config file */
- old_conf_file = (char *) malloc((strlen(DataDir) +
+ old_conf_file = (char *) palloc((strlen(DataDir) +
strlen(OLD_CONF_FILE) + 2) * sizeof(char));
sprintf(old_conf_file, "%s/%s", DataDir, OLD_CONF_FILE);
* read */
/* put together the full pathname to the config file */
- conf_file = (char *) malloc((strlen(DataDir) +
+ conf_file = (char *) palloc((strlen(DataDir) +
strlen(CONF_FILE) + 2) * sizeof(char));
sprintf(conf_file, "%s/%s", DataDir, CONF_FILE);
usermap_name, find_password_entries);
FreeFile(file);
}
- free(conf_file);
+ pfree(conf_file);
}
- free(old_conf_file);
+ pfree(old_conf_file);
return;
}
* read */
/* put together the full pathname to the map file */
- map_file = (char *) malloc((strlen(DataDir) +
+ map_file = (char *) palloc((strlen(DataDir) +
strlen(MAP_FILE) + 2) * sizeof(char));
sprintf(map_file, "%s/%s", DataDir, MAP_FILE);
checks_out_p);
FreeFile(file);
}
- free(map_file);
+ pfree(map_file);
}
return STATUS_ERROR;
}
- pw_file_fullname = (char *) malloc(strlen(DataDir) + strlen(pw_file_name) + 2);
+ pw_file_fullname = (char *) palloc(strlen(DataDir) + strlen(pw_file_name) + 2);
strcpy(pw_file_fullname, DataDir);
strcat(pw_file_fullname, "/");
strcat(pw_file_fullname, pw_file_name);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portal.c,v 1.11 1997/11/10 05:15:54 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portal.c,v 1.12 1997/12/09 03:10:43 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
if (tbp)
{
len = tbp->lengths[tuple_offset][field_number];
- result = malloc(len + 1);
+ result = palloc(len + 1);
memcpy(result,
tbp->values[tuple_offset][field_number],
len);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portalbuf.c,v 1.8 1997/10/25 01:09:23 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portalbuf.c,v 1.9 1997/12/09 03:10:45 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
PortalEntry **portals = (PortalEntry **) NULL;
size_t portals_array_size = 0;
-/* portals array memory is malloc'd instead of using MemoryContexts */
+/* portals array memory is palloc'd instead of using MemoryContexts */
/* since it will be used by both front and backend programs*/
/* GlobalMemory portals_mmcxt = (GlobalMemory) NULL; */
newp = (PortalEntry **) realloc(portals,
portals_array_size * sizeof(PortalEntry *));
else
- newp = (PortalEntry **) malloc(portals_array_size * sizeof(PortalEntry *));
+ newp = (PortalEntry **) palloc(portals_array_size * sizeof(PortalEntry *));
if (newp)
portals = newp;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/pqpacket.c,v 1.11 1997/11/17 16:18:07 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/pqpacket.c,v 1.12 1997/12/09 03:10:51 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
PacketBuf* res;
char* tmp;
- res = (PacketBuf*)malloc(sizeof(PacketBuf));
+ res = (PacketBuf*)palloc(sizeof(PacketBuf));
res->len = htonl(sizeof(PacketBuf));
res->data[0] = '\0';
StartupInfo* res;
char* tmp;
- res = (StartupInfo*)malloc(sizeof(StartupInfo));
+ res = (StartupInfo*)palloc(sizeof(StartupInfo));
res->database[0]='\0';
res->user[0]='\0';
/* A lexical scanner generated by flex */
/* Scanner skeleton version:
- * $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.4 1997/11/30 23:05:39 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.5 1997/12/09 03:11:00 scrappy Exp $
*/
#define FLEX_SCANNER
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.4 1997/11/30 23:05:39 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.5 1997/12/09 03:11:00 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
int i;
ScanKeyword *keyword;
- for(i = strlen(yytext); i >= 0; i--)
+ for(i = 0; yytext[i]; i++)
if (isupper(yytext[i]))
yytext[i] = tolower(yytext[i]);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.64 1997/12/07 20:57:45 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.65 1997/12/09 03:11:08 scrappy Exp $
*
* NOTES
*
#include "storage/proc.h"
#include "utils/elog.h"
#include "port-protos.h" /* For gethostname() */
+#include "storage/fd.h"
#if defined(DBX_VERSION)
#define FORK() (0)
sprintf(path, "%s%cbase%ctemplate1%cpg_class",
DataDir, SEP_CHAR, SEP_CHAR, SEP_CHAR);
- fp = fopen(path, "r");
+ fp = AllocateFile(path, "r");
if (fp == NULL)
{
fprintf(stderr, "%s does not find the database system. "
/* reason ValidatePgVersion failed. NULL if didn't */
- fclose(fp);
+ FreeFile(fp);
ValidatePgVersion(DataDir, &reason);
if (reason)
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/initlocation/Attic/initlocation,v 1.1 1997/11/07 06:21:38 thomas Exp $
+# $Header: /cvsroot/pgsql/src/bin/initlocation/Attic/initlocation,v 1.2 1997/12/09 03:11:16 scrappy Exp $
#
#-------------------------------------------------------------------------
shift
done
-if [ ! -z "$badparm" ]; then
+if [ -n "$badparm" ]; then
echo "$CMDNAME: Unrecognized parameter '$badparm'"
fi
-if [ ! -z "$usage" ]; then
+if [ -n "$usage" ]; then
echo "Usage: $CMDNAME [-u SUPERUSER] DATADIR"
exit 1
fi
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_user.h,v 1.6 1997/12/04 00:27:54 scrappy Exp $
+ * $Id: pg_user.h,v 1.7 1997/12/09 03:11:25 scrappy Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
* initial contents of pg_user
* ----------------
*/
-DATA(insert OID = 0 ( postgres PGUID t t t t postgres 2116994400 ));
+DATA(insert OID = 0 ( postgres PGUID t t t t "" 2116994400 ));
BKI_BEGIN
#ifdef ALLOW_PG_GROUP