[PATCH 2/3] wayland-client: Introduce shm pool helper function

Andre Heider a.heider at gmail.com
Tue Aug 7 06:15:16 PDT 2012


On Tue, Aug 7, 2012 at 2:03 PM, Ander Conselvan de Oliveira
<conselvan2 at gmail.com> wrote:
>> +#include "../shared/os-compatibility.h"
>
> You should have the Makefile set -I$(top_srcdir)/shared so you can do just
>
>   #include "os-compatibility.h",
>
> but I think we don't need a libshared in this particular case.

Will do if we drop libshared.

>> +WL_EXPORT void *
>> +wl_shm_pool_helper_allocate(struct wl_shm_pool_helper *pool, int32_t
>> size,
>> +                           int32_t *offset)
>
>
> I don't think any one would want to allocate a pool bigger than 4GB, but we
> should use size_t for size and offset.

In fact I had size_t there initially, but changed it back to int32_t
again since wl_shm_create_pool() takes an int32_t as size argument ;)

>> +       if (pool->used + size > pool->size) {
>> +               if (offset)
>> +                       *offset = 0;
>
>
> If the allocation fails offset is undefined but zero is a valid offset. The
> user should just check for NULL and we leave offset alone if the allocation
> fails.

Agreed, that doesn't make much sense. Will drop those 2 lines.

> Cheers,
> Ander

Thanks,
Andre


More information about the wayland-devel mailing list