Cast to (const char *) in strrchr calls
[elinks.git] / src / session / location.c
blob302b4dc5b1dba2e74bae81bd186760b6c47db07e
1 /** Locations handling
2 * @file */
4 #ifdef HAVE_CONFIG_H
5 #include "config.h"
6 #endif
8 #include <stdlib.h>
10 #include "elinks.h"
12 #include "session/location.h"
13 #include "session/session.h"
14 #include "util/memory.h"
15 #include "util/string.h"
18 /** @relates location */
19 void
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));
27 if (new_frame) {
28 new_frame->name = stracpy(frame->name);
29 if (!new_frame->name) {
30 mem_free(new_frame);
31 return;
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);
41 void
42 destroy_location(struct location *loc)
44 struct frame *frame;
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);
52 mem_free(loc);