path: root/include/expression.h
diff options
authorPatrick McHardy <>2009-03-20 16:12:18 +0100
committerPatrick McHardy <>2009-03-20 16:12:18 +0100
commit1bd3b87687328e1e097ca69cf18f2f14abfa9782 (patch)
tree5da11e82f3b32151afec78f7d216a25a39d0c429 /include/expression.h
parentb076d6c6376a77fa84aa813bf267628820bcc883 (diff)
expr: add support for cloning expressions
Signed-off-by: Patrick McHardy <>
Diffstat (limited to 'include/expression.h')
1 files changed, 3 insertions, 0 deletions
diff --git a/include/expression.h b/include/expression.h
index d4222060..b0084c07 100644
--- a/include/expression.h
+++ b/include/expression.h
@@ -106,6 +106,7 @@ static inline void expr_set_context(struct expr_ctx *ctx,
* @type: expression type
* @name: expression name for diagnostics
+ * @clone: function to clone type specific data
* @destroy: destructor, must release inner expressions
* @set_type: function to promote type and byteorder of inner types
* @print: function to print the expression
@@ -113,6 +114,7 @@ static inline void expr_set_context(struct expr_ctx *ctx,
struct expr_ops {
enum expr_types type;
const char *name;
+ void (*clone)(struct expr *new, const struct expr *expr);
void (*destroy)(struct expr *expr);
void (*set_type)(const struct expr *expr,
const struct datatype *dtype,
@@ -238,6 +240,7 @@ extern struct expr *expr_alloc(const struct location *loc,
const struct expr_ops *ops,
const struct datatype *dtype,
enum byteorder byteorder, unsigned int len);
+extern struct expr *expr_clone(const struct expr *expr);
extern struct expr *expr_get(struct expr *expr);
extern void expr_free(struct expr *expr);
extern void expr_print(const struct expr *expr);