ObjC and `glib.h'



Hi,

The new `GHook' struct has a member named `id', which seems to be an
Objective-C keyword (Elliot?).  I renamed it to `hook_id'.  Here's a
patch that fixes glib.h and ghook.c.

  Index: ghook.c
  ===================================================================
  RCS file: /debian/home/gnomecvs/glib/ghook.c,v
  retrieving revision 1.1
  diff -u -r1.1 ghook.c
  --- ghook.c	1998/09/30 08:56:00	1.1
  +++ ghook.c	1998/10/02 04:46:42
  @@ -90,7 +90,7 @@
     hook->prev = NULL;
     hook->flags = G_HOOK_ACTIVE;
     hook->ref_count = 0;
  -  hook->id = 0;
  +  hook->hook_id = 0;
     hook->func = NULL;
     hook->destroy = NULL;

  @@ -116,9 +116,9 @@
     g_return_if_fail (hook_list != NULL);
     g_return_if_fail (hook != NULL);

  -  if (hook->id)
  +  if (hook->hook_id)
       {
  -      hook->id = 0;
  +      hook->hook_id = 0;
	 hook->flags &= ~G_HOOK_ACTIVE;
	 if (hook->destroy)
	  {
  @@ -162,7 +162,7 @@
     hook->ref_count--;
     if (!hook->ref_count)
       {
  -      g_return_if_fail (hook->id == 0);
  +      g_return_if_fail (hook->hook_id == 0);
	 g_return_if_fail (!G_HOOK_IS_IN_CALL (hook));

	 if (hook->prev)
  @@ -218,7 +218,7 @@
     g_return_if_fail (G_HOOK_IS_UNLINKED (hook));
     g_return_if_fail (hook->func != NULL);

  -  hook->id = hook_list->seq_id++;
  +  hook->hook_id = hook_list->seq_id++;
     hook->ref_count = 1; /* counterpart to g_hook_destroy_link */

     if (sibling)
  @@ -408,17 +408,17 @@

   GHook*
   g_hook_get (GHookList *hook_list,
  -	    guint      id)
  +	    guint      hook_id)
   {
     GHook *hook;

     g_return_val_if_fail (hook_list != NULL, NULL);
  -  g_return_val_if_fail (id > 0, NULL);
  +  g_return_val_if_fail (hook_id > 0, NULL);

     hook = hook_list->hooks;
     while (hook)
       {
  -      if (hook->id == id)
  +      if (hook->hook_id == hook_id)
	  return hook;
	 hook = hook->next;
       }
  @@ -444,7 +444,7 @@

	 g_hook_ref (hook_list, hook);

  -      if (func (hook, data) && hook->id && (!need_valids || G_HOOK_IS_ACTIVE (hook)))
  +      if (func (hook, data) && hook->hook_id && (!need_valids || G_HOOK_IS_ACTIVE (hook)))
	  {
	    g_hook_unref (hook_list, hook);

  @@ -470,7 +470,7 @@
     hook = g_hook_first_valid (hook_list);
     while (hook)
       {
  -      if (hook->data == data && hook->id && (!need_valids || G_HOOK_IS_ACTIVE (hook)))
  +      if (hook->data == data && hook->hook_id && (!need_valids || G_HOOK_IS_ACTIVE (hook)))
	  return hook;

	 hook = g_hook_next_valid (hook);
  @@ -492,7 +492,7 @@
     hook = g_hook_first_valid (hook_list);
     while (hook)
       {
  -      if (hook->func == func && hook->id && (!need_valids || G_HOOK_IS_ACTIVE (hook)))
  +      if (hook->func == func && hook->hook_id && (!need_valids || G_HOOK_IS_ACTIVE (hook)))
	  return hook;

	 hook = g_hook_next_valid (hook);
  @@ -515,7 +515,7 @@
     hook = g_hook_first_valid (hook_list);
     while (hook)
       {
  -      if (hook->data == data && hook->func == func && hook->id && (!need_valids || G_HOOK_IS_ACTIVE (hook)))
  +      if (hook->data == data && hook->func == func && hook->hook_id && (!need_valids || G_HOOK_IS_ACTIVE (hook)))
	  return hook;

	 hook = g_hook_next_valid (hook);
  @@ -545,7 +545,7 @@
	 register GHook *tmp;

	 g_hook_ref (hook_list, sibling);
  -      if (func (hook, sibling) <= 0 && sibling->id)
  +      if (func (hook, sibling) <= 0 && sibling->hook_id)
	  {
	    g_hook_unref (hook_list, sibling);
	    break;
  @@ -562,5 +562,5 @@
   g_hook_compare_ids (GHook *new_hook,
		      GHook *sibling)
   {
  -  return ((glong) new_hook->id) - ((glong) sibling->id);
  +  return ((glong) new_hook->hook_id) - ((glong) sibling->hook_id);
   }
  Index: glib.h
  ===================================================================
  RCS file: /debian/home/gnomecvs/glib/glib.h,v
  retrieving revision 1.49
  diff -u -r1.49 glib.h
  --- glib.h	1998/09/30 08:56:00	1.49
  +++ glib.h	1998/10/02 04:46:55
  @@ -1030,7 +1030,7 @@
     GHook		*next;
     GHook		*prev;
     guint		 ref_count;
  -  guint		 id;
  +  guint		 hook_id;
     guint		 flags;
     gpointer	 func;
     GDestroyNotify destroy;
  @@ -1040,11 +1040,11 @@
					    G_HOOK_ACTIVE) != 0)
   #define	G_HOOK_IS_IN_CALL(hook)		((((GHook*) hook)->flags & \
					    G_HOOK_IN_CALL) != 0)
  -#define G_HOOK_IS_VALID(hook)		(((GHook*) hook)->id != 0 && \
  +#define G_HOOK_IS_VALID(hook)		(((GHook*) hook)->hook_id != 0 && \
					   G_HOOK_IS_ACTIVE (hook))
   #define G_HOOK_IS_UNLINKED(hook)	(((GHook*) hook)->next == NULL && \
					   ((GHook*) hook)->prev == NULL && \
  -					 ((GHook*) hook)->id == 0 && \
  +					 ((GHook*) hook)->hook_id == 0 && \
					   ((GHook*) hook)->ref_count == 0)

   void	 g_hook_list_init		(GHookList		*hook_list,
  @@ -1058,7 +1058,7 @@
   void	 g_hook_unref			(GHookList		*hook_list,
					   GHook			*hook);
   gboolean g_hook_destroy			(GHookList		*hook_list,
  -					 guint			 id);
  +					 guint			 hook_id);
   void	 g_hook_destroy_link		(GHookList		*hook_list,
					   GHook			*hook);
 void	 g_hook_prepend			(GHookList		*hook_list,

- Hari
-- 
Raja R Harinath ------------------------------ harinath@cs.umn.edu
"When all else fails, read the instructions."      -- Cahn's Axiom
"Our policy is, when in doubt, do the right thing."   -- Roy L Ash



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]