lib: fix new (incorrect) CLANG SA warnings

Signed-off-by: Christian Hopps <chopps@labn.net>
This commit is contained in:
Christian Hopps 2025-01-10 07:01:00 -05:00
parent 7f80885099
commit c88b48929c
3 changed files with 12 additions and 10 deletions

View file

@ -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; \
})
/**

View file

@ -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 "

View file

@ -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) {