Commit 8d855a7b authored by Paul Asmuth's avatar Paul Asmuth
Browse files

add a count/limit argument to expr_clone

parent 2bad97cd
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -118,11 +118,11 @@ const std::string& expr_get_value(const Expr* expr) {
  return expr->value;
}

ExprStorage expr_clone(const Expr* e) {
ExprStorage expr_clone(const Expr* e, int count /* =-1 */) {
  ExprStorage copy;
  ExprStorage* c = ©

  while (e) {
  for (; e && count != 0; --count) {
    *c = ExprStorage(new Expr, bind(&expr_destroy, _1));
    (*c)->type = e->type;
    (*c)->value = e->value;
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ bool expr_is_value_quoted(const Expr* expr);
bool expr_is_value_quoted(const Expr* expr, const std::string& cmp);
const std::string& expr_get_value(const Expr* expr);

ExprStorage expr_clone(const Expr* e);
ExprStorage expr_clone(const Expr* e, int count=-1);

std::string expr_inspect(const Expr* expr);

+1 −1
Original line number Diff line number Diff line
@@ -141,7 +141,7 @@ ReturnCode expr_to_stroke_style(
}

ReturnCode expr_to_copy(const Expr* e, ExprStorage* c) {
  *c = expr_clone(e);
  *c = expr_clone(e, 1);
  return OK;
}