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:

committed by
Jeffrey Altman

parent
f0d9289d86
commit
43a34f6663
@@ -24,10 +24,6 @@ typedef struct node {
|
|||||||
struct node *llink, *rlink;
|
struct node *llink, *rlink;
|
||||||
} node_t;
|
} node_t;
|
||||||
|
|
||||||
#ifndef __DECONST
|
|
||||||
#define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* find or insert datum into search tree
|
* find or insert datum into search tree
|
||||||
*
|
*
|
||||||
@@ -61,7 +57,7 @@ rk_tsearch(const void *vkey, void **vrootp,
|
|||||||
if (q != 0) { /* make new node */
|
if (q != 0) { /* make new node */
|
||||||
*rootp = q; /* link new node to old */
|
*rootp = q; /* link new node to old */
|
||||||
/* LINTED const castaway ok */
|
/* 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;
|
q->llink = q->rlink = NULL;
|
||||||
}
|
}
|
||||||
return q;
|
return q;
|
||||||
|
Reference in New Issue
Block a user