[ofw] [RFC] 2/5: IB ACM: windows abstractions
Fab Tillier
ftillier at microsoft.com
Wed Sep 16 23:35:07 PDT 2009
> -----Original Message-----
> From: ofw-bounces at lists.openfabrics.org [mailto:ofw-
> bounces at lists.openfabrics.org] On Behalf Of Sean Hefty
> Sent: Wednesday, September 16, 2009 11:28 PM
> To: Hefty, Sean; ofw at lists.openfabrics.org; OpenFabrics General
> Subject: [ofw] [RFC] 2/5: IB ACM: windows abstractions
>
> The following abstractions are defined to support the IB ACM running on
> Windows.
>
> An attempt was made to limit the number of dependencies on external
> libraries,
> such as complib. We add Windows support for the Linux 'search' binary
> tree interfaces. This is implemented on Windows using complib
> fleximap, but
> gets linked in statically.
Should we make complib a static library? I don't know if the memory savings are that great when most users only use a fraction of the complib functionality. If I have time I'll take a look at file sizes and report back.
> void *tsearch(const void *key, void **rootp,
> int (*compar)(const void *, const void *))
> {
> cl_fmap_item_t *item, *map_item;
>
> if (!*rootp) {
> *rootp = malloc(sizeof(cl_fmap_t));
You need to check that malloc returned you memory.
> cl_fmap_init((cl_fmap_t *) *rootp, fcompare);
> }
>
> compare = compar;
> item = malloc(sizeof(cl_fmap_item_t));
Ditto.
> map_item = cl_fmap_insert((cl_fmap_t *) *rootp, key, item);
> if (map_item != item)
> free(item);
>
> return (void *) &map_item->p_key;
> }
-Fab
More information about the ofw
mailing list