| 210 | /* *INDENT-ON* */ |
| 211 | |
| 212 | int |
| 213 | cib_get_operation_id(const char *op, int *operation) |
| 214 | { |
| 215 | static GHashTable *operation_hash = NULL; |
| 216 | |
| 217 | if (operation_hash == NULL) { |
| 218 | int lpc = 0; |
| 219 | int max_msg_types = DIMOF(cib_server_ops); |
| 220 | |
| 221 | operation_hash = g_hash_table_new_full(crm_str_hash, g_str_equal, NULL, g_hash_destroy_str); |
| 222 | for (lpc = 1; lpc < max_msg_types; lpc++) { |
| 223 | /* coverity[returned_null] Ignore */ |
| 224 | int *value = malloc(sizeof(int)); |
| 225 | |
| 226 | *value = lpc; |
| 227 | g_hash_table_insert(operation_hash, (gpointer) cib_server_ops[lpc].operation, value); |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | if (op != NULL) { |
| 232 | int *value = g_hash_table_lookup(operation_hash, op); |
| 233 | |
| 234 | if (value) { |
| 235 | *operation = *value; |
| 236 | return pcmk_ok; |
| 237 | } |
| 238 | } |
| 239 | crm_err("Operation %s is not valid", op); |
| 240 | *operation = -1; |
| 241 | return -EINVAL; |
| 242 | } |
| 243 | |
| 244 | xmlNode * |
| 245 | cib_msg_copy(xmlNode * msg, gboolean with_data) |
no outgoing calls
no test coverage detected