blob: c971e61192bf77ed030a9bce6a4104de8b246c5a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
/* $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);
}
|