1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-12-22 20:36:01 +01:00

Merge pull request #1 from v1j4y/patch-1

Added a delete function to clear the qmckl_context instance.
This commit is contained in:
Anthony Scemama 2020-10-15 12:21:00 +02:00 committed by GitHub
commit 688411769f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -90,6 +90,27 @@ qmckl_context qmckl_context_copy(const qmckl_context context) {
} }
#+END_SRC #+END_SRC
** =qmckl_context_destroy=
To delete a new context, use =qmckl_context_destroy()=. If the deletion
failed, the function returns =0=. On success, the function returns =1=
implying that the context has been freed.
#+BEGIN_SRC C :tangle qmckl_context.h
qmckl_context qmckl_context_destroy(qmckl_context context);
#+END_SRC
#+BEGIN_SRC C :tangle qmckl_context.c
qmckl_context qmckl_context_destroy(qmckl_context context) {
if (context == NULL) {
return (qmckl_context) 0;
}
free(context);
return (qmckl_context) 1;
}
#+END_SRC
* Precision * Precision