summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--modules/base/src/template_parser.c28
-rw-r--r--modules/base/src/template_parser.h2
2 files changed, 15 insertions, 15 deletions
diff --git a/modules/base/src/template_parser.c b/modules/base/src/template_parser.c
index 605445131..fc8607b3c 100644
--- a/modules/base/src/template_parser.c
+++ b/modules/base/src/template_parser.c
@@ -82,15 +82,15 @@ struct template_parser * template_open(const char *file)
goto err;
parser->size = s.st_size;
- parser->mmap = mmap(NULL, parser->size, PROT_READ, MAP_PRIVATE,
+ parser->data = mmap(NULL, parser->size, PROT_READ, MAP_PRIVATE,
parser->fd, 0);
- if (parser->mmap != MAP_FAILED)
+ if (parser->data != MAP_FAILED)
{
- parser->off = parser->mmap;
+ parser->off = parser->data;
parser->cur_chunk.type = T_TYPE_INIT;
- parser->cur_chunk.s = parser->mmap;
- parser->cur_chunk.e = parser->mmap;
+ parser->cur_chunk.s = parser->data;
+ parser->cur_chunk.e = parser->data;
return parser;
}
@@ -108,8 +108,8 @@ void template_close(struct template_parser *parser)
if (parser->gc != NULL)
free(parser->gc);
- if ((parser->mmap != NULL) && (parser->mmap != MAP_FAILED))
- munmap(parser->mmap, parser->size);
+ if ((parser->data != NULL) && (parser->data != MAP_FAILED))
+ munmap(parser->data, parser->size);
if (parser->fd >= 0)
close(parser->fd);
@@ -121,7 +121,7 @@ void template_text(struct template_parser *parser, const char *e)
{
const char *s = parser->off;
- if (s < (parser->mmap + parser->size))
+ if (s < (parser->data + parser->size))
{
if (parser->strip_after)
{
@@ -291,7 +291,7 @@ template_format_chunk(struct template_parser *parser, size_t *sz)
const char *template_reader(lua_State *L, void *ud, size_t *sz)
{
struct template_parser *parser = ud;
- int rem = parser->size - (parser->off - parser->mmap);
+ int rem = parser->size - (parser->off - parser->data);
char *tag;
parser->prv_chunk = parser->cur_chunk;
@@ -314,8 +314,8 @@ const char *template_reader(lua_State *L, void *ud, size_t *sz)
}
else
{
- template_text(parser, parser->mmap + parser->size);
- parser->off = parser->mmap + parser->size;
+ template_text(parser, parser->data + parser->size);
+ parser->off = parser->data + parser->size;
}
}
@@ -331,7 +331,7 @@ const char *template_reader(lua_State *L, void *ud, size_t *sz)
else
{
/* unexpected EOF */
- template_code(parser, parser->mmap + parser->size);
+ template_code(parser, parser->data + parser->size);
*sz = 1;
return "\033";
@@ -366,12 +366,12 @@ int template_error(lua_State *L, struct template_parser *parser)
if (strfind((char *)err, strlen(err), "'char(27)'", 10) != NULL)
{
- off = parser->mmap + parser->size;
+ off = parser->data + parser->size;
err = "'%>' expected before end of file";
chunkline = 0;
}
- for (ptr = parser->mmap; ptr < off; ptr++)
+ for (ptr = parser->data; ptr < off; ptr++)
if (*ptr == '\n')
line++;
diff --git a/modules/base/src/template_parser.h b/modules/base/src/template_parser.h
index d1c606272..ad03cbcfb 100644
--- a/modules/base/src/template_parser.h
+++ b/modules/base/src/template_parser.h
@@ -58,7 +58,7 @@ struct template_chunk {
struct template_parser {
int fd;
uint32_t size;
- char *mmap;
+ char *data;
char *off;
char *gc;
int line;