mirror of
				https://gitlab.gnome.org/GNOME/glib.git
				synced 2025-10-31 00:12:19 +01:00 
			
		
		
		
	use g_str_hash() algorithm to generate hashes.
Thu May 10 15:19:01 2001 Tim Janik <timj@gtk.org> * gscanner.c (g_scanner_key_hash): use g_str_hash() algorithm to generate hashes. * gmem.c (standard_calloc): free() doesn't return a value (Mark Murnane). Thu May 10 14:00:48 2001 Tim Janik <timj@gtk.org> * gparamspecs.[hc]: removed g_param_spec_stringc() in lack of evidence of public need. * gsignal.h: added g_signal_disconnect_by_func(), g_signal_block_by_func() and g_signal_unblock_by_func() convenience macros as per owen's request. * gtype.c (SIZEOF_FUNDAMENTAL_INFO): align sizeof (GTypeFundamentalInfo) to size of longs and pointers.
This commit is contained in:
		| @@ -1,3 +1,11 @@ | |||||||
|  | Thu May 10 15:19:01 2001  Tim Janik  <timj@gtk.org> | ||||||
|  |  | ||||||
|  | 	* gscanner.c (g_scanner_key_hash): use g_str_hash() algorithm | ||||||
|  | 	to generate hashes. | ||||||
|  |  | ||||||
|  | 	* gmem.c (standard_calloc): free() doesn't return a value | ||||||
|  | 	(Mark Murnane). | ||||||
|  |  | ||||||
| 2001-04-26  Havoc Pennington  <hp@redhat.com> | 2001-04-26  Havoc Pennington  <hp@redhat.com> | ||||||
|  |  | ||||||
| 	* configure.in: Get rid of --enable-msg-prefix | 	* configure.in: Get rid of --enable-msg-prefix | ||||||
|   | |||||||
| @@ -1,3 +1,11 @@ | |||||||
|  | Thu May 10 15:19:01 2001  Tim Janik  <timj@gtk.org> | ||||||
|  |  | ||||||
|  | 	* gscanner.c (g_scanner_key_hash): use g_str_hash() algorithm | ||||||
|  | 	to generate hashes. | ||||||
|  |  | ||||||
|  | 	* gmem.c (standard_calloc): free() doesn't return a value | ||||||
|  | 	(Mark Murnane). | ||||||
|  |  | ||||||
| 2001-04-26  Havoc Pennington  <hp@redhat.com> | 2001-04-26  Havoc Pennington  <hp@redhat.com> | ||||||
|  |  | ||||||
| 	* configure.in: Get rid of --enable-msg-prefix | 	* configure.in: Get rid of --enable-msg-prefix | ||||||
|   | |||||||
| @@ -1,3 +1,11 @@ | |||||||
|  | Thu May 10 15:19:01 2001  Tim Janik  <timj@gtk.org> | ||||||
|  |  | ||||||
|  | 	* gscanner.c (g_scanner_key_hash): use g_str_hash() algorithm | ||||||
|  | 	to generate hashes. | ||||||
|  |  | ||||||
|  | 	* gmem.c (standard_calloc): free() doesn't return a value | ||||||
|  | 	(Mark Murnane). | ||||||
|  |  | ||||||
| 2001-04-26  Havoc Pennington  <hp@redhat.com> | 2001-04-26  Havoc Pennington  <hp@redhat.com> | ||||||
|  |  | ||||||
| 	* configure.in: Get rid of --enable-msg-prefix | 	* configure.in: Get rid of --enable-msg-prefix | ||||||
|   | |||||||
| @@ -1,3 +1,11 @@ | |||||||
|  | Thu May 10 15:19:01 2001  Tim Janik  <timj@gtk.org> | ||||||
|  |  | ||||||
|  | 	* gscanner.c (g_scanner_key_hash): use g_str_hash() algorithm | ||||||
|  | 	to generate hashes. | ||||||
|  |  | ||||||
|  | 	* gmem.c (standard_calloc): free() doesn't return a value | ||||||
|  | 	(Mark Murnane). | ||||||
|  |  | ||||||
| 2001-04-26  Havoc Pennington  <hp@redhat.com> | 2001-04-26  Havoc Pennington  <hp@redhat.com> | ||||||
|  |  | ||||||
| 	* configure.in: Get rid of --enable-msg-prefix | 	* configure.in: Get rid of --enable-msg-prefix | ||||||
|   | |||||||
| @@ -1,3 +1,11 @@ | |||||||
|  | Thu May 10 15:19:01 2001  Tim Janik  <timj@gtk.org> | ||||||
|  |  | ||||||
|  | 	* gscanner.c (g_scanner_key_hash): use g_str_hash() algorithm | ||||||
|  | 	to generate hashes. | ||||||
|  |  | ||||||
|  | 	* gmem.c (standard_calloc): free() doesn't return a value | ||||||
|  | 	(Mark Murnane). | ||||||
|  |  | ||||||
| 2001-04-26  Havoc Pennington  <hp@redhat.com> | 2001-04-26  Havoc Pennington  <hp@redhat.com> | ||||||
|  |  | ||||||
| 	* configure.in: Get rid of --enable-msg-prefix | 	* configure.in: Get rid of --enable-msg-prefix | ||||||
|   | |||||||
| @@ -1,3 +1,11 @@ | |||||||
|  | Thu May 10 15:19:01 2001  Tim Janik  <timj@gtk.org> | ||||||
|  |  | ||||||
|  | 	* gscanner.c (g_scanner_key_hash): use g_str_hash() algorithm | ||||||
|  | 	to generate hashes. | ||||||
|  |  | ||||||
|  | 	* gmem.c (standard_calloc): free() doesn't return a value | ||||||
|  | 	(Mark Murnane). | ||||||
|  |  | ||||||
| 2001-04-26  Havoc Pennington  <hp@redhat.com> | 2001-04-26  Havoc Pennington  <hp@redhat.com> | ||||||
|  |  | ||||||
| 	* configure.in: Get rid of --enable-msg-prefix | 	* configure.in: Get rid of --enable-msg-prefix | ||||||
|   | |||||||
| @@ -1,3 +1,11 @@ | |||||||
|  | Thu May 10 15:19:01 2001  Tim Janik  <timj@gtk.org> | ||||||
|  |  | ||||||
|  | 	* gscanner.c (g_scanner_key_hash): use g_str_hash() algorithm | ||||||
|  | 	to generate hashes. | ||||||
|  |  | ||||||
|  | 	* gmem.c (standard_calloc): free() doesn't return a value | ||||||
|  | 	(Mark Murnane). | ||||||
|  |  | ||||||
| 2001-04-26  Havoc Pennington  <hp@redhat.com> | 2001-04-26  Havoc Pennington  <hp@redhat.com> | ||||||
|  |  | ||||||
| 	* configure.in: Get rid of --enable-msg-prefix | 	* configure.in: Get rid of --enable-msg-prefix | ||||||
|   | |||||||
| @@ -1,3 +1,11 @@ | |||||||
|  | Thu May 10 15:19:01 2001  Tim Janik  <timj@gtk.org> | ||||||
|  |  | ||||||
|  | 	* gscanner.c (g_scanner_key_hash): use g_str_hash() algorithm | ||||||
|  | 	to generate hashes. | ||||||
|  |  | ||||||
|  | 	* gmem.c (standard_calloc): free() doesn't return a value | ||||||
|  | 	(Mark Murnane). | ||||||
|  |  | ||||||
| 2001-04-26  Havoc Pennington  <hp@redhat.com> | 2001-04-26  Havoc Pennington  <hp@redhat.com> | ||||||
|  |  | ||||||
| 	* configure.in: Get rid of --enable-msg-prefix | 	* configure.in: Get rid of --enable-msg-prefix | ||||||
|   | |||||||
| @@ -101,7 +101,7 @@ standard_realloc (gpointer mem, | |||||||
| static void | static void | ||||||
| standard_free (gpointer mem) | standard_free (gpointer mem) | ||||||
| { | { | ||||||
|   return free (mem); |   free (mem); | ||||||
| } | } | ||||||
| static gpointer | static gpointer | ||||||
| standard_calloc (gsize n_blocks, | standard_calloc (gsize n_blocks, | ||||||
|   | |||||||
| @@ -366,17 +366,7 @@ g_scanner_key_hash (gconstpointer v) | |||||||
|    |    | ||||||
|   h = key->scope_id; |   h = key->scope_id; | ||||||
|   for (c = key->symbol; *c; c++) |   for (c = key->symbol; *c; c++) | ||||||
|     { |     h = (h << 5) - h + *c; | ||||||
|       guint g; |  | ||||||
|        |  | ||||||
|       h = (h << 4) + *c; |  | ||||||
|       g = h & 0xf0000000; |  | ||||||
|       if (g) |  | ||||||
| 	{ |  | ||||||
| 	  h = h ^ (g >> 24); |  | ||||||
| 	  h = h ^ g; |  | ||||||
| 	} |  | ||||||
|     } |  | ||||||
|    |    | ||||||
|   return h; |   return h; | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								gmem.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								gmem.c
									
									
									
									
									
								
							| @@ -101,7 +101,7 @@ standard_realloc (gpointer mem, | |||||||
| static void | static void | ||||||
| standard_free (gpointer mem) | standard_free (gpointer mem) | ||||||
| { | { | ||||||
|   return free (mem); |   free (mem); | ||||||
| } | } | ||||||
| static gpointer | static gpointer | ||||||
| standard_calloc (gsize n_blocks, | standard_calloc (gsize n_blocks, | ||||||
|   | |||||||
| @@ -1,3 +1,15 @@ | |||||||
|  | Thu May 10 14:00:48 2001  Tim Janik  <timj@gtk.org> | ||||||
|  |  | ||||||
|  | 	* gparamspecs.[hc]: removed g_param_spec_stringc() in lack of | ||||||
|  | 	evidence of public need. | ||||||
|  |  | ||||||
|  | 	* gsignal.h: added g_signal_disconnect_by_func(), | ||||||
|  | 	g_signal_block_by_func() and g_signal_unblock_by_func() convenience | ||||||
|  | 	macros as per owen's request. | ||||||
|  |  | ||||||
|  | 	* gtype.c (SIZEOF_FUNDAMENTAL_INFO): align sizeof (GTypeFundamentalInfo) | ||||||
|  | 	to size of longs and pointers. | ||||||
|  |  | ||||||
| 2001-05-05  James Henstridge  <james@daa.com.au> | 2001-05-05  James Henstridge  <james@daa.com.au> | ||||||
|  |  | ||||||
| 	* Makefile.am: glib-mkenums is not a compiled program, so shouldn't | 	* Makefile.am: glib-mkenums is not a compiled program, so shouldn't | ||||||
|   | |||||||
| @@ -1577,31 +1577,6 @@ g_param_spec_string (const gchar *name, | |||||||
|   return G_PARAM_SPEC (sspec); |   return G_PARAM_SPEC (sspec); | ||||||
| } | } | ||||||
|  |  | ||||||
| GParamSpec* |  | ||||||
| g_param_spec_stringc (const gchar *name, |  | ||||||
| 		      const gchar *nick, |  | ||||||
| 		      const gchar *blurb, |  | ||||||
| 		      const gchar *default_value, |  | ||||||
| 		      GParamFlags  flags) |  | ||||||
| { |  | ||||||
|   GParamSpecString *sspec = g_param_spec_internal (G_TYPE_PARAM_STRING, |  | ||||||
| 						   name, |  | ||||||
| 						   nick, |  | ||||||
| 						   blurb, |  | ||||||
| 						   flags); |  | ||||||
|   g_free (sspec->default_value); |  | ||||||
|   sspec->default_value = g_strdup (default_value); |  | ||||||
|   g_free (sspec->cset_first); |  | ||||||
|   sspec->cset_first = g_strdup (G_CSET_a_2_z "_" G_CSET_A_2_Z); |  | ||||||
|   g_free (sspec->cset_nth); |  | ||||||
|   sspec->cset_nth = g_strdup (G_CSET_a_2_z |  | ||||||
| 			      "_0123456789" |  | ||||||
| 			      /* G_CSET_LATINS G_CSET_LATINC */ |  | ||||||
| 			      G_CSET_A_2_Z); |  | ||||||
|    |  | ||||||
|   return G_PARAM_SPEC (sspec); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| GParamSpec* | GParamSpec* | ||||||
| g_param_spec_param (const gchar *name, | g_param_spec_param (const gchar *name, | ||||||
| 		    const gchar *nick, | 		    const gchar *nick, | ||||||
|   | |||||||
| @@ -305,11 +305,6 @@ GParamSpec*	g_param_spec_string	 (const gchar	 *name, | |||||||
| 					  const gchar	 *blurb, | 					  const gchar	 *blurb, | ||||||
| 					  const gchar	 *default_value, | 					  const gchar	 *default_value, | ||||||
| 					  GParamFlags	  flags); | 					  GParamFlags	  flags); | ||||||
| GParamSpec*	g_param_spec_stringc	 (const gchar	 *name, |  | ||||||
| 					  const gchar	 *nick, |  | ||||||
| 					  const gchar	 *blurb, |  | ||||||
| 					  const gchar	 *default_value, |  | ||||||
| 					  GParamFlags	  flags); |  | ||||||
| GParamSpec*	g_param_spec_param	 (const gchar	 *name, | GParamSpec*	g_param_spec_param	 (const gchar	 *name, | ||||||
| 					  const gchar	 *nick, | 					  const gchar	 *nick, | ||||||
| 					  const gchar	 *blurb, | 					  const gchar	 *blurb, | ||||||
|   | |||||||
| @@ -218,6 +218,15 @@ guint	 g_signal_handlers_disconnect_matched (gpointer		  instance, | |||||||
| /* --- convenience --- */ | /* --- convenience --- */ | ||||||
| #define g_signal_connectc(instance, detailed_signal, c_handler, data, swapped) \ | #define g_signal_connectc(instance, detailed_signal, c_handler, data, swapped) \ | ||||||
|     g_signal_connect_data ((instance), (detailed_signal), (c_handler), (data), NULL, (swapped), FALSE) |     g_signal_connect_data ((instance), (detailed_signal), (c_handler), (data), NULL, (swapped), FALSE) | ||||||
|  | #define	g_signal_disconnect_by_func(instance, func, data) \ | ||||||
|  |     g_signal_handlers_disconnect_matched ((instance), G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, \ | ||||||
|  | 					  0, 0, NULL, (func), (data)) | ||||||
|  | #define	g_signal_block_by_func(instance, func, data) \ | ||||||
|  |     g_signal_handlers_block_matched ((instance), G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, \ | ||||||
|  | 				     0, 0, NULL, (func), (data)) | ||||||
|  | #define	g_signal_unblock_by_func(instance, func, data) \ | ||||||
|  |     g_signal_handlers_unblock_matched ((instance), G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, \ | ||||||
|  | 				       0, 0, NULL, (func), (data)) | ||||||
|       |       | ||||||
| /*< private >*/ | /*< private >*/ | ||||||
| void	 g_signal_handlers_destroy	      (gpointer		  instance); | void	 g_signal_handlers_destroy	      (gpointer		  instance); | ||||||
|   | |||||||
| @@ -99,6 +99,9 @@ static GStaticRWLock            type_rw_lock = G_STATIC_RW_LOCK_INIT; | |||||||
| 				    G_TYPE_FLAG_DERIVABLE | \ | 				    G_TYPE_FLAG_DERIVABLE | \ | ||||||
| 				    G_TYPE_FLAG_DEEP_DERIVABLE) | 				    G_TYPE_FLAG_DEEP_DERIVABLE) | ||||||
| #define	TYPE_FLAG_MASK		   (G_TYPE_FLAG_ABSTRACT | G_TYPE_FLAG_VALUE_ABSTRACT) | #define	TYPE_FLAG_MASK		   (G_TYPE_FLAG_ABSTRACT | G_TYPE_FLAG_VALUE_ABSTRACT) | ||||||
|  | #define	SIZEOF_FUNDAMENTAL_INFO	   ((gssize) MAX (MAX (sizeof (GTypeFundamentalInfo), \ | ||||||
|  | 						       sizeof (gpointer)), \ | ||||||
|  |                                                   sizeof (glong))) | ||||||
|  |  | ||||||
|  |  | ||||||
| /* --- typedefs --- */ | /* --- typedefs --- */ | ||||||
| @@ -287,12 +290,12 @@ type_node_any_new_W (TypeNode             *pnode, | |||||||
|     static_type_nodes[ftype] = g_renew (TypeNode*, static_type_nodes[ftype], 1 << g_bit_storage (static_branch_seqnos[ftype] - 1)); |     static_type_nodes[ftype] = g_renew (TypeNode*, static_type_nodes[ftype], 1 << g_bit_storage (static_branch_seqnos[ftype] - 1)); | ||||||
|    |    | ||||||
|   if (!pnode) |   if (!pnode) | ||||||
|     node_size += sizeof (GTypeFundamentalInfo);	      /* fundamental type info */ |     node_size += SIZEOF_FUNDAMENTAL_INFO;	      /* fundamental type info */ | ||||||
|   node_size += SIZEOF_BASE_TYPE_NODE ();	      /* TypeNode structure */ |   node_size += SIZEOF_BASE_TYPE_NODE ();	      /* TypeNode structure */ | ||||||
|   node_size += (sizeof (GType) * (1 + n_supers + 1)); /* self + ancestors + 0 for ->supers[] */ |   node_size += (sizeof (GType) * (1 + n_supers + 1)); /* self + ancestors + 0 for ->supers[] */ | ||||||
|   node = g_malloc0 (node_size); |   node = g_malloc0 (node_size); | ||||||
|   if (!pnode)					      /* offset fundamental types */ |   if (!pnode)					      /* offset fundamental types */ | ||||||
|     node = G_STRUCT_MEMBER_P (node, sizeof (GTypeFundamentalInfo)); |     node = G_STRUCT_MEMBER_P (node, SIZEOF_FUNDAMENTAL_INFO); | ||||||
|   static_type_nodes[ftype][branch_last] = node; |   static_type_nodes[ftype][branch_last] = node; | ||||||
|    |    | ||||||
|   node->n_supers = n_supers; |   node->n_supers = n_supers; | ||||||
| @@ -362,7 +365,7 @@ type_node_fundamental_info_L (TypeNode *node) | |||||||
|   if (ftype != NODE_TYPE (node)) |   if (ftype != NODE_TYPE (node)) | ||||||
|     node = lookup_type_node_L (ftype); |     node = lookup_type_node_L (ftype); | ||||||
|    |    | ||||||
|   return node ? G_STRUCT_MEMBER_P (node, - (gssize) sizeof (GTypeFundamentalInfo)) : NULL; |   return node ? G_STRUCT_MEMBER_P (node, - SIZEOF_FUNDAMENTAL_INFO) : NULL; | ||||||
| } | } | ||||||
|  |  | ||||||
| static TypeNode* | static TypeNode* | ||||||
|   | |||||||
							
								
								
									
										12
									
								
								gscanner.c
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								gscanner.c
									
									
									
									
									
								
							| @@ -366,17 +366,7 @@ g_scanner_key_hash (gconstpointer v) | |||||||
|    |    | ||||||
|   h = key->scope_id; |   h = key->scope_id; | ||||||
|   for (c = key->symbol; *c; c++) |   for (c = key->symbol; *c; c++) | ||||||
|     { |     h = (h << 5) - h + *c; | ||||||
|       guint g; |  | ||||||
|        |  | ||||||
|       h = (h << 4) + *c; |  | ||||||
|       g = h & 0xf0000000; |  | ||||||
|       if (g) |  | ||||||
| 	{ |  | ||||||
| 	  h = h ^ (g >> 24); |  | ||||||
| 	  h = h ^ g; |  | ||||||
| 	} |  | ||||||
|     } |  | ||||||
|    |    | ||||||
|   return h; |   return h; | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user