1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-12 02:37:31 +03:00

This patch makes some of the memory manipulation performed by psql a

little more sane. Some parts of the code was using a static function
xmalloc() that did safe memory allocation (where "safe" means "bail
out on OOM"), but most of it was just invoking calloc() or malloc()
directly. Now almost everything invokes xmalloc() or xcalloc().
This commit is contained in:
Neil Conway
2004-01-24 19:38:49 +00:00
parent cb3dc829f6
commit 610d33c194
13 changed files with 124 additions and 237 deletions

View File

@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/common.h,v 1.32 2004/01/09 21:12:20 momjian Exp $
* $PostgreSQL: pgsql/src/bin/psql/common.h,v 1.33 2004/01/24 19:38:49 neilc Exp $
*/
#ifndef COMMON_H
#define COMMON_H
@@ -20,7 +20,15 @@
#define psql_assert(p)
#endif
/*
* Safer versions of some standard C library functions. If an
* out-of-memory condition occurs, these functions will bail out
* safely; therefore, their return value is guaranteed to be non-NULL.
*/
extern char *xstrdup(const char *string);
extern void *xmalloc(size_t size);
extern void *xmalloc_zero(size_t size);
extern void *xcalloc(size_t nmemb, size_t size);
extern bool setQFout(const char *fname);