Hi,

On Wed, Dec 10, 2008 at 09:40:56PM -0500, Davin Flatten wrote:
> 2008/12/10 Dejan Muhamedagic <[EMAIL PROTECTED]>
> 
> > Hi,
> >
> > On Sun, Dec 07, 2008 at 03:47:26PM -0500, Davin Flatten wrote:
> > > Hello-
> > >
> > > Let me preface this post saying I am not a C programming expert.  I am
> > > working on setting up an environment to do some pacemaker GUI
> > development.
> > > I am using the tip of the Heartbeat dev Mercurial repository.  My
> > platform
> > > is CentOS 5.2.
> > >
> > > There seems to be a pointer definition inconsistancy in the pils library
> > > that is causing warnings on the build, and thus errors.  It seems that
> > the
> > > definition of PILPluginImportSet using g_malloc when the PILPluginImports
> > > defintion using the standard alloc definition.  This is also true for the
> > > mrealloc definition below.
> > >
> > > I changed the defintions to use the glib2.0 format and that fixed the
> > > problem, but I am unsure if this might break builds on other platforms.
> > > Either way attached is the diff of the changes I made if you wish to
> > apply
> > > them.
> > >
> > > P.S. A warning/error is also created by tools/send_arp.linux.c by not
> > > declaring const on the char *device="eth0" declaration.
> >
> > The patch you supplied didn't work on opensuse 11.0. Could you
> > try the one attached here.
> >
> > Thanks,
> >
> > Dejan
> >
> > > Thanks!
> > > Davin Flatten
> >
> >
> > > _______________________________________________________
> > > Linux-HA-Dev: [email protected]
> > > http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> > > Home Page: http://linux-ha.org/
> >
> >
> > _______________________________________________________
> > Linux-HA-Dev: [email protected]
> > http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> > Home Page: http://linux-ha.org/
> >
> >
> Dejan-
> 
> Looks like the definitions of g_malloc and g_realloc changes from minor
> version 14 -> 16.  Redhat 5.2 uses the 2.12.3 so using the gsize format
> doesn't compile.  I added some preprocessor directives to define these areas
> of code correctly depending on the glib version.  Does this patch work for
> you?

Yes, it does. Though it'd be better to create an extra header
to hide #ifdefs of the glib type du jour from the code.

Cheers,

Dejan

> Thanks!
> Davin

> diff -r f343aa2db1a4 include/pils/plugin.h.in
> --- a/include/pils/plugin.h.in        Wed Dec 10 17:25:09 2008 +0100
> +++ b/include/pils/plugin.h.in        Wed Dec 10 21:34:16 2008 -0500
> @@ -442,9 +442,14 @@
>       ,       void*   plugin_private);
>  
>       void    (*log)  (PILLogLevel priority, const char * fmt, ...);
> -     void*   (*alloc)(size_t size);
> -     void*   (*mrealloc)(void * ptr, size_t size);
> -     void    (*mfree)(void* space);
> +#if GLIB_MINOR_VERSION <= 14
> +        gpointer (*alloc)(gulong size);
> +        gpointer (*mrealloc)(gpointer space, gulong size);
> +#else
> +        gpointer (*alloc)(gsize size);
> +        gpointer (*mrealloc)(gpointer space, gsize size);
> +#endif
> +     void    (*mfree)(gpointer space);
>       char*   (*mstrdup)(const char *s);
>  };
>  
> @@ -465,8 +470,13 @@
>  
>  /* Change memory allocation functions right after creating universe */
>  void PilPluginUnivSetMemalloc(PILPluginUniv*
> -,    void*   (*alloc)(size_t size)
> -,    void*   (*mrealloc)(void *, size_t size)
> +#if GLIB_MINOR_VERSION <= 14
> +,       gpointer (*alloc)(gulong size)
> +,       gpointer (*mrealloc)(gpointer, gulong size)
> +#else
> +,       gpointer (*alloc)(gsize size)
> +,       gpointer (*mrealloc)(gpointer, gsize size)
> +#endif
>  ,    void    (*mfree)(void* space)
>  ,    char*   (*mstrdup)(const char *s));
>  
> diff -r f343aa2db1a4 lib/pils/pils.c
> --- a/lib/pils/pils.c Wed Dec 10 17:25:09 2008 +0100
> +++ b/lib/pils/pils.c Wed Dec 10 21:34:16 2008 -0500
> @@ -492,8 +492,13 @@
>  /* Change memory allocation functions immediately  after creating universe */
>  void
>  PilPluginUnivSetMemalloc(PILPluginUniv* u
> -,    void*   (*allocfun)(size_t size)
> -,    void*   (*reallocfun)(void * ptr, size_t size)
> +#if GLIB_MINOR_VERSION <= 14
> +,    gpointer        (*allocfun)(gulong size)
> +,    gpointer        (*reallocfun)(gpointer ptr, gulong size)
> +#else
> +,    gpointer        (*allocfun)(gsize size)
> +,    gpointer        (*reallocfun)(gpointer ptr, gsize size)
> +#endif
>  ,    void    (*freefun)(void* space)
>  ,    char*   (*strdupfun)(const char *s))
>  {
> diff -r f343aa2db1a4 tools/send_arp.linux.c
> --- a/tools/send_arp.linux.c  Wed Dec 10 17:25:09 2008 +0100
> +++ b/tools/send_arp.linux.c  Wed Dec 10 21:34:16 2008 -0500
> @@ -35,7 +35,7 @@
>  static void usage(void) __attribute__((noreturn));
>  
>  int quit_on_reply=0;
> -char *device = NULL;
> +const char *device = NULL;
>  int ifindex;
>  char *source;
>  struct in_addr src, dst;

> _______________________________________________________
> Linux-HA-Dev: [email protected]
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/

_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to