X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Ffunctional%2Fsearch_hsearch.c;h=dc1538e2f32ab37f18feec34f4a01e8eb11f42f3;hb=7db62468cafb67f1360936525c432efdefa3065e;hp=0bd65291513005863e7e87f473aa11df3ebce298;hpb=132e3876a5bf16f33a059908269c3b9b8b458924;p=libc-test diff --git a/src/functional/search_hsearch.c b/src/functional/search_hsearch.c index 0bd6529..dc1538e 100644 --- a/src/functional/search_hsearch.c +++ b/src/functional/search_hsearch.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -12,6 +13,8 @@ #define get(k) hsearch((ENTRY){.key = k, .data = 0}, FIND) +#define getdata(e) ((intptr_t)(e)->data) + int main() { ENTRY *e; @@ -35,14 +38,14 @@ int main() if (get("c")) t_error("hsearch FIND c should fail\n"); set("g", 10); - if (e && (int)(e->data) != 7) - t_error("hsearch ENTER g 10 returned data %d, wanted 7\n", (int)(e->data)); + if (e && getdata(e) != 7) + t_error("hsearch ENTER g 10 returned data %d, wanted 7\n", getdata(e)); set("g", 10); - if (e && (int)(e->data) != 7) - t_error("hsearch ENTER g 10 returned data %d, wanted 7\n", (int)(e->data)); + if (e && getdata(e) != 7) + t_error("hsearch ENTER g 10 returned data %d, wanted 7\n", getdata(e)); set("j", 10); - if (e && (int)(e->data) != 10) - t_error("hsearch ENTER j 10 returned data %d, wanted 10\n", (int)(e->data)); + if (e && getdata(e) != 10) + t_error("hsearch ENTER j 10 returned data %d, wanted 10\n", getdata(e)); hdestroy(); return t_status; }