Open MPI logo

Hardware Locality Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Hardware Locality Development mailing list

Subject: Re: [hwloc-devel] The de-C99 of hwloc
From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2011-02-18 10:52:04


On Feb 17, 2011, at 6:53 PM, Samuel Thibault wrote:

> Jeff Squyres, le Thu 17 Feb 2011 23:15:26 +0100, a écrit :
>> - uint64_t cacheconfig[n];
>> - uint32_t cacheconfig32[n];
>> - uint64_t cachesize[n];
>> + uint64_t *cacheconfig = NULL;
>> + uint64_t *cachesize = NULL;
>> + uint32_t *cacheconfig32 = NULL;
>>
>> + cacheconfig = malloc(sizeof(uint64_t) * n * 2);
>> + if (NULL == cacheconfig) {
>> + goto out;
>> + }
>> + cachesize = cacheconfig + n;
>
> I'm not really fond of allocating for two pointers like this.

Ok, I've changed it to 2 mallocs.

>> hwloc_linux_get_pid_cpubind(hwloc_topology_t topology, pid_t pid, hwloc_bitmap_t hwloc_set, int flags)
>> {
>> hwloc_bitmap_t tidset = hwloc_bitmap_alloc();
>> - hwloc_bitmap_t cpusets[2] = { hwloc_set, tidset };
>
> Ow, even that is not allowed before C99?!

No -- they're not constant. :-(

-- 
Jeff Squyres
jsquyres_at_[hidden]
For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/