diff options
author | Michael Meskes <meskes@postgresql.org> | 2000-02-23 19:26:05 +0000 |
---|---|---|
committer | Michael Meskes <meskes@postgresql.org> | 2000-02-23 19:26:05 +0000 |
commit | 9f74608f4756aa9735ebceee2f29b6ddc830cccc (patch) | |
tree | 28152b925d5bb4f6b44d2f80906a33a8af4f5598 /src/interfaces/ecpg/lib/memory.c | |
parent | c969e2662fd7cdb5521c1570082c6b55b5ce6e89 (diff) | |
download | postgresql-9f74608f4756aa9735ebceee2f29b6ddc830cccc.tar.gz postgresql-9f74608f4756aa9735ebceee2f29b6ddc830cccc.zip |
*** empty log message ***
Diffstat (limited to 'src/interfaces/ecpg/lib/memory.c')
-rw-r--r-- | src/interfaces/ecpg/lib/memory.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/interfaces/ecpg/lib/memory.c b/src/interfaces/ecpg/lib/memory.c new file mode 100644 index 00000000000..61c5d299f37 --- /dev/null +++ b/src/interfaces/ecpg/lib/memory.c @@ -0,0 +1,33 @@ +#include <ecpgtype.h> +#include <ecpglib.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); +} |