12 #include "session/location.h"
13 #include "session/session.h"
14 #include "util/memory.h"
15 #include "util/string.h"
18 /** @relates location */
20 copy_location(struct location
*dst
, struct location
*src
)
22 struct frame
*frame
, *new_frame
;
24 init_list(dst
->frames
);
25 foreachback (frame
, src
->frames
) {
26 new_frame
= mem_calloc(1, sizeof(*new_frame
));
28 new_frame
->name
= stracpy(frame
->name
);
29 if (!new_frame
->name
) {
33 new_frame
->redirect_cnt
= 0;
34 copy_vs(&new_frame
->vs
, &frame
->vs
);
35 add_to_list(dst
->frames
, new_frame
);
38 copy_vs(&dst
->vs
, &src
->vs
);
42 destroy_location(struct location
*loc
)
46 foreach (frame
, loc
->frames
) {
47 destroy_vs(&frame
->vs
, 1);
48 mem_free(frame
->name
);
50 free_list(loc
->frames
);
51 destroy_vs(&loc
->vs
, 1);