]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
src: remove unused token_offset from struct location
authorPablo Neira Ayuso <pablo@netfilter.org>
Mon, 9 Dec 2024 00:23:08 +0000 (01:23 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 2 Jan 2025 18:58:11 +0000 (19:58 +0100)
This saves 8 bytes in x86_64 in struct location which is embedded in
every expression.

This shrinks struct expr to 120 bytes according to pahole.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/nftables.h
src/parser_bison.y
src/scanner.l

index c25deb3676ddbd9d10e3ad707a85515a20aface6..7d891b439a2defea926d7b49eeeeed66bf811009 100644 (file)
@@ -158,7 +158,6 @@ struct location {
        const struct input_descriptor           *indesc;
        union {
                struct {
-                       off_t                   token_offset;
                        off_t                   line_offset;
 
                        unsigned int            first_line;
index 6e6f3cf8335d543fdc5be48327e4b7a2b05cac62..6e8b639104fcb112c8d04b6589a00d2ee388e193 100644 (file)
@@ -102,7 +102,6 @@ static void location_update(struct location *loc, struct location *rhs, int n)
 {
        if (n) {
                loc->indesc       = rhs[n].indesc;
-               loc->token_offset = rhs[1].token_offset;
                loc->line_offset  = rhs[1].line_offset;
                loc->first_line   = rhs[1].first_line;
                loc->first_column = rhs[1].first_column;
@@ -110,7 +109,6 @@ static void location_update(struct location *loc, struct location *rhs, int n)
                loc->last_column  = rhs[n].last_column;
        } else {
                loc->indesc       = rhs[0].indesc;
-               loc->token_offset = rhs[0].token_offset;
                loc->line_offset  = rhs[0].line_offset;
                loc->first_line   = loc->last_line   = rhs[0].last_line;
                loc->first_column = loc->last_column = rhs[0].last_column;
index c825fa79cfd9eb3acabf0188d39fa42fb2d4cbdd..ecdba404b2cd8f7a526bf9271bc709f2461bc41d 100644 (file)
@@ -90,7 +90,6 @@ static void update_offset(struct parser_state *state, struct location *loc,
                          unsigned int len)
 {
        state->indesc->token_offset     += len;
-       loc->token_offset               = state->indesc->token_offset;
        loc->line_offset                = state->indesc->line_offset;
 }