+// SPDX-License-Identifier: ISC
/*
* Copyright (c) 2015-16 David Lamparter, for NetDEF, Inc.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
{
uint32_t i = 0;
- frr_with_mutex(&refs_mtx) {
+ frr_with_mutex (&refs_mtx) {
while (ref[i].code != END_FERR) {
- hash_get(refs, &ref[i], hash_alloc_intern);
+ (void)hash_get(refs, &ref[i], hash_alloc_intern);
i++;
}
}
struct log_ref *ref;
holder.code = code;
- frr_with_mutex(&refs_mtx) {
+ frr_with_mutex (&refs_mtx) {
ref = hash_lookup(refs, &holder);
}
if (json)
top = json_object_new_object();
- frr_with_mutex(&refs_mtx) {
+ frr_with_mutex (&refs_mtx) {
errlist = code ? list_new() : hash_to_list(refs);
}
}
}
- if (json) {
- const char *str = json_object_to_json_string_ext(
- top, JSON_C_TO_STRING_PRETTY);
- vty_out(vty, "%s\n", str);
- json_object_free(top);
- }
-
+ vty_json(vty, top);
list_delete(&errlist);
}
void log_ref_init(void)
{
- frr_with_mutex(&refs_mtx) {
+ frr_with_mutex (&refs_mtx) {
refs = hash_create(ferr_hash_key, ferr_hash_cmp,
"Error Reference Texts");
}
void log_ref_fini(void)
{
- frr_with_mutex(&refs_mtx) {
+ frr_with_mutex (&refs_mtx) {
hash_clean(refs, NULL);
hash_free(refs);
refs = NULL;
return ferr_ok();
}
+PRINTFRR(7, 0)
static ferr_r ferr_set_va(const char *file, int line, const char *func,
enum ferr_kind kind, const char *pathname,
int errno_val, const char *text, va_list va)