Beispiel #1
0
static int __convert_dup2(struct parse_context *ctx, struct expression *value1, struct expression *value2)
{
	struct expression *dup, *dup2;

	dup = get_pure_expr(ctx, value1);
	dup2 = get_pure_expr(ctx, value2);

	convert_expression(ctx, dup2);
	convert_expression(ctx, dup);
	convert_expression(ctx, dup_expr(ctx, expr_get(dup2)));
	convert_expression(ctx, dup_expr(ctx, expr_get(dup)));

	return 0;
}
Beispiel #2
0
/**
 * Returns a pure expression for given expression. If @expr is not
 * pure we need to save it's value to a temporary and return the
 * temporary.
 */
static struct expression *
get_pure_expr(struct parse_context *ctx, struct expression *expr)
{
	if (expr_is_pure(expr))
		return expr;

	return dup_expr(ctx, expr);
}
Beispiel #3
0
static int __convert_dup(struct parse_context *ctx, struct expression *value)
{
	struct expression *dup;

	dup = get_pure_expr(ctx, value);

	convert_expression(ctx, dup);
	convert_expression(ctx, dup_expr(ctx, expr_get(dup)));

	return 0;
}
Beispiel #4
0
struct expr *dup_expr(struct expr *e)
  {
  if(e)
    {
    struct expr *f=malloc(sizeof(struct expr));
    f->t=e->t;
    if(e->str)
      {
      f->str=malloc(e->len+1);
      if(e->len)
        memcpy(f->str,e->str,e->len);
      f->str[e->len]=0;
      }
    else
      f->str=0;
    f->len=e->len;
    f->l=dup_expr(e->l);
    f->r=dup_expr(e->r);
    f->rr=dup_expr(e->rr);
    return f;
    }
  else
    return 0;
  }