| 1 | #include "dthdr.h" |
|---|---|
| 2 | |
| 3 | /* Walk a dictionary and all dictionaries viewed through it. |
| 4 | ** userf: user function |
| 5 | ** |
| 6 | ** Written by Kiem-Phong Vo (5/25/96) |
| 7 | */ |
| 8 | |
| 9 | int dtwalk(reg Dt_t* dt, int (*userf)(Dt_t*, void*, void*), void* data) |
| 10 | { |
| 11 | reg void *obj, *next; |
| 12 | reg Dt_t* walk; |
| 13 | reg int rv; |
| 14 | |
| 15 | for(obj = dtfirst(dt); obj; ) |
| 16 | { if(!(walk = dt->walk) ) |
| 17 | walk = dt; |
| 18 | next = dtnext(dt,obj); |
| 19 | if((rv = (*userf)(walk, obj, data )) < 0) |
| 20 | return rv; |
| 21 | obj = next; |
| 22 | } |
| 23 | return 0; |
| 24 | } |
| 25 |