aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2013-10-15 21:12:32 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2013-10-15 21:12:32 +0300
commit340802898d02bad367efc8f8ba1517d42fe4baad (patch)
tree8e3300600ddf02fd9d19d8c11a45b5eb87ba9717 /src
parent2afd00cc2bdbaa401edc7117965b3db658576719 (diff)
downloadvmod-binlog-340802898d02bad367efc8f8ba1517d42fe4baad.tar.gz
vmod-binlog-340802898d02bad367efc8f8ba1517d42fe4baad.tar.bz2
Minor change
Use 'format' instead of 'dataspec'
Diffstat (limited to 'src')
-rw-r--r--src/binlog.c22
-rw-r--r--src/binlogcat.c14
-rw-r--r--src/binlogsel.c12
-rw-r--r--src/vmod-binlog.h2
4 files changed, 25 insertions, 25 deletions
diff --git a/src/binlog.c b/src/binlog.c
index ea1aa65..57e2aa0 100644
--- a/src/binlog.c
+++ b/src/binlog.c
@@ -64,8 +64,8 @@ struct binlog_config {
int debug; /* debug level */
int flags; /* flags (see BLF_* defines above) */
- char *dataspec; /* data format specification */
- struct packinst *inst_head; /* compiled dataspec */
+ char *format; /* data format specification */
+ struct packinst *inst_head; /* compiled format */
struct packinst *inst_cur; /* current instruction */
struct packenv *env; /* pack environment */
enum binlog_state state; /* binlog machine state */
@@ -209,7 +209,7 @@ getindexpat(const char *name)
void
vmod_init(struct sess *sp, struct vmod_priv *priv,
- const char *dir, const char *dataspec, const char *param)
+ const char *dir, const char *format, const char *param)
{
struct binlog_config *conf = priv->priv;
struct stat st;
@@ -244,7 +244,7 @@ vmod_init(struct sess *sp, struct vmod_priv *priv,
conf->dir = strdup(dir);
AN(conf->dir);
- conf->inst_head = packcomp(dataspec, &p);
+ conf->inst_head = packcomp(format, &p);
if (!conf->inst_head) {
if (errno == EINVAL)
binlog_error("cannot compile data format near %s", p);
@@ -256,8 +256,8 @@ vmod_init(struct sess *sp, struct vmod_priv *priv,
conf->env = packenv_create(conf->recsize);
AN(conf->env);
conf->recsize += offsetof(struct binlog_record,data);
- conf->dataspec = strdup(dataspec);
- AN(conf->dataspec);
+ conf->format = strdup(format);
+ AN(conf->format);
p = findparam(param, "pattern");
if (!p) {
@@ -518,17 +518,17 @@ checkheader(struct binlog_config *conf, size_t hdrsize)
return 1;
}
- p = conf->dataspec;
+ p = conf->format;
while (*p) {
if (read(conf->fd, &c, 1) != 1 || c != *p) {
- debug(conf,1,("%s/%s: dataspec mismatch near %s: %c",
+ debug(conf,1,("%s/%s: format mismatch near %s: %c",
conf->dir, conf->fname, p, c));
return 1;
}
++p;
}
if (read(conf->fd, &c, 1) != 1 || c != 0) {
- debug(conf,1,("%s/%s: dataspec mismatch at the end: %c",
+ debug(conf,1,("%s/%s: format mismatch at the end: %c",
conf->dir, conf->fname, c));
return 1;
}
@@ -550,7 +550,7 @@ newfile(struct sess *sp, struct binlog_config *conf)
return -1;
hdrsize = ((sizeof(struct binlog_file_header) +
- strlen(conf->dataspec) +
+ strlen(conf->format) +
conf->recsize - 1) / conf->recsize) * conf->recsize;
if (fstat(conf->fd, &st) == 0) {
@@ -607,7 +607,7 @@ newfile(struct sess *sp, struct binlog_config *conf)
conf->base->version = BINLOG_VERSION;
conf->base->recsize = conf->recsize;
conf->base->recnum = 0;
- strcpy((char*)(conf->base + 1), conf->dataspec);
+ strcpy((char*)(conf->base + 1), conf->format);
conf->base->hdrsize = hdrsize;
}
diff --git a/src/binlogcat.c b/src/binlogcat.c
index 6ab3daf..bc7df6c 100644
--- a/src/binlogcat.c
+++ b/src/binlogcat.c
@@ -43,7 +43,7 @@ catlog(const char *fname)
char timebuf[128];
size_t i;
time_t start_ts;
- char *dataspec;
+ char *format;
size_t size;
struct packenv *env;
struct packinst *inst;
@@ -76,9 +76,9 @@ catlog(const char *fname)
}
size = header.hdrsize - sizeof(header);
- dataspec = xmalloc(size);
+ format = xmalloc(size);
- if (fread(dataspec, size, 1, fp) != 1) {
+ if (fread(format, size, 1, fp) != 1) {
error("error reading header of %s: %s",
fname, strerror(errno));
exit(1);
@@ -86,20 +86,20 @@ catlog(const char *fname)
if (verbose_option)
printf("# %s; format=%s; recsize=%lu; recnum=%lu\n",
- fname, dataspec, (unsigned long) header.recsize,
+ fname, format, (unsigned long) header.recsize,
(unsigned long) header.recnum);
- inst = packcomp(dataspec, &p);
+ inst = packcomp(format, &p);
if (!inst) {
if (errno == EINVAL) {
- error("%s: %s: bad dataspec near %s", fname, dataspec, p);
+ error("%s: %s: bad format near %s", fname, format, p);
exit(1);
}
error("%s", strerror(errno));
exit(1);
}
- free(dataspec);
+ free(format);
rec = xmalloc(header.recsize);
env = packenv_create(header.recsize -
diff --git a/src/binlogsel.c b/src/binlogsel.c
index e095347..63a35e7 100644
--- a/src/binlogsel.c
+++ b/src/binlogsel.c
@@ -160,7 +160,7 @@ selmem(const char *name, void *base)
size_t i, start;
time_t start_ts;
char timebuf[128];
- char *dataspec;
+ char *format;
hdr = base;
@@ -174,18 +174,18 @@ selmem(const char *name, void *base)
return;
}
- dataspec = (char*)(hdr + 1);
+ format = (char*)(hdr + 1);
if (verbose_option)
printf("# %s; format=%s; recsize=%lu; recnum=%lu\n",
- name, dataspec, (unsigned long) hdr->recsize,
+ name, format, (unsigned long) hdr->recsize,
(unsigned long) hdr->recnum);
- inst = packcomp(dataspec, &p);
+ inst = packcomp(format, &p);
if (!inst) {
if (errno == EINVAL) {
- error("%s: %s: bad dataspec near %s", name,
- dataspec, p);
+ error("%s: %s: bad format near %s", name,
+ format, p);
return;
}
diff --git a/src/vmod-binlog.h b/src/vmod-binlog.h
index e39ccea..d67f1cd 100644
--- a/src/vmod-binlog.h
+++ b/src/vmod-binlog.h
@@ -67,7 +67,7 @@ struct binlog_file_header {
size_t hdrsize;
size_t recsize;
size_t recnum;
-/* char dataspec[X];*/
+/* char format[X];*/
};
#define binlog_size(hdr) ((hdr)->hdrsize + (hdr)->recnum * (hdr)->recsize)

Return to:

Send suggestions and report system problems to the System administrator.