| 896 | } |
| 897 | |
| 898 | bool remove_trace_format(agent* thisAgent, |
| 899 | bool stack_trace, |
| 900 | int type_restriction, |
| 901 | Symbol* name_restriction) |
| 902 | { |
| 903 | uint32_t hash_value; |
| 904 | hash_table* ht; |
| 905 | tracing_rule* tr; |
| 906 | trace_format** format; |
| 907 | |
| 908 | if (name_restriction) |
| 909 | { |
| 910 | if (stack_trace) |
| 911 | { |
| 912 | ht = thisAgent->stack_tr_ht[type_restriction]; |
| 913 | } |
| 914 | else |
| 915 | { |
| 916 | ht = thisAgent->object_tr_ht[type_restriction]; |
| 917 | } |
| 918 | hash_value = hash_name_restriction(name_restriction, ht->log2size); |
| 919 | tr = reinterpret_cast<tracing_rule*>(*(ht->buckets + hash_value)); |
| 920 | for (; tr != NIL; tr = tr->next_in_hash_bucket) |
| 921 | if (tr->name_restriction == name_restriction) |
| 922 | { |
| 923 | break; |
| 924 | } |
| 925 | if (! tr) |
| 926 | { |
| 927 | return false; |
| 928 | } |
| 929 | deallocate_trace_format_list(thisAgent, tr->format); |
| 930 | remove_from_hash_table(thisAgent, ht, tr); |
| 931 | free_memory(thisAgent, tr, MISCELLANEOUS_MEM_USAGE); |
| 932 | symbol_remove_ref(thisAgent, name_restriction); |
| 933 | return true; |
| 934 | } |
| 935 | /* --- no name restriction --- */ |
| 936 | if (stack_trace) |
| 937 | { |
| 938 | format = &(thisAgent->stack_tf_for_anything[type_restriction]); |
| 939 | } |
| 940 | else |
| 941 | { |
| 942 | format = &(thisAgent->object_tf_for_anything[type_restriction]); |
| 943 | } |
| 944 | if (! *format) |
| 945 | { |
| 946 | return false; |
| 947 | } |
| 948 | deallocate_trace_format_list(thisAgent, *format); |
| 949 | *format = NIL; |
| 950 | return true; |
| 951 | } |
| 952 | |
| 953 | bool add_trace_format(agent* thisAgent, |
| 954 | bool stack_trace, |
no test coverage detected