From 2545f9767c38362b727323c99586ad6c5e58911e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=B6r=C3=B6k=20Edvin?= Date: Wed, 9 Jun 2010 13:42:47 +0300 Subject: [PATCH] Rearrange some fields in structs to avoid holes. --- libclamav/bytecode.h | 2 +- libclamav/bytecode_priv.h | 22 +++++++++++----------- libclamav/bytecode_vm.c | 2 +- libclamav/matcher-ac.h | 2 +- libclamav/matcher.h | 4 ++-- libclamav/pdf.c | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/libclamav/bytecode.h b/libclamav/bytecode.h index 31ef0df10..db816953b 100644 --- a/libclamav/bytecode.h +++ b/libclamav/bytecode.h @@ -56,12 +56,12 @@ struct cli_bc { uint16_t *globaltys; size_t num_globals; enum bc_state state; - uint16_t start_tid; struct bitset_tag *uses_apis; char *lsig; char *vnameprefix; char **vnames; unsigned vnames_cnt; + uint16_t start_tid; struct cli_bc_dbgnode *dbgnodes; unsigned dbgnode_cnt; unsigned hook_lsig_id; diff --git a/libclamav/bytecode_priv.h b/libclamav/bytecode_priv.h index b61ea2d2a..077d23b75 100644 --- a/libclamav/bytecode_priv.h +++ b/libclamav/bytecode_priv.h @@ -39,8 +39,8 @@ typedef uint16_t funcid_t; struct cli_bc_callop { operand_t* ops; uint16_t* opsizes; - uint8_t numOps; funcid_t funcid; + uint8_t numOps; }; struct branch { @@ -59,8 +59,8 @@ typedef uint8_t interp_op_t; struct cli_bc_inst { enum bc_opcode opcode; uint16_t type; - interp_op_t interp_op;/* opcode for interpreter */ operand_t dest; + interp_op_t interp_op;/* opcode for interpreter */ union { operand_t unaryop; struct cli_bc_cast cast; @@ -96,8 +96,8 @@ struct cli_bc_func { struct cli_bc_dbgnode_element { unsigned nodeid; - char *string; unsigned len; + char *string; uint64_t constant; }; @@ -139,6 +139,8 @@ struct bc_jsnorm { struct cli_bc_ctx { uint8_t timeout;/* must be first byte in struct! */ + uint16_t funcid; + unsigned numParams; /* id and params of toplevel function called */ const struct cli_bc *bc; const struct cli_bc_func *func; @@ -147,43 +149,41 @@ struct cli_bc_ctx { uint16_t *opsizes; char *values; operand_t *operands; - uint16_t funcid; - unsigned numParams; uint32_t file_size; + int outfd; off_t off; fmap_t *fmap; fmap_t *save_map; const char *virname; struct cli_bc_hooks hooks; const struct cli_exe_section *sections; - int outfd; char *tempfile; void *ctx; unsigned written; unsigned filewritten; unsigned found; + unsigned ninflates; bc_dbg_callback_trace trace; bc_dbg_callback_trace_op trace_op; bc_dbg_callback_trace_val trace_val; bc_dbg_callback_trace_ptr trace_ptr; - unsigned trace_level; const char *directory; const char *file; const char *scope; + unsigned trace_level; uint32_t scopeid; unsigned line; unsigned col; mpool_t *mpool; struct bc_inflate* inflates; - unsigned ninflates; struct bc_buffer *buffers; unsigned nbuffers; - struct cli_hashset *hashsets; unsigned nhashsets; - struct bc_jsnorm* jsnorms; unsigned njsnorms; - char *jsnormdir; unsigned jsnormwritten; + struct cli_hashset *hashsets; + struct bc_jsnorm* jsnorms; + char *jsnormdir; struct cli_map *maps; unsigned nmaps; unsigned containertype; diff --git a/libclamav/bytecode_vm.c b/libclamav/bytecode_vm.c index c60b6a4c6..bf8e5d988 100644 --- a/libclamav/bytecode_vm.c +++ b/libclamav/bytecode_vm.c @@ -199,8 +199,8 @@ struct stack_entry { struct stack_entry *prev; const struct cli_bc_func *func; operand_t ret; - struct cli_bc_bb *bb; unsigned bb_inst; + struct cli_bc_bb *bb; char *values; }; diff --git a/libclamav/matcher-ac.h b/libclamav/matcher-ac.h index 18f53ee09..a8410b7d9 100644 --- a/libclamav/matcher-ac.h +++ b/libclamav/matcher-ac.h @@ -64,10 +64,10 @@ struct cli_ac_patt { uint16_t parts, partno, special, special_pattern; struct cli_ac_special **special_table; struct cli_ac_patt *next, *next_same; - uint8_t depth; uint16_t rtype, type; uint32_t offdata[4], offset_min, offset_max; uint32_t boundary; + uint8_t depth; }; struct cli_ac_node { diff --git a/libclamav/matcher.h b/libclamav/matcher.h index c2ae65125..022a3d7ad 100644 --- a/libclamav/matcher.h +++ b/libclamav/matcher.h @@ -52,6 +52,7 @@ struct cli_lsig_tdb { uint32_t *val, *range; char *str; uint32_t cnt[3]; + uint32_t subsigs; const uint32_t *target; const uint32_t *engine, *nos, *ep, *filesize; @@ -62,7 +63,6 @@ struct cli_lsig_tdb { */ const char *icongrp1, *icongrp2; uint32_t *macro_ptids; - uint32_t subsigs; #ifdef USE_MPOOL mpool_t *mempool; #endif @@ -71,10 +71,10 @@ struct cli_lsig_tdb { struct cli_bc; struct cli_ac_lsig { uint32_t id; + unsigned bc_idx; char *logic; const char *virname; struct cli_lsig_tdb tdb; - unsigned bc_idx; }; struct cli_matcher { diff --git a/libclamav/pdf.c b/libclamav/pdf.c index e3e4d57e1..ac9fdc4d3 100644 --- a/libclamav/pdf.c +++ b/libclamav/pdf.c @@ -121,10 +121,10 @@ struct pdf_obj { struct pdf_struct { struct pdf_obj *objs; unsigned nobjs; + unsigned flags; const char *map; off_t size; off_t offset; - unsigned flags; cli_ctx *ctx; const char *dir; unsigned files;