Per XSI5, make ENTRY.data a typeless pointer.

This commit is contained in:
kleink 1999-02-16 18:23:00 +00:00
parent 983e1024bf
commit 276331d152
2 changed files with 11 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: search.h,v 1.10 1999/02/16 18:12:24 kleink Exp $ */ /* $NetBSD: search.h,v 1.11 1999/02/16 18:23:01 kleink Exp $ */
/* /*
* Written by J.T. Conklin <jtc@netbsd.org> * Written by J.T. Conklin <jtc@netbsd.org>
@ -7,6 +7,7 @@
#ifndef _SEARCH_H_ #ifndef _SEARCH_H_
#define _SEARCH_H_ #define _SEARCH_H_
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include <machine/ansi.h> #include <machine/ansi.h>
@ -17,7 +18,7 @@ typedef _BSD_SIZE_T_ size_t;
typedef struct entry { typedef struct entry {
char *key; char *key;
char *data; void *data;
} ENTRY; } ENTRY;
typedef enum { typedef enum {
@ -54,4 +55,4 @@ extern void *tsearch __P((const void *, void **,
extern void twalk __P((const void *, void (*)(const void *, VISIT, int))); extern void twalk __P((const void *, void (*)(const void *, VISIT, int)));
__END_DECLS __END_DECLS
#endif #endif /* !_SEARCH_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: hsearch.c,v 1.13 1999/02/16 18:12:24 kleink Exp $ */ /* $NetBSD: hsearch.c,v 1.14 1999/02/16 18:23:00 kleink Exp $ */
/*- /*-
* Copyright (c) 1990, 1993 * Copyright (c) 1990, 1993
@ -41,7 +41,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)hsearch.c 8.4 (Berkeley) 7/21/94"; static char sccsid[] = "@(#)hsearch.c 8.4 (Berkeley) 7/21/94";
#else #else
__RCSID("$NetBSD: hsearch.c,v 1.13 1999/02/16 18:12:24 kleink Exp $"); __RCSID("$NetBSD: hsearch.c,v 1.14 1999/02/16 18:23:00 kleink Exp $");
#endif #endif
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
@ -82,12 +82,12 @@ hsearch(item, action)
if (!dbp) if (!dbp)
return (NULL); return (NULL);
key.data = (u_char *)item.key; key.data = item.key;
key.size = strlen(item.key) + 1; key.size = strlen((char *)item.key) + 1;
if (action == ENTER) { if (action == ENTER) {
val.data = (u_char *)item.data; val.data = item.data;
val.size = strlen(item.data) + 1; val.size = strlen((char *)item.data) + 1;
status = (dbp->put)(dbp, &key, &val, R_NOOVERWRITE); status = (dbp->put)(dbp, &key, &val, R_NOOVERWRITE);
if (status) if (status)
return (NULL); return (NULL);
@ -97,7 +97,7 @@ hsearch(item, action)
if (status) if (status)
return (NULL); return (NULL);
else else
item.data = (char *)val.data; item.data = val.data;
} }
retval.key = item.key; retval.key = item.key;
retval.data = item.data; retval.data = item.data;