diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-10-14 15:28:51 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-10-14 17:54:41 +0300 |
commit | f035194d7d1b6cc0846ad7a5d86e0d6fa9463c67 (patch) | |
tree | 494d180cee9a078727c8d4965caa65cb2052f33d /src/binlogcat.c | |
parent | 58f7dbc0658b3d73816a1bc91b75c2bdac733510 (diff) | |
download | vmod-binlog-f035194d7d1b6cc0846ad7a5d86e0d6fa9463c67.tar.gz vmod-binlog-f035194d7d1b6cc0846ad7a5d86e0d6fa9463c67.tar.bz2 |
New utility binlogsel
* configure.ac: Check for yacc.
* src/.gitignore: Update.
* src/Makefile.am (libbinlog_a_SOURCES): Add new files.
Build binlogsel.
* src/binlogcat.c: Use xmalloc.
* src/binlogsel.c: New file.
* src/parse-datetime.h: New file.
* src/parse-datetime.y: New file.
* src/xalloc.c: New file.
* src/xalloc.h: New file.
Diffstat (limited to 'src/binlogcat.c')
-rw-r--r-- | src/binlogcat.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/binlogcat.c b/src/binlogcat.c index 505bbc2..656d8f2 100644 --- a/src/binlogcat.c +++ b/src/binlogcat.c @@ -29,2 +29,3 @@ #include "err.h" +#include "xalloc.h" @@ -77,7 +78,3 @@ catlog(const char *fname) size = header.hdrsize - sizeof(header); - dataspec = malloc(size); - if (!dataspec) { - error("not enough memory"); - abort(); - } + dataspec = xmalloc(size); @@ -96,3 +93,3 @@ catlog(const char *fname) if (errno == EINVAL) { - error("%s: bad dataspec near %s", dataspec, p); + error("%s: %s: bad dataspec near %s", fname, dataspec, p); exit(1); @@ -105,7 +102,3 @@ catlog(const char *fname) - rec = malloc(header.recsize); - if (!rec) { - error("not enough memory"); - exit(1); - } + rec = xmalloc(header.recsize); env = packenv_create(header.recsize - @@ -149,3 +142,3 @@ help() { - printf("usage: %s [-dhnv] [t FORMAT] [FILE...]\n", progname); + printf("usage: %s [-dhnv] [-t FORMAT] [FILE...]\n", progname); } |