Commit 3882eb5c authored by Matthias Braun's avatar Matthias Braun
Browse files

pdeq: Add more const

parent 6e874e28
...@@ -56,7 +56,7 @@ FIRM_API void del_pdeq(pdeq *dq); ...@@ -56,7 +56,7 @@ FIRM_API void del_pdeq(pdeq *dq);
* *
* @param dq The list. * @param dq The list.
*/ */
FIRM_API size_t pdeq_len(pdeq *dq); FIRM_API size_t pdeq_len(pdeq const *dq);
/** /**
* Checks if a list is empty. * Checks if a list is empty.
...@@ -65,7 +65,7 @@ FIRM_API size_t pdeq_len(pdeq *dq); ...@@ -65,7 +65,7 @@ FIRM_API size_t pdeq_len(pdeq *dq);
* *
* @return non-zero if the list is empty. * @return non-zero if the list is empty.
*/ */
FIRM_API int pdeq_empty(pdeq *dq); FIRM_API int pdeq_empty(pdeq const *dq);
/** /**
* Returns non-zero if a double ended pointer list * Returns non-zero if a double ended pointer list
...@@ -74,7 +74,7 @@ FIRM_API int pdeq_empty(pdeq *dq); ...@@ -74,7 +74,7 @@ FIRM_API int pdeq_empty(pdeq *dq);
* @param dq The list. * @param dq The list.
* @param x The pointer to be searched for. * @param x The pointer to be searched for.
*/ */
FIRM_API int pdeq_contains(pdeq *dq, const void *x); FIRM_API int pdeq_contains(pdeq const *dq, const void *x);
/** /**
* Search a key in a double ended pointer list, the search * Search a key in a double ended pointer list, the search
...@@ -89,7 +89,7 @@ FIRM_API int pdeq_contains(pdeq *dq, const void *x); ...@@ -89,7 +89,7 @@ FIRM_API int pdeq_contains(pdeq *dq, const void *x);
* @return The address of the element entry if the key was found, * @return The address of the element entry if the key was found,
* NULL else. * NULL else.
*/ */
FIRM_API void *pdeq_search(pdeq *qp, cmp_fun cmp, const void *key); FIRM_API void *pdeq_search(pdeq const *qp, cmp_fun cmp, const void *key);
/** /**
* Convert the double ended pointer list into a linear array beginning from * Convert the double ended pointer list into a linear array beginning from
...@@ -101,7 +101,7 @@ FIRM_API void *pdeq_search(pdeq *qp, cmp_fun cmp, const void *key); ...@@ -101,7 +101,7 @@ FIRM_API void *pdeq_search(pdeq *qp, cmp_fun cmp, const void *key);
* *
* @return dst * @return dst
*/ */
FIRM_API void **pdeq_copyl(pdeq *qp, const void **dst); FIRM_API void **pdeq_copyl(const pdeq *qp, const void **dst);
/** /**
* Convert the double ended pointer list into a linear array beginning from * Convert the double ended pointer list into a linear array beginning from
...@@ -113,7 +113,7 @@ FIRM_API void **pdeq_copyl(pdeq *qp, const void **dst); ...@@ -113,7 +113,7 @@ FIRM_API void **pdeq_copyl(pdeq *qp, const void **dst);
* *
* @return dst * @return dst
*/ */
FIRM_API void **pdeq_copyr(pdeq *qp, const void **dst); FIRM_API void **pdeq_copyr(const pdeq *qp, const void **dst);
/** /**
* Add a pointer to the left side of a double ended pointer list. * Add a pointer to the left side of a double ended pointer list.
......
...@@ -130,18 +130,18 @@ void del_pdeq(pdeq *dq) ...@@ -130,18 +130,18 @@ void del_pdeq(pdeq *dq)
} while ((q = qq) != NULL); } while ((q = qq) != NULL);
} }
int pdeq_empty(pdeq *dq) int pdeq_empty(pdeq const *dq)
{ {
VRFY(dq); VRFY(dq);
return dq->l_end->n == 0; return dq->l_end->n == 0;
} }
size_t pdeq_len(pdeq *dq) size_t pdeq_len(pdeq const *dq)
{ {
VRFY(dq); VRFY(dq);
size_t n = 0; size_t n = 0;
pdeq *q = dq->l_end; pdeq const *q = dq->l_end;
do { do {
n += q->n; n += q->n;
q = q->r; q = q->r;
...@@ -273,11 +273,11 @@ void *pdeq_getl(pdeq *dq) ...@@ -273,11 +273,11 @@ void *pdeq_getl(pdeq *dq)
return (void *)x; return (void *)x;
} }
int pdeq_contains(pdeq *dq, void const *x) int pdeq_contains(pdeq const *dq, void const *x)
{ {
VRFY(dq); VRFY(dq);
pdeq *q = dq->l_end; pdeq const *q = dq->l_end;
do { do {
size_t p = q->p; size_t p = q->p;
size_t ep = p + q->n; size_t ep = p + q->n;
...@@ -302,11 +302,11 @@ int pdeq_contains(pdeq *dq, void const *x) ...@@ -302,11 +302,11 @@ int pdeq_contains(pdeq *dq, void const *x)
return false; return false;
} }
void *pdeq_search(pdeq *dq, cmp_fun cmp, void const *key) void *pdeq_search(pdeq const *dq, cmp_fun cmp, void const *key)
{ {
VRFY(dq); VRFY(dq);
pdeq *q = dq->l_end; pdeq const *q = dq->l_end;
do { do {
size_t p = q->p; size_t p = q->p;
size_t ep = p + q->n; size_t ep = p + q->n;
...@@ -331,12 +331,12 @@ void *pdeq_search(pdeq *dq, cmp_fun cmp, void const *key) ...@@ -331,12 +331,12 @@ void *pdeq_search(pdeq *dq, cmp_fun cmp, void const *key)
return NULL; return NULL;
} }
void **pdeq_copyl(pdeq *dq, void const **dst) void **pdeq_copyl(pdeq const *dq, void const **dst)
{ {
VRFY(dq); VRFY(dq);
void const **d = dst; void const **d = dst;
pdeq *q = dq->l_end; pdeq const *q = dq->l_end;
while (q != NULL) { while (q != NULL) {
size_t p = q->p; size_t p = q->p;
size_t n = q->n; size_t n = q->n;
...@@ -356,11 +356,11 @@ void **pdeq_copyl(pdeq *dq, void const **dst) ...@@ -356,11 +356,11 @@ void **pdeq_copyl(pdeq *dq, void const **dst)
return (void **)dst; return (void **)dst;
} }
void **pdeq_copyr(pdeq *dq, void const **dst) void **pdeq_copyr(pdeq const *dq, void const **dst)
{ {
VRFY(dq); VRFY(dq);
pdeq *q = dq->r_end; pdeq const *q = dq->r_end;
void const **d = dst; void const **d = dst;
while (q != NULL) { while (q != NULL) {
size_t p = q->p; size_t p = q->p;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment