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

Add const qualifier since context is immutable

This commit is contained in:
Pablo Oliveira 2020-10-15 09:22:24 +02:00
parent e08d8d3d51
commit 739d0dba3c

View File

@ -66,11 +66,11 @@ qmckl_context qmckl_context_create() {
** =qmckl_context_copy= ** =qmckl_context_copy=
#+BEGIN_SRC C :tangle qmckl_context.h #+BEGIN_SRC C :tangle qmckl_context.h
qmckl_context qmckl_context_copy(qmckl_context context); qmckl_context qmckl_context_copy(const qmckl_context context);
#+END_SRC #+END_SRC
#+BEGIN_SRC C :tangle qmckl_context.c #+BEGIN_SRC C :tangle qmckl_context.c
qmckl_context qmckl_context_copy(qmckl_context context) { qmckl_context qmckl_context_copy(const qmckl_context context) {
qmckl_context_struct* old_context; qmckl_context_struct* old_context;
qmckl_context_struct* new_context; qmckl_context_struct* new_context;
@ -102,11 +102,11 @@ qmckl_context qmckl_context_copy(qmckl_context context) {
** =qmckl_context_set_precision= ** =qmckl_context_set_precision=
#+BEGIN_SRC C :tangle qmckl_context.h #+BEGIN_SRC C :tangle qmckl_context.h
qmckl_context qmckl_context_set_precision(qmckl_context context, int precision); qmckl_context qmckl_context_set_precision(const qmckl_context context, int precision);
#+END_SRC #+END_SRC
#+BEGIN_SRC C :tangle qmckl_context.c #+BEGIN_SRC C :tangle qmckl_context.c
qmckl_context qmckl_context_set_precision(qmckl_context context, int precision) { qmckl_context qmckl_context_set_precision(const qmckl_context context, int precision) {
qmckl_context_struct* ctx; qmckl_context_struct* ctx;
if (precision < 2) return (qmckl_context) 0; if (precision < 2) return (qmckl_context) 0;
@ -120,11 +120,11 @@ qmckl_context qmckl_context_set_precision(qmckl_context context, int precision)
** =qmckl_context_set_range= ** =qmckl_context_set_range=
#+BEGIN_SRC C :tangle qmckl_context.h #+BEGIN_SRC C :tangle qmckl_context.h
qmckl_context qmckl_context_set_range(qmckl_context context, int range); qmckl_context qmckl_context_set_range(const qmckl_context context, int range);
#+END_SRC #+END_SRC
#+BEGIN_SRC C :tangle qmckl_context.c #+BEGIN_SRC C :tangle qmckl_context.c
qmckl_context qmckl_context_set_range(qmckl_context context, int range) { qmckl_context qmckl_context_set_range(const qmckl_context context, int range) {
qmckl_context_struct* ctx; qmckl_context_struct* ctx;
if (range < 2) return (qmckl_context) 0; if (range < 2) return (qmckl_context) 0;
@ -141,11 +141,11 @@ qmckl_context qmckl_context_set_range(qmckl_context context, int range) {
** =qmckl_context_get_precision= ** =qmckl_context_get_precision=
#+BEGIN_SRC C :tangle qmckl_context.h #+BEGIN_SRC C :tangle qmckl_context.h
int qmckl_context_get_precision(qmckl_context context); int qmckl_context_get_precision(const qmckl_context context);
#+END_SRC #+END_SRC
#+BEGIN_SRC C :tangle qmckl_context.c #+BEGIN_SRC C :tangle qmckl_context.c
int qmckl_context_get_precision(qmckl_context context) { int qmckl_context_get_precision(const qmckl_context context) {
qmckl_context_struct* ctx; qmckl_context_struct* ctx;
ctx = (qmckl_context_struct*) context; ctx = (qmckl_context_struct*) context;
return ctx->precision; return ctx->precision;
@ -155,11 +155,11 @@ int qmckl_context_get_precision(qmckl_context context) {
** =qmckl_context_get_range= ** =qmckl_context_get_range=
#+BEGIN_SRC C :tangle qmckl_context.h #+BEGIN_SRC C :tangle qmckl_context.h
int qmckl_context_get_range(qmckl_context context); int qmckl_context_get_range(const qmckl_context context);
#+END_SRC #+END_SRC
#+BEGIN_SRC C :tangle qmckl_context.c #+BEGIN_SRC C :tangle qmckl_context.c
int qmckl_context_get_range(qmckl_context context) { int qmckl_context_get_range(const qmckl_context context) {
qmckl_context_struct* ctx; qmckl_context_struct* ctx;
ctx = (qmckl_context_struct*) context; ctx = (qmckl_context_struct*) context;
return ctx->range; return ctx->range;