1 /******************************************************************************
2 * Copyright (c) 2000-2016 Ericsson Telecom AB
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
13 ******************************************************************************/
14 #include "config_data.h"
15 #include "../../common/memory.h"
17 void config_data::add_host(char *group_name
, char *host_name
)
19 group_list
= (group_item
*)Realloc(group_list
,
20 ++group_list_len
* sizeof(group_item
));
21 // We take copies because the same group_name pointer may be supplied
22 // more than once (group:host is a one-to-many relationship).
23 // This would result in double-free.
24 // Copying the host_name is not strictly necessary; done for symmetry.
25 group_list
[group_list_len
-1].group_name
= mcopystr(group_name
);
26 // We need NULL here, not empty string.
27 group_list
[group_list_len
-1].host_name
= host_name
? mcopystr(host_name
) : NULL
;
30 void config_data::add_component(char *host_or_grp
, char *comp
)
32 component_list
= (component_item
*)Realloc(component_list
,
33 ++component_list_len
* sizeof(component_item
));
34 component_list
[component_list_len
-1].host_or_group
= host_or_grp
;
35 component_list
[component_list_len
-1].component
= comp
;
38 void config_data::add_exec(const execute_list_item
& exec_item
)
40 execute_list
= (execute_list_item
*)Realloc(execute_list
,
41 (execute_list_len
+ 1) * sizeof(*execute_list
));
42 execute_list
[execute_list_len
++] = exec_item
;
45 void config_data::set_log_file(char *f
)
47 if (log_file_name
!= NULL
)
52 void config_data::clear()
54 Free(config_read_buffer
);
55 config_read_buffer
= NULL
;
60 for(int r
= 0; r
< execute_list_len
; r
++) {
61 Free(execute_list
[r
].module_name
);
62 Free(execute_list
[r
].testcase_name
);
68 for(int r
= 0; r
< group_list_len
; r
++) {
69 Free(group_list
[r
].group_name
);
70 Free(group_list
[r
].host_name
);
76 for(int r
= 0; r
< component_list_len
; r
++) {
77 Free(component_list
[r
].host_or_group
);
78 Free(component_list
[r
].component
);
81 component_list
= NULL
;
82 component_list_len
= 0;
90 unix_sockets_enabled
=
92 false // Unix domain socket communication on Cygwin is painfully slow
This page took 0.055316 seconds and 5 git commands to generate.