Initial import of the CDE 2.1.30 sources from the Open Group.
This commit is contained in:
91
cde/programs/dtksh/ksh93/src/lib/libast/hash/hashwalk.c
Normal file
91
cde/programs/dtksh/ksh93/src/lib/libast/hash/hashwalk.c
Normal file
@@ -0,0 +1,91 @@
|
||||
/* $XConsortium: hashwalk.c /main/3 1995/11/01 17:33:39 rswiston $ */
|
||||
/***************************************************************
|
||||
* *
|
||||
* AT&T - PROPRIETARY *
|
||||
* *
|
||||
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
|
||||
* AT&T CORP. *
|
||||
* *
|
||||
* Copyright (c) 1995 AT&T Corp. *
|
||||
* All Rights Reserved *
|
||||
* *
|
||||
* This software is licensed by AT&T Corp. *
|
||||
* under the terms and conditions of the license in *
|
||||
* http://www.research.att.com/orgs/ssr/book/reuse *
|
||||
* *
|
||||
* This software was created by the *
|
||||
* Software Engineering Research Department *
|
||||
* AT&T Bell Laboratories *
|
||||
* *
|
||||
* For further information contact *
|
||||
* gsf@research.att.com *
|
||||
* *
|
||||
***************************************************************/
|
||||
|
||||
/* : : generated by proto : : */
|
||||
|
||||
#if !defined(__PROTO__)
|
||||
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
|
||||
#if defined(__cplusplus)
|
||||
#define __MANGLE__ "C"
|
||||
#else
|
||||
#define __MANGLE__
|
||||
#endif
|
||||
#define __STDARG__
|
||||
#define __PROTO__(x) x
|
||||
#define __OTORP__(x)
|
||||
#define __PARAM__(n,o) n
|
||||
#if !defined(__STDC__) && !defined(__cplusplus)
|
||||
#if !defined(c_plusplus)
|
||||
#define const
|
||||
#endif
|
||||
#define signed
|
||||
#define void int
|
||||
#define volatile
|
||||
#define __V_ char
|
||||
#else
|
||||
#define __V_ void
|
||||
#endif
|
||||
#else
|
||||
#define __PROTO__(x) ()
|
||||
#define __OTORP__(x) x
|
||||
#define __PARAM__(n,o) o
|
||||
#define __MANGLE__
|
||||
#define __V_ char
|
||||
#define const
|
||||
#define signed
|
||||
#define void int
|
||||
#define volatile
|
||||
#endif
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
#define __VARARG__ ...
|
||||
#else
|
||||
#define __VARARG__
|
||||
#endif
|
||||
#if defined(__STDARG__)
|
||||
#define __VA_START__(p,a) va_start(p,a)
|
||||
#else
|
||||
#define __VA_START__(p,a) va_start(p)
|
||||
#endif
|
||||
#endif
|
||||
#include "hashlib.h"
|
||||
|
||||
/*
|
||||
* apply walker to each active bucket in the table
|
||||
*/
|
||||
|
||||
int
|
||||
hashwalk __PARAM__((Hash_table_t* tab, int flags, register(*walker)(const char*, char*, __V_*), __V_* handle), (tab, flags, walker, handle)) __OTORP__(Hash_table_t* tab; int flags; register(*walker)(); __V_* handle;){
|
||||
register Hash_bucket_t* b;
|
||||
register int v;
|
||||
Hash_position_t* pos;
|
||||
|
||||
if (!(pos = hashscan(tab, flags))) return(-1);
|
||||
hash_info.table = tab->root->last.table = tab;
|
||||
v = 0;
|
||||
while (b = hashnext(pos))
|
||||
if ((v = (*walker)(hashname(b), (tab->flags & HASH_VALUE) ? b->value : (char*)b, handle)) < 0)
|
||||
break;
|
||||
hashdone(pos);
|
||||
return(v);
|
||||
}
|
||||
Reference in New Issue
Block a user