roken: tsearch use rk_UNCONST instead of __DECONST #307

The rk_UNCONST macro exists because neither __DECONST nor uintptr_t
are available on all platforms (for example, AIX).

Change-Id: Ie36f0dd7a9ce454d411761ee4dbd6fc1f7c6692c
This commit is contained in:
Jeffrey Altman
2019-02-21 14:34:08 -05:00
committed by Jeffrey Altman
parent f0d9289d86
commit 43a34f6663

View File

@@ -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
*
@@ -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;