diff options
author | Christian Hopps <chopps@labn.net> | 2025-01-10 13:01:00 +0100 |
---|---|---|
committer | Christian Hopps <chopps@labn.net> | 2025-01-14 05:40:52 +0100 |
commit | c88b48929c60ffe0214949fdf85afefa4038327b (patch) | |
tree | 715c50f1f42a9d6c492ce87a746941eb29ed7966 | |
parent | tests: add datastore notification test (diff) | |
download | frr-c88b48929c60ffe0214949fdf85afefa4038327b.tar.xz frr-c88b48929c60ffe0214949fdf85afefa4038327b.zip |
lib: fix new (incorrect) CLANG SA warnings
Signed-off-by: Christian Hopps <chopps@labn.net>
-rw-r--r-- | lib/darr.h | 20 | ||||
-rw-r--r-- | lib/mgmt_be_client.c | 1 | ||||
-rw-r--r-- | mgmtd/mgmt_history.c | 1 |
3 files changed, 12 insertions, 10 deletions
diff --git a/lib/darr.h b/lib/darr.h index 121e3dd14..084c2a103 100644 --- a/lib/darr.h +++ b/lib/darr.h @@ -571,16 +571,16 @@ void *__darr_resize(void *a, uint count, size_t esize, struct memtype *mt); * Return: * The dynamic_array D with the new string content. */ -#define darr_in_strcat(D, S) \ - ({ \ - uint __dlen = darr_strlen(D); \ - uint __slen = strlen(S); \ - darr_ensure_cap_mt(D, __dlen + __slen + 1, MTYPE_DARR_STR); \ - if (darr_len(D) == 0) \ - *darr_append(D) = 0; \ - memcpy(darr_last(D), (S), __slen + 1); \ - _darr_len(D) += __slen; \ - D; \ +#define darr_in_strcat(D, S) \ + ({ \ + uint __dlen = darr_strlen(D); \ + uint __slen = strlen(S); \ + darr_ensure_cap_mt(D, __dlen + __slen + 1, MTYPE_DARR_STR); \ + if (darr_len(D) == 0) \ + *darr_append(D) = 0; \ + memcpy(&(D)[darr_strlen(D)] /* darr_last(D) clangSA :( */, (S), __slen + 1); \ + _darr_len(D) += __slen; \ + D; \ }) /** diff --git a/lib/mgmt_be_client.c b/lib/mgmt_be_client.c index a443d83b5..efd5d70a7 100644 --- a/lib/mgmt_be_client.c +++ b/lib/mgmt_be_client.c @@ -322,6 +322,7 @@ static int __send_notification(struct mgmt_be_client *client, const char *xpath, LY_ERR err; int ret = 0; + assert(op != NOTIFY_OP_NOTIFICATION || xpath || tree); debug_be_client("%s: sending %sYANG %snotification: %s", __func__, op == NOTIFY_OP_DS_DELETE ? "delete " : op == NOTIFY_OP_DS_REPLACE ? "replace " diff --git a/mgmtd/mgmt_history.c b/mgmtd/mgmt_history.c index c97cb7f0f..934748b1f 100644 --- a/mgmtd/mgmt_history.c +++ b/mgmtd/mgmt_history.c @@ -177,6 +177,7 @@ static bool mgmt_history_dump_cmt_record_index(void) return false; } + assert(cnt <= 10); /* silence bad CLANG SA warning */ ret = fwrite(&cmt_info_set, sizeof(struct mgmt_cmt_info_t), cnt, fp); fclose(fp); if (ret != cnt) { |