diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2014-09-04 11:34:27 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2014-09-04 11:34:27 +0000 |
commit | f8f558291aec3c9c197699fb28587626f8b53d96 (patch) | |
tree | e80ca010a246c11031b69dc89691c161808c4cc9 /modules/base/src | |
parent | 3ccdaa9b48f5da6073ac5f0badd23de2e18f3242 (diff) |
libs/web: rename template_parser field "mmap" to the more generic "data"
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Diffstat (limited to 'modules/base/src')
-rw-r--r-- | modules/base/src/template_parser.c | 28 | ||||
-rw-r--r-- | modules/base/src/template_parser.h | 2 |
2 files changed, 15 insertions, 15 deletions
diff --git a/modules/base/src/template_parser.c b/modules/base/src/template_parser.c index 6054451315..fc8607b3cc 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 d1c606272e..ad03cbcfb2 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; |