[Cogl] [PATCH 1/2] cogl: Don't expose longs in the API (1/2)
Robert Bragg
robert at sixbynine.org
Mon Oct 1 05:42:51 PDT 2012
This looks good to land to me:
Reviewed-by: Robert Bragg <robert at linux.intel.com>
thanks,
- Robert
On Sun, Sep 30, 2012 at 2:39 AM, Damien Lespiau
<damien.lespiau at gmail.com> wrote:
> From: Damien Lespiau <damien.lespiau at intel.com>
>
> unsigned long have quite a bad property in that they have different
> sizes on 64 bits platforms depending on if you are on Linux (LP64) or on
> Windows (LLP64).
>
> This makes writing bindings for the CLR really hard as it only has fixed
> types and no types which size would depend on the platform.
>
> As the longs exposed in Cogl don't seem to need to be 64 bits
> on 64 bits platforms, let's just use ints instead. Well, actually, even
> if you wanted to use the 64 bits of longs and not care about Windows,
> you couldn't because the API also has to work on Linux 32 bits.
>
> Let's start by changing the type of the variable storing the number of
> instances alive (per object type) to an int.
> ---
> cogl/cogl-object-private.h | 2 +-
> cogl/cogl-object.c | 4 ++--
> cogl/cogl-object.h | 2 +-
> 3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/cogl/cogl-object-private.h b/cogl/cogl-object-private.h
> index 5510c8e..d145f31 100644
> --- a/cogl/cogl-object-private.h
> +++ b/cogl/cogl-object-private.h
> @@ -117,7 +117,7 @@ struct _CoglObject
> #define COGL_OBJECT_COMMON_DEFINE_WITH_CODE(TypeName, type_name, code) \
> \
> CoglObjectClass _cogl_##type_name##_class; \
> -static unsigned long _cogl_object_##type_name##_count; \
> +static unsigned int _cogl_object_##type_name##_count; \
> \
> static inline void \
> _cogl_object_##type_name##_inc (void) \
> diff --git a/cogl/cogl-object.c b/cogl/cogl-object.c
> index 1ec2e8d..d502356 100644
> --- a/cogl/cogl-object.c
> +++ b/cogl/cogl-object.c
> @@ -239,7 +239,7 @@ cogl_debug_object_foreach_type (CoglDebugObjectForeachTypeCallback func,
> void *user_data)
> {
> GHashTableIter iter;
> - unsigned long *instance_count;
> + unsigned int *instance_count;
> CoglDebugObjectTypeInfo info;
>
> g_hash_table_iter_init (&iter, _cogl_debug_instances);
> @@ -256,7 +256,7 @@ static void
> print_instances_cb (const CoglDebugObjectTypeInfo *info,
> void *user_data)
> {
> - g_print ("\t%s: %lu\n", info->name, info->instance_count);
> + g_print ("\t%s: %u\n", info->name, info->instance_count);
> }
>
> void
> diff --git a/cogl/cogl-object.h b/cogl/cogl-object.h
> index a65bd9c..a0e099e 100644
> --- a/cogl/cogl-object.h
> +++ b/cogl/cogl-object.h
> @@ -117,7 +117,7 @@ typedef void (*CoglUserDataDestroyCallback) (void *user_data);
> typedef struct
> {
> const char *name;
> - unsigned long instance_count;
> + unsigned int instance_count;
> } CoglDebugObjectTypeInfo;
>
> /**
> --
> 1.7.7.5
>
> _______________________________________________
> Cogl mailing list
> Cogl at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/cogl
More information about the Cogl
mailing list