mirror of
https://github.com/postgres/postgres.git
synced 2026-02-27 11:50:33 -05:00
- Synced pgc.l with scan.l. - Synced keyword.c. - Include the remaining patches by Christof Petig <christof.petig@wtal.de>.
39 lines
676 B
C
39 lines
676 B
C
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/memory.c,v 1.5 2001/09/19 14:09:32 meskes Exp $ */
|
|
|
|
#include "postgres_fe.h"
|
|
|
|
#include "ecpgtype.h"
|
|
#include "ecpglib.h"
|
|
#include "ecpgerrno.h"
|
|
#include "extern.h"
|
|
|
|
char *
|
|
ecpg_alloc(long size, int lineno)
|
|
{
|
|
char *new = (char *) calloc(1L, size);
|
|
|
|
if (!new)
|
|
{
|
|
ECPGlog("out of memory\n");
|
|
ECPGraise(lineno, ECPG_OUT_OF_MEMORY, NULL);
|
|
return NULL;
|
|
}
|
|
|
|
memset(new, '\0', size);
|
|
return (new);
|
|
}
|
|
|
|
char *
|
|
ecpg_strdup(const char *string, int lineno)
|
|
{
|
|
char *new = strdup(string);
|
|
|
|
if (!new)
|
|
{
|
|
ECPGlog("out of memory\n");
|
|
ECPGraise(lineno, ECPG_OUT_OF_MEMORY, NULL);
|
|
return NULL;
|
|
}
|
|
|
|
return (new);
|
|
}
|