C での単純な連結リストの実装を使用して、所有権を譲渡することを Splint に伝えるにはどうすればよいdata
ですか?
typedef struct {
void* data;
/*@null@*/ void* next;
} list;
static /*@null@*/ list* new_list(/*@notnull@*/ void* data)
{
list* l;
l = malloc(sizeof(list));
if (l == NULL)
return NULL;
l->next = NULL;
l->data = data;
return l;
}
次のエラー メッセージが表示されます。
Implicitly temp storage data assigned to implicitly
only: list->data = data
Temp storage (associated with a formal parameter) is transferred to a
non-temporary reference. The storage may be released or new aliases created.
(Use -temptrans to inhibit warning)
data
解放の責任がリストのデータ構造に移されることを Splint に伝えたいと思います。