Skip to content

Commit

Permalink
roken: tsearch use rk_UNCONST instead of __DECONST #307
Browse files Browse the repository at this point in the history
The rk_UNCONST macro exists because neither __DECONST nor uintptr_t
are available on all platforms (for example, AIX).

Change-Id: Ie36f0dd7a9ce454d411761ee4dbd6fc1f7c6692c
  • Loading branch information
jaltman committed Feb 21, 2019
1 parent f0d9289 commit 43a34f6
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions lib/roken/tsearch.c
Expand Up @@ -24,10 +24,6 @@ typedef struct node {
struct node *llink, *rlink;
} node_t;

#ifndef __DECONST
#define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var))
#endif

/*
* find or insert datum into search tree
*
Expand Down Expand Up @@ -61,7 +57,7 @@ rk_tsearch(const void *vkey, void **vrootp,
if (q != 0) { /* make new node */
*rootp = q; /* link new node to old */
/* LINTED const castaway ok */
q->key = __DECONST(void *, vkey); /* initialize new node */
q->key = rk_UNCONST(vkey); /* initialize new node */
q->llink = q->rlink = NULL;
}
return q;
Expand Down

0 comments on commit 43a34f6

Please sign in to comment.