- Add the 'restrict' qualifier to match the IEEE Std 1003.1-2001

prototype of the tdelete(3) function.
 - Remove duplicated space.
 - Use an ANSI-C function definition for tdelete(3).
 - Update the manual page.
This commit is contained in:
Robert Drehmel 2002-08-14 21:16:41 +00:00
parent 33f9b60eee
commit 840b798c83
3 changed files with 13 additions and 8 deletions

View File

@ -44,7 +44,8 @@ __BEGIN_DECLS
int hcreate(size_t);
void hdestroy(void);
ENTRY *hsearch(ENTRY, ACTION);
void *tdelete(const void *, void **, int (*)(const void *, const void *));
void *tdelete(const void *__restrict, void **__restrict,
int (*)(const void *, const void *));
void *tfind(const void *, void **, int (*)(const void *, const void *));
void *tsearch(const void *, void **, int (*)(const void *, const void *));
void twalk(const void *, void (*)(const void *, VISIT, int));

View File

@ -25,16 +25,20 @@ __FBSDID("$FreeBSD$");
#include <stdlib.h>
/* delete node with given key */
/*
* delete node with given key
*
* vkey: key to be deleted
* vrootp: address of the root of the tree
* compar: function to carry out node comparisons
*/
void *
tdelete(vkey, vrootp, compar)
const void *vkey; /* key to be deleted */
void **vrootp; /* address of the root of tree */
int (*compar)(const void *, const void *);
tdelete(const void *__restrict vkey, void **__restrict vrootp,
int (*compar)(const void *, const void *))
{
node_t **rootp = (node_t **)vrootp;
node_t *p, *q, *r;
int cmp;
int cmp;
if (rootp == NULL || (p = *rootp) == NULL)
return NULL;

View File

@ -36,7 +36,7 @@
.Sh SYNOPSIS
.In search.h
.Ft void *
.Fn tdelete "const void *key" "void **rootp" "int (*compar) (const void *, const void *)"
.Fn tdelete "const void *restrict key" "void **restrict rootp" "int (*compar) (const void *, const void *)"
.Ft void *
.Fn tfind "const void *key" "void **rootp" "int (*compar) (const void *, const void *)"
.Ft void *