Skip to content

Commit 6116b7a

Browse files
committed
* put.c: move whether spans are enabled into a flag in struct state
1 parent 31b5ae8 commit 6116b7a

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

src/builtin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ static struct value *lens_put(struct info *info, struct value *l,
222222

223223
init_memstream(&ms);
224224
lns_put(info, ms.stream, l->lens, tree->origin->children,
225-
str->string->str, &err);
225+
str->string->str, 0, &err);
226226
close_memstream(&ms);
227227

228228
if (err == NULL && ! HAS_ERR(info)) {

src/lens.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ struct skel *lns_parse(struct lens *lens, const char *text,
209209
* to update spans or not.
210210
*/
211211
void lns_put(struct info *info, FILE *out, struct lens *lens, struct tree *tree,
212-
const char *text, struct lns_error **err);
212+
const char *text, int enable_span, struct lns_error **err);
213213

214214
/* Free up temporary data structures, most importantly compiled
215215
regular expressions */

src/put.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ static void create_lens(struct lens *lens, struct state *state) {
840840
}
841841

842842
void lns_put(struct info *info, FILE *out, struct lens *lens, struct tree *tree,
843-
const char *text, struct lns_error **err) {
843+
const char *text, int enable_span, struct lns_error **err) {
844844
struct state state;
845845
struct lns_error *err1;
846846

@@ -862,7 +862,7 @@ void lns_put(struct info *info, FILE *out, struct lens *lens, struct tree *tree,
862862
}
863863
state.out = out;
864864
state.split = make_split(tree);
865-
state.with_span = info->flags & AUG_ENABLE_SPAN;
865+
state.with_span = enable_span;
866866
state.tree = tree;
867867
state.info = info;
868868
if (state.with_span) {

src/transform.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1115,7 +1115,8 @@ static void lens_put(struct augeas *aug, const char *filename,
11151115
tree->span->span_start = ftell(out);
11161116
}
11171117

1118-
lns_put(info, out, lens, tree->children, text, err);
1118+
lns_put(info, out, lens, tree->children, text,
1119+
aug->flags & AUG_ENABLE_SPAN, err);
11191120

11201121
if (with_span) {
11211122
tree->span->span_end = ftell(out);

0 commit comments

Comments
 (0)