]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
ggml : fix calloc argument ordering. (#6820)
authorDave Airlie <redacted>
Mon, 22 Apr 2024 14:05:06 +0000 (00:05 +1000)
committerGitHub <redacted>
Mon, 22 Apr 2024 14:05:06 +0000 (16:05 +0200)
commite931888d5024de814ce7119a18d6a959bfff3821
tree1f09dcdd1115e7ac3841309791250e802fea03ab
parent8960fe86ae075c846c5df8848230d1904ba8877f
ggml : fix calloc argument ordering. (#6820)

Latest gcc complains here:
/home/airlied/devel/llama.cpp/ggml-alloc.c: In function ‘ggml_gallocr_new_n’:
/home/airlied/devel/llama.cpp/ggml-alloc.c:374:59: warning: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
  374 |     ggml_gallocr_t galloc = (ggml_gallocr_t)calloc(sizeof(struct ggml_gallocr), 1);
      |                                                           ^~~~~~
/home/airlied/devel/llama.cpp/ggml-alloc.c:374:59: note: earlier argument should specify number of elements, later size of each element

and a bunch more.

calloc is specified to take nmemb first then size, so realign the code.

In a couple of places there was a * x, 1 so I fixed those to use calloc properly.
ggml-alloc.c
ggml-backend.c