change the type of ref_count from guint to gint, so we can remove some

2007-09-10  Marco Barisione <marco@barisione.org>

	* glib/gregex.c: change the type of ref_count from guint to gint, so
	we can remove some ugly casts.

svn path=/trunk/; revision=5746
This commit is contained in:
Marco Barisione 2007-09-10 16:27:38 +00:00 committed by Marco Barisione
parent 4356f18a3d
commit 6273407af6
2 changed files with 5 additions and 3 deletions

View File

@ -6,6 +6,8 @@
* glib/gregex.c: use pcre_get_stringnumber() in * glib/gregex.c: use pcre_get_stringnumber() in
get_matched_substring_number() if G_REGEX_DUPNAMES was not set. get_matched_substring_number() if G_REGEX_DUPNAMES was not set.
(#444765, Yevgen Muntyan) (#444765, Yevgen Muntyan)
* glib/gregex.c: change the type of ref_count from guint to gint, so
we can remove some ugly casts.
2007-09-05 Behdad Esfahbod <behdad@gnome.org> 2007-09-05 Behdad Esfahbod <behdad@gnome.org>

View File

@ -92,7 +92,7 @@ struct _GMatchInfo
struct _GRegex struct _GRegex
{ {
volatile guint ref_count; /* the ref count for the immutable part */ volatile gint ref_count; /* the ref count for the immutable part */
gchar *pattern; /* the pattern */ gchar *pattern; /* the pattern */
pcre *pcre_re; /* compiled form of the pattern */ pcre *pcre_re; /* compiled form of the pattern */
GRegexCompileFlags compile_opts; /* options used at compile time on the pattern */ GRegexCompileFlags compile_opts; /* options used at compile time on the pattern */
@ -802,7 +802,7 @@ GRegex *
g_regex_ref (GRegex *regex) g_regex_ref (GRegex *regex)
{ {
g_return_val_if_fail (regex != NULL, NULL); g_return_val_if_fail (regex != NULL, NULL);
g_atomic_int_inc ((gint*) &regex->ref_count); g_atomic_int_inc (&regex->ref_count);
return regex; return regex;
} }
@ -820,7 +820,7 @@ g_regex_unref (GRegex *regex)
{ {
g_return_if_fail (regex != NULL); g_return_if_fail (regex != NULL);
if (g_atomic_int_exchange_and_add ((gint *) &regex->ref_count, -1) - 1 == 0) if (g_atomic_int_exchange_and_add (&regex->ref_count, -1) - 1 == 0)
{ {
g_free (regex->pattern); g_free (regex->pattern);
if (regex->pcre_re != NULL) if (regex->pcre_re != NULL)