avoid unneccessary extra hook referencing (the explicit hook referencing

Sat Jan  2 02:20:59 1999  Tim Janik  <timj@gtk.org>

        * ghook.c:
        (g_hook_list_invoke):
        (g_hook_list_invoke_check):
        (g_hook_list_marshal_check):
        (g_hook_list_marshal): avoid unneccessary extra hook referencing (the
        explicit hook referencing became unneccessarry with my changes from
        Mon Dec 21 21:48:29 1998).

        * gmain.c (g_main_iterate): fixed reference counting leaks with
        premature loop aborts.

Fri Jan  1 22:47:44 1999  Tim Janik  <timj@gtk.org>

        * gscanner.c (g_scanner_unexp_token): handle G_TOKEN_IDENTIFIER_NULL
        as G_TOKEN_IDENTIFIER.
This commit is contained in:
Tim Janik 1999-01-02 01:32:37 +00:00 committed by Tim Janik
parent 0e2f565f14
commit 00e064d2af
14 changed files with 314 additions and 218 deletions

View File

@ -1,3 +1,21 @@
Sat Jan 2 02:20:59 1999 Tim Janik <timj@gtk.org>
* ghook.c:
(g_hook_list_invoke):
(g_hook_list_invoke_check):
(g_hook_list_marshal_check):
(g_hook_list_marshal): avoid unneccessary extra hook referencing (the
explicit hook referencing became unneccessarry with my changes from
Mon Dec 21 21:48:29 1998).
* gmain.c (g_main_iterate): fixed reference counting leaks with
premature loop aborts.
Fri Jan 1 22:47:44 1999 Tim Janik <timj@gtk.org>
* gscanner.c (g_scanner_unexp_token): handle G_TOKEN_IDENTIFIER_NULL
as G_TOKEN_IDENTIFIER.
Fri Jan 1 17:09:19 EST 1999 Jeff Garzik <jgarzik@pobox.com>
* configure.in, glib.h:

View File

@ -1,3 +1,21 @@
Sat Jan 2 02:20:59 1999 Tim Janik <timj@gtk.org>
* ghook.c:
(g_hook_list_invoke):
(g_hook_list_invoke_check):
(g_hook_list_marshal_check):
(g_hook_list_marshal): avoid unneccessary extra hook referencing (the
explicit hook referencing became unneccessarry with my changes from
Mon Dec 21 21:48:29 1998).
* gmain.c (g_main_iterate): fixed reference counting leaks with
premature loop aborts.
Fri Jan 1 22:47:44 1999 Tim Janik <timj@gtk.org>
* gscanner.c (g_scanner_unexp_token): handle G_TOKEN_IDENTIFIER_NULL
as G_TOKEN_IDENTIFIER.
Fri Jan 1 17:09:19 EST 1999 Jeff Garzik <jgarzik@pobox.com>
* configure.in, glib.h:

View File

@ -1,3 +1,21 @@
Sat Jan 2 02:20:59 1999 Tim Janik <timj@gtk.org>
* ghook.c:
(g_hook_list_invoke):
(g_hook_list_invoke_check):
(g_hook_list_marshal_check):
(g_hook_list_marshal): avoid unneccessary extra hook referencing (the
explicit hook referencing became unneccessarry with my changes from
Mon Dec 21 21:48:29 1998).
* gmain.c (g_main_iterate): fixed reference counting leaks with
premature loop aborts.
Fri Jan 1 22:47:44 1999 Tim Janik <timj@gtk.org>
* gscanner.c (g_scanner_unexp_token): handle G_TOKEN_IDENTIFIER_NULL
as G_TOKEN_IDENTIFIER.
Fri Jan 1 17:09:19 EST 1999 Jeff Garzik <jgarzik@pobox.com>
* configure.in, glib.h:

View File

@ -1,3 +1,21 @@
Sat Jan 2 02:20:59 1999 Tim Janik <timj@gtk.org>
* ghook.c:
(g_hook_list_invoke):
(g_hook_list_invoke_check):
(g_hook_list_marshal_check):
(g_hook_list_marshal): avoid unneccessary extra hook referencing (the
explicit hook referencing became unneccessarry with my changes from
Mon Dec 21 21:48:29 1998).
* gmain.c (g_main_iterate): fixed reference counting leaks with
premature loop aborts.
Fri Jan 1 22:47:44 1999 Tim Janik <timj@gtk.org>
* gscanner.c (g_scanner_unexp_token): handle G_TOKEN_IDENTIFIER_NULL
as G_TOKEN_IDENTIFIER.
Fri Jan 1 17:09:19 EST 1999 Jeff Garzik <jgarzik@pobox.com>
* configure.in, glib.h:

View File

@ -1,3 +1,21 @@
Sat Jan 2 02:20:59 1999 Tim Janik <timj@gtk.org>
* ghook.c:
(g_hook_list_invoke):
(g_hook_list_invoke_check):
(g_hook_list_marshal_check):
(g_hook_list_marshal): avoid unneccessary extra hook referencing (the
explicit hook referencing became unneccessarry with my changes from
Mon Dec 21 21:48:29 1998).
* gmain.c (g_main_iterate): fixed reference counting leaks with
premature loop aborts.
Fri Jan 1 22:47:44 1999 Tim Janik <timj@gtk.org>
* gscanner.c (g_scanner_unexp_token): handle G_TOKEN_IDENTIFIER_NULL
as G_TOKEN_IDENTIFIER.
Fri Jan 1 17:09:19 EST 1999 Jeff Garzik <jgarzik@pobox.com>
* configure.in, glib.h:

View File

@ -1,3 +1,21 @@
Sat Jan 2 02:20:59 1999 Tim Janik <timj@gtk.org>
* ghook.c:
(g_hook_list_invoke):
(g_hook_list_invoke_check):
(g_hook_list_marshal_check):
(g_hook_list_marshal): avoid unneccessary extra hook referencing (the
explicit hook referencing became unneccessarry with my changes from
Mon Dec 21 21:48:29 1998).
* gmain.c (g_main_iterate): fixed reference counting leaks with
premature loop aborts.
Fri Jan 1 22:47:44 1999 Tim Janik <timj@gtk.org>
* gscanner.c (g_scanner_unexp_token): handle G_TOKEN_IDENTIFIER_NULL
as G_TOKEN_IDENTIFIER.
Fri Jan 1 17:09:19 EST 1999 Jeff Garzik <jgarzik@pobox.com>
* configure.in, glib.h:

View File

@ -1,3 +1,21 @@
Sat Jan 2 02:20:59 1999 Tim Janik <timj@gtk.org>
* ghook.c:
(g_hook_list_invoke):
(g_hook_list_invoke_check):
(g_hook_list_marshal_check):
(g_hook_list_marshal): avoid unneccessary extra hook referencing (the
explicit hook referencing became unneccessarry with my changes from
Mon Dec 21 21:48:29 1998).
* gmain.c (g_main_iterate): fixed reference counting leaks with
premature loop aborts.
Fri Jan 1 22:47:44 1999 Tim Janik <timj@gtk.org>
* gscanner.c (g_scanner_unexp_token): handle G_TOKEN_IDENTIFIER_NULL
as G_TOKEN_IDENTIFIER.
Fri Jan 1 17:09:19 EST 1999 Jeff Garzik <jgarzik@pobox.com>
* configure.in, glib.h:

View File

@ -1,3 +1,21 @@
Sat Jan 2 02:20:59 1999 Tim Janik <timj@gtk.org>
* ghook.c:
(g_hook_list_invoke):
(g_hook_list_invoke_check):
(g_hook_list_marshal_check):
(g_hook_list_marshal): avoid unneccessary extra hook referencing (the
explicit hook referencing became unneccessarry with my changes from
Mon Dec 21 21:48:29 1998).
* gmain.c (g_main_iterate): fixed reference counting leaks with
premature loop aborts.
Fri Jan 1 22:47:44 1999 Tim Janik <timj@gtk.org>
* gscanner.c (g_scanner_unexp_token): handle G_TOKEN_IDENTIFIER_NULL
as G_TOKEN_IDENTIFIER.
Fri Jan 1 17:09:19 EST 1999 Jeff Garzik <jgarzik@pobox.com>
* configure.in, glib.h:

30
ghook.c
View File

@ -273,11 +273,9 @@ g_hook_list_invoke (GHookList *hook_list,
hook = g_hook_first_valid (hook_list, may_recurse);
while (hook)
{
GHook *tmp;
GHookFunc func;
gboolean was_in_call;
g_hook_ref (hook_list, hook);
func = (GHookFunc) hook->func;
was_in_call = G_HOOK_IN_CALL (hook);
@ -286,10 +284,7 @@ g_hook_list_invoke (GHookList *hook_list,
if (!was_in_call)
hook->flags &= ~G_HOOK_FLAG_IN_CALL;
tmp = g_hook_next_valid (hook_list, hook, may_recurse);
g_hook_unref (hook_list, hook);
hook = tmp;
hook = g_hook_next_valid (hook_list, hook, may_recurse);
}
}
@ -305,12 +300,10 @@ g_hook_list_invoke_check (GHookList *hook_list,
hook = g_hook_first_valid (hook_list, may_recurse);
while (hook)
{
GHook *tmp;
GHookCheckFunc func;
gboolean was_in_call;
gboolean need_destroy;
g_hook_ref (hook_list, hook);
func = (GHookCheckFunc) hook->func;
was_in_call = G_HOOK_IN_CALL (hook);
@ -321,10 +314,7 @@ g_hook_list_invoke_check (GHookList *hook_list,
if (need_destroy)
g_hook_destroy_link (hook_list, hook);
tmp = g_hook_next_valid (hook_list, hook, may_recurse);
g_hook_unref (hook_list, hook);
hook = tmp;
hook = g_hook_next_valid (hook_list, hook, may_recurse);
}
}
@ -343,12 +333,9 @@ g_hook_list_marshal_check (GHookList *hook_list,
hook = g_hook_first_valid (hook_list, may_recurse);
while (hook)
{
GHook *tmp;
gboolean was_in_call;
gboolean need_destroy;
g_hook_ref (hook_list, hook);
was_in_call = G_HOOK_IN_CALL (hook);
hook->flags |= G_HOOK_FLAG_IN_CALL;
need_destroy = !marshaller (hook, data);
@ -357,10 +344,7 @@ g_hook_list_marshal_check (GHookList *hook_list,
if (need_destroy)
g_hook_destroy_link (hook_list, hook);
tmp = g_hook_next_valid (hook_list, hook, may_recurse);
g_hook_unref (hook_list, hook);
hook = tmp;
hook = g_hook_next_valid (hook_list, hook, may_recurse);
}
}
@ -379,21 +363,15 @@ g_hook_list_marshal (GHookList *hook_list,
hook = g_hook_first_valid (hook_list, may_recurse);
while (hook)
{
GHook *tmp;
gboolean was_in_call;
g_hook_ref (hook_list, hook);
was_in_call = G_HOOK_IN_CALL (hook);
hook->flags |= G_HOOK_FLAG_IN_CALL;
marshaller (hook, data);
if (!was_in_call)
hook->flags &= ~G_HOOK_FLAG_IN_CALL;
tmp = g_hook_next_valid (hook_list, hook, may_recurse);
g_hook_unref (hook_list, hook);
hook = tmp;
hook = g_hook_next_valid (hook_list, hook, may_recurse);
}
}

View File

@ -273,11 +273,9 @@ g_hook_list_invoke (GHookList *hook_list,
hook = g_hook_first_valid (hook_list, may_recurse);
while (hook)
{
GHook *tmp;
GHookFunc func;
gboolean was_in_call;
g_hook_ref (hook_list, hook);
func = (GHookFunc) hook->func;
was_in_call = G_HOOK_IN_CALL (hook);
@ -286,10 +284,7 @@ g_hook_list_invoke (GHookList *hook_list,
if (!was_in_call)
hook->flags &= ~G_HOOK_FLAG_IN_CALL;
tmp = g_hook_next_valid (hook_list, hook, may_recurse);
g_hook_unref (hook_list, hook);
hook = tmp;
hook = g_hook_next_valid (hook_list, hook, may_recurse);
}
}
@ -305,12 +300,10 @@ g_hook_list_invoke_check (GHookList *hook_list,
hook = g_hook_first_valid (hook_list, may_recurse);
while (hook)
{
GHook *tmp;
GHookCheckFunc func;
gboolean was_in_call;
gboolean need_destroy;
g_hook_ref (hook_list, hook);
func = (GHookCheckFunc) hook->func;
was_in_call = G_HOOK_IN_CALL (hook);
@ -321,10 +314,7 @@ g_hook_list_invoke_check (GHookList *hook_list,
if (need_destroy)
g_hook_destroy_link (hook_list, hook);
tmp = g_hook_next_valid (hook_list, hook, may_recurse);
g_hook_unref (hook_list, hook);
hook = tmp;
hook = g_hook_next_valid (hook_list, hook, may_recurse);
}
}
@ -343,12 +333,9 @@ g_hook_list_marshal_check (GHookList *hook_list,
hook = g_hook_first_valid (hook_list, may_recurse);
while (hook)
{
GHook *tmp;
gboolean was_in_call;
gboolean need_destroy;
g_hook_ref (hook_list, hook);
was_in_call = G_HOOK_IN_CALL (hook);
hook->flags |= G_HOOK_FLAG_IN_CALL;
need_destroy = !marshaller (hook, data);
@ -357,10 +344,7 @@ g_hook_list_marshal_check (GHookList *hook_list,
if (need_destroy)
g_hook_destroy_link (hook_list, hook);
tmp = g_hook_next_valid (hook_list, hook, may_recurse);
g_hook_unref (hook_list, hook);
hook = tmp;
hook = g_hook_next_valid (hook_list, hook, may_recurse);
}
}
@ -379,21 +363,15 @@ g_hook_list_marshal (GHookList *hook_list,
hook = g_hook_first_valid (hook_list, may_recurse);
while (hook)
{
GHook *tmp;
gboolean was_in_call;
g_hook_ref (hook_list, hook);
was_in_call = G_HOOK_IN_CALL (hook);
hook->flags |= G_HOOK_FLAG_IN_CALL;
marshaller (hook, data);
if (!was_in_call)
hook->flags &= ~G_HOOK_FLAG_IN_CALL;
tmp = g_hook_next_valid (hook_list, hook, may_recurse);
g_hook_unref (hook_list, hook);
hook = tmp;
hook = g_hook_next_valid (hook_list, hook, may_recurse);
}
}

View File

@ -402,7 +402,7 @@ g_main_dispatch (GTimeVal *current_time)
}
}
g_hook_unref (&source_list, (GHook *)source);
g_hook_unref (&source_list, (GHook*) source);
}
}
@ -472,19 +472,19 @@ g_main_iterate (gboolean block,
while (hook)
{
GSource *source = (GSource *)hook;
GHook *tmp;
gint source_timeout = -1;
if ((n_ready > 0) && (source->priority > current_priority))
break;
{
g_hook_unref (&source_list, hook);
break;
}
if (G_HOOK_IN_CALL (hook) && !(hook->flags & G_SOURCE_CAN_RECURSE))
{
hook = g_hook_next_valid (&source_list, hook, TRUE);
continue;
}
g_hook_ref (&source_list, hook);
if (hook->flags & G_SOURCE_READY ||
((GSourceFuncs *) hook->func)->prepare (source->source_data,
&current_time,
@ -515,10 +515,7 @@ g_main_iterate (gboolean block,
timeout = MIN (timeout, source_timeout);
}
tmp = g_hook_next_valid (&source_list, hook, TRUE);
g_hook_unref (&source_list, hook);
hook = tmp;
hook = g_hook_next_valid (&source_list, hook, TRUE);
}
/* poll(), if necessary */
@ -533,18 +530,18 @@ g_main_iterate (gboolean block,
while (hook)
{
GSource *source = (GSource *)hook;
GHook *tmp;
if ((n_ready > 0) && (source->priority > current_priority))
break;
{
g_hook_unref (&source_list, hook);
break;
}
if (G_HOOK_IN_CALL (hook) && !(hook->flags & G_SOURCE_CAN_RECURSE))
{
hook = g_hook_next_valid (&source_list, hook, TRUE);
continue;
}
g_hook_ref (&source_list, hook);
if (hook->flags & G_SOURCE_READY ||
((GSourceFuncs *) hook->func)->check (source->source_data,
&current_time))
@ -566,10 +563,7 @@ g_main_iterate (gboolean block,
}
}
tmp = g_hook_next_valid (&source_list, hook, TRUE);
g_hook_unref (&source_list, hook);
hook = tmp;
hook = g_hook_next_valid (&source_list, hook, TRUE);
}
/* Now invoke the callbacks */

View File

@ -234,11 +234,11 @@ g_scanner_free_value (GTokenType *token_p,
{
switch (*token_p)
{
case G_TOKEN_STRING:
case G_TOKEN_IDENTIFIER:
case G_TOKEN_IDENTIFIER_NULL:
case G_TOKEN_COMMENT_SINGLE:
case G_TOKEN_COMMENT_MULTI:
case G_TOKEN_STRING:
case G_TOKEN_IDENTIFIER:
case G_TOKEN_IDENTIFIER_NULL:
case G_TOKEN_COMMENT_SINGLE:
case G_TOKEN_COMMENT_MULTI:
g_free (value_p->v_string);
break;
@ -871,7 +871,7 @@ g_scanner_unexp_token (GScanner *scanner,
switch (scanner->token)
{
case G_TOKEN_EOF:
case G_TOKEN_EOF:
g_snprintf (token_string, token_string_len, "end of file");
break;
@ -892,7 +892,7 @@ g_scanner_unexp_token (GScanner *scanner,
break;
}
/* fall through */
case G_TOKEN_SYMBOL:
case G_TOKEN_SYMBOL:
if (expected_token == G_TOKEN_SYMBOL ||
(scanner->config->symbol_2_token &&
expected_token > G_TOKEN_LAST))
@ -912,52 +912,54 @@ g_scanner_unexp_token (GScanner *scanner,
symbol_spec);
break;
case G_TOKEN_ERROR:
case G_TOKEN_ERROR:
print_unexp = FALSE;
expected_token = G_TOKEN_NONE;
switch (scanner->value.v_error)
{
case G_ERR_UNEXP_EOF:
case G_ERR_UNEXP_EOF:
g_snprintf (token_string, token_string_len, "scanner: unexpected end of file");
break;
case G_ERR_UNEXP_EOF_IN_STRING:
case G_ERR_UNEXP_EOF_IN_STRING:
g_snprintf (token_string, token_string_len, "scanner: unterminated string constant");
break;
case G_ERR_UNEXP_EOF_IN_COMMENT:
case G_ERR_UNEXP_EOF_IN_COMMENT:
g_snprintf (token_string, token_string_len, "scanner: unterminated comment");
break;
case G_ERR_NON_DIGIT_IN_CONST:
case G_ERR_NON_DIGIT_IN_CONST:
g_snprintf (token_string, token_string_len, "scanner: non digit in constant");
break;
case G_ERR_FLOAT_RADIX:
case G_ERR_FLOAT_RADIX:
g_snprintf (token_string, token_string_len, "scanner: invalid radix for floating constant");
break;
case G_ERR_FLOAT_MALFORMED:
case G_ERR_FLOAT_MALFORMED:
g_snprintf (token_string, token_string_len, "scanner: malformed floating constant");
break;
case G_ERR_DIGIT_RADIX:
case G_ERR_DIGIT_RADIX:
g_snprintf (token_string, token_string_len, "scanner: digit is beyond radix");
break;
case G_ERR_UNKNOWN:
case G_ERR_UNKNOWN:
default:
g_snprintf (token_string, token_string_len, "scanner: unknown error");
break;
}
break;
case G_TOKEN_CHAR:
case G_TOKEN_CHAR:
g_snprintf (token_string, token_string_len, "character `%c'", scanner->value.v_char);
break;
case G_TOKEN_IDENTIFIER:
if (expected_token == G_TOKEN_IDENTIFIER)
case G_TOKEN_IDENTIFIER:
case G_TOKEN_IDENTIFIER_NULL:
if (expected_token == G_TOKEN_IDENTIFIER ||
expected_token == G_TOKEN_IDENTIFIER_NULL)
print_unexp = FALSE;
g_snprintf (token_string,
token_string_len,
@ -967,18 +969,18 @@ g_scanner_unexp_token (GScanner *scanner,
scanner->value.v_string);
break;
case G_TOKEN_BINARY:
case G_TOKEN_OCTAL:
case G_TOKEN_INT:
case G_TOKEN_HEX:
case G_TOKEN_BINARY:
case G_TOKEN_OCTAL:
case G_TOKEN_INT:
case G_TOKEN_HEX:
g_snprintf (token_string, token_string_len, "number `%ld'", scanner->value.v_int);
break;
case G_TOKEN_FLOAT:
case G_TOKEN_FLOAT:
g_snprintf (token_string, token_string_len, "number `%.3f'", scanner->value.v_float);
break;
case G_TOKEN_STRING:
case G_TOKEN_STRING:
if (expected_token == G_TOKEN_STRING)
print_unexp = FALSE;
g_snprintf (token_string,
@ -991,12 +993,12 @@ g_scanner_unexp_token (GScanner *scanner,
token_string[token_string_len - 1] = 0;
break;
case G_TOKEN_COMMENT_SINGLE:
case G_TOKEN_COMMENT_MULTI:
case G_TOKEN_COMMENT_SINGLE:
case G_TOKEN_COMMENT_MULTI:
g_snprintf (token_string, token_string_len, "comment");
break;
case G_TOKEN_NONE:
case G_TOKEN_NONE:
/* somehow the user's parsing code is screwed, there isn't much
* we can do about it.
* Note, a common case to trigger this is
@ -1029,7 +1031,7 @@ g_scanner_unexp_token (GScanner *scanner,
break;
}
/* fall through */
case G_TOKEN_SYMBOL:
case G_TOKEN_SYMBOL:
need_valid = (scanner->token == G_TOKEN_SYMBOL ||
(scanner->config->symbol_2_token &&
scanner->token > G_TOKEN_LAST));
@ -1041,30 +1043,32 @@ g_scanner_unexp_token (GScanner *scanner,
/* FIXME: should we attempt to lookup the symbol_name for symbol_2_token? */
break;
case G_TOKEN_INT:
case G_TOKEN_INT:
g_snprintf (expected_string, expected_string_len, "number (integer)");
break;
case G_TOKEN_FLOAT:
case G_TOKEN_FLOAT:
g_snprintf (expected_string, expected_string_len, "number (float)");
break;
case G_TOKEN_STRING:
case G_TOKEN_STRING:
g_snprintf (expected_string,
expected_string_len,
"%sstring constant",
scanner->token == G_TOKEN_STRING ? "valid " : "");
break;
case G_TOKEN_IDENTIFIER:
case G_TOKEN_IDENTIFIER:
case G_TOKEN_IDENTIFIER_NULL:
g_snprintf (expected_string,
expected_string_len,
"%s%s",
scanner->token == G_TOKEN_IDENTIFIER ? "valid " : "",
(scanner->token == G_TOKEN_IDENTIFIER_NULL ||
scanner->token == G_TOKEN_IDENTIFIER ? "valid " : ""),
identifier_spec);
break;
case G_TOKEN_NONE:
case G_TOKEN_NONE:
break;
}
@ -1238,13 +1242,13 @@ g_scanner_get_token_ll (GScanner *scanner,
switch (ch)
{
case 0:
case 0:
token = G_TOKEN_EOF;
(*position_p)++;
/* ch = 0; */
break;
case '/':
case '/':
if (!config->scan_comment_multi ||
g_scanner_peek_next_char (scanner) != '*')
goto default_case;
@ -1266,7 +1270,7 @@ g_scanner_get_token_ll (GScanner *scanner,
ch = 0;
break;
case '\'':
case '\'':
if (!config->scan_string_sq)
goto default_case;
token = G_TOKEN_STRING;
@ -1285,7 +1289,7 @@ g_scanner_get_token_ll (GScanner *scanner,
ch = 0;
break;
case '"':
case '"':
if (!config->scan_string_dq)
goto default_case;
token = G_TOKEN_STRING;
@ -1308,41 +1312,41 @@ g_scanner_get_token_ll (GScanner *scanner,
register guint i;
register guint fchar;
case 0:
case 0:
break;
case '\\':
case '\\':
gstring = g_string_append_c (gstring, '\\');
break;
case 'n':
case 'n':
gstring = g_string_append_c (gstring, '\n');
break;
case 't':
case 't':
gstring = g_string_append_c (gstring, '\t');
break;
case 'r':
case 'r':
gstring = g_string_append_c (gstring, '\r');
break;
case 'b':
case 'b':
gstring = g_string_append_c (gstring, '\b');
break;
case 'f':
case 'f':
gstring = g_string_append_c (gstring, '\f');
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
i = ch - '0';
fchar = g_scanner_peek_next_char (scanner);
if (fchar >= '0' && fchar <= '7')
@ -1371,7 +1375,7 @@ g_scanner_get_token_ll (GScanner *scanner,
ch = 0;
break;
case '.':
case '.':
if (!config->scan_float)
goto default_case;
token = G_TOKEN_FLOAT;
@ -1379,14 +1383,14 @@ g_scanner_get_token_ll (GScanner *scanner,
ch = g_scanner_get_char (scanner, line_p, position_p);
goto number_parsing;
case '$':
case '$':
if (!config->scan_hex_dollar)
goto default_case;
token = G_TOKEN_HEX;
ch = g_scanner_get_char (scanner, line_p, position_p);
goto number_parsing;
case '0':
case '0':
if (config->scan_octal)
token = G_TOKEN_OCTAL;
else
@ -1435,15 +1439,15 @@ g_scanner_get_token_ll (GScanner *scanner,
else
ch = '0';
/* fall through */
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
number_parsing:
{
register gboolean in_number = TRUE;

28
gmain.c
View File

@ -402,7 +402,7 @@ g_main_dispatch (GTimeVal *current_time)
}
}
g_hook_unref (&source_list, (GHook *)source);
g_hook_unref (&source_list, (GHook*) source);
}
}
@ -472,19 +472,19 @@ g_main_iterate (gboolean block,
while (hook)
{
GSource *source = (GSource *)hook;
GHook *tmp;
gint source_timeout = -1;
if ((n_ready > 0) && (source->priority > current_priority))
break;
{
g_hook_unref (&source_list, hook);
break;
}
if (G_HOOK_IN_CALL (hook) && !(hook->flags & G_SOURCE_CAN_RECURSE))
{
hook = g_hook_next_valid (&source_list, hook, TRUE);
continue;
}
g_hook_ref (&source_list, hook);
if (hook->flags & G_SOURCE_READY ||
((GSourceFuncs *) hook->func)->prepare (source->source_data,
&current_time,
@ -515,10 +515,7 @@ g_main_iterate (gboolean block,
timeout = MIN (timeout, source_timeout);
}
tmp = g_hook_next_valid (&source_list, hook, TRUE);
g_hook_unref (&source_list, hook);
hook = tmp;
hook = g_hook_next_valid (&source_list, hook, TRUE);
}
/* poll(), if necessary */
@ -533,18 +530,18 @@ g_main_iterate (gboolean block,
while (hook)
{
GSource *source = (GSource *)hook;
GHook *tmp;
if ((n_ready > 0) && (source->priority > current_priority))
break;
{
g_hook_unref (&source_list, hook);
break;
}
if (G_HOOK_IN_CALL (hook) && !(hook->flags & G_SOURCE_CAN_RECURSE))
{
hook = g_hook_next_valid (&source_list, hook, TRUE);
continue;
}
g_hook_ref (&source_list, hook);
if (hook->flags & G_SOURCE_READY ||
((GSourceFuncs *) hook->func)->check (source->source_data,
&current_time))
@ -566,10 +563,7 @@ g_main_iterate (gboolean block,
}
}
tmp = g_hook_next_valid (&source_list, hook, TRUE);
g_hook_unref (&source_list, hook);
hook = tmp;
hook = g_hook_next_valid (&source_list, hook, TRUE);
}
/* Now invoke the callbacks */

View File

@ -234,11 +234,11 @@ g_scanner_free_value (GTokenType *token_p,
{
switch (*token_p)
{
case G_TOKEN_STRING:
case G_TOKEN_IDENTIFIER:
case G_TOKEN_IDENTIFIER_NULL:
case G_TOKEN_COMMENT_SINGLE:
case G_TOKEN_COMMENT_MULTI:
case G_TOKEN_STRING:
case G_TOKEN_IDENTIFIER:
case G_TOKEN_IDENTIFIER_NULL:
case G_TOKEN_COMMENT_SINGLE:
case G_TOKEN_COMMENT_MULTI:
g_free (value_p->v_string);
break;
@ -871,7 +871,7 @@ g_scanner_unexp_token (GScanner *scanner,
switch (scanner->token)
{
case G_TOKEN_EOF:
case G_TOKEN_EOF:
g_snprintf (token_string, token_string_len, "end of file");
break;
@ -892,7 +892,7 @@ g_scanner_unexp_token (GScanner *scanner,
break;
}
/* fall through */
case G_TOKEN_SYMBOL:
case G_TOKEN_SYMBOL:
if (expected_token == G_TOKEN_SYMBOL ||
(scanner->config->symbol_2_token &&
expected_token > G_TOKEN_LAST))
@ -912,52 +912,54 @@ g_scanner_unexp_token (GScanner *scanner,
symbol_spec);
break;
case G_TOKEN_ERROR:
case G_TOKEN_ERROR:
print_unexp = FALSE;
expected_token = G_TOKEN_NONE;
switch (scanner->value.v_error)
{
case G_ERR_UNEXP_EOF:
case G_ERR_UNEXP_EOF:
g_snprintf (token_string, token_string_len, "scanner: unexpected end of file");
break;
case G_ERR_UNEXP_EOF_IN_STRING:
case G_ERR_UNEXP_EOF_IN_STRING:
g_snprintf (token_string, token_string_len, "scanner: unterminated string constant");
break;
case G_ERR_UNEXP_EOF_IN_COMMENT:
case G_ERR_UNEXP_EOF_IN_COMMENT:
g_snprintf (token_string, token_string_len, "scanner: unterminated comment");
break;
case G_ERR_NON_DIGIT_IN_CONST:
case G_ERR_NON_DIGIT_IN_CONST:
g_snprintf (token_string, token_string_len, "scanner: non digit in constant");
break;
case G_ERR_FLOAT_RADIX:
case G_ERR_FLOAT_RADIX:
g_snprintf (token_string, token_string_len, "scanner: invalid radix for floating constant");
break;
case G_ERR_FLOAT_MALFORMED:
case G_ERR_FLOAT_MALFORMED:
g_snprintf (token_string, token_string_len, "scanner: malformed floating constant");
break;
case G_ERR_DIGIT_RADIX:
case G_ERR_DIGIT_RADIX:
g_snprintf (token_string, token_string_len, "scanner: digit is beyond radix");
break;
case G_ERR_UNKNOWN:
case G_ERR_UNKNOWN:
default:
g_snprintf (token_string, token_string_len, "scanner: unknown error");
break;
}
break;
case G_TOKEN_CHAR:
case G_TOKEN_CHAR:
g_snprintf (token_string, token_string_len, "character `%c'", scanner->value.v_char);
break;
case G_TOKEN_IDENTIFIER:
if (expected_token == G_TOKEN_IDENTIFIER)
case G_TOKEN_IDENTIFIER:
case G_TOKEN_IDENTIFIER_NULL:
if (expected_token == G_TOKEN_IDENTIFIER ||
expected_token == G_TOKEN_IDENTIFIER_NULL)
print_unexp = FALSE;
g_snprintf (token_string,
token_string_len,
@ -967,18 +969,18 @@ g_scanner_unexp_token (GScanner *scanner,
scanner->value.v_string);
break;
case G_TOKEN_BINARY:
case G_TOKEN_OCTAL:
case G_TOKEN_INT:
case G_TOKEN_HEX:
case G_TOKEN_BINARY:
case G_TOKEN_OCTAL:
case G_TOKEN_INT:
case G_TOKEN_HEX:
g_snprintf (token_string, token_string_len, "number `%ld'", scanner->value.v_int);
break;
case G_TOKEN_FLOAT:
case G_TOKEN_FLOAT:
g_snprintf (token_string, token_string_len, "number `%.3f'", scanner->value.v_float);
break;
case G_TOKEN_STRING:
case G_TOKEN_STRING:
if (expected_token == G_TOKEN_STRING)
print_unexp = FALSE;
g_snprintf (token_string,
@ -991,12 +993,12 @@ g_scanner_unexp_token (GScanner *scanner,
token_string[token_string_len - 1] = 0;
break;
case G_TOKEN_COMMENT_SINGLE:
case G_TOKEN_COMMENT_MULTI:
case G_TOKEN_COMMENT_SINGLE:
case G_TOKEN_COMMENT_MULTI:
g_snprintf (token_string, token_string_len, "comment");
break;
case G_TOKEN_NONE:
case G_TOKEN_NONE:
/* somehow the user's parsing code is screwed, there isn't much
* we can do about it.
* Note, a common case to trigger this is
@ -1029,7 +1031,7 @@ g_scanner_unexp_token (GScanner *scanner,
break;
}
/* fall through */
case G_TOKEN_SYMBOL:
case G_TOKEN_SYMBOL:
need_valid = (scanner->token == G_TOKEN_SYMBOL ||
(scanner->config->symbol_2_token &&
scanner->token > G_TOKEN_LAST));
@ -1041,30 +1043,32 @@ g_scanner_unexp_token (GScanner *scanner,
/* FIXME: should we attempt to lookup the symbol_name for symbol_2_token? */
break;
case G_TOKEN_INT:
case G_TOKEN_INT:
g_snprintf (expected_string, expected_string_len, "number (integer)");
break;
case G_TOKEN_FLOAT:
case G_TOKEN_FLOAT:
g_snprintf (expected_string, expected_string_len, "number (float)");
break;
case G_TOKEN_STRING:
case G_TOKEN_STRING:
g_snprintf (expected_string,
expected_string_len,
"%sstring constant",
scanner->token == G_TOKEN_STRING ? "valid " : "");
break;
case G_TOKEN_IDENTIFIER:
case G_TOKEN_IDENTIFIER:
case G_TOKEN_IDENTIFIER_NULL:
g_snprintf (expected_string,
expected_string_len,
"%s%s",
scanner->token == G_TOKEN_IDENTIFIER ? "valid " : "",
(scanner->token == G_TOKEN_IDENTIFIER_NULL ||
scanner->token == G_TOKEN_IDENTIFIER ? "valid " : ""),
identifier_spec);
break;
case G_TOKEN_NONE:
case G_TOKEN_NONE:
break;
}
@ -1238,13 +1242,13 @@ g_scanner_get_token_ll (GScanner *scanner,
switch (ch)
{
case 0:
case 0:
token = G_TOKEN_EOF;
(*position_p)++;
/* ch = 0; */
break;
case '/':
case '/':
if (!config->scan_comment_multi ||
g_scanner_peek_next_char (scanner) != '*')
goto default_case;
@ -1266,7 +1270,7 @@ g_scanner_get_token_ll (GScanner *scanner,
ch = 0;
break;
case '\'':
case '\'':
if (!config->scan_string_sq)
goto default_case;
token = G_TOKEN_STRING;
@ -1285,7 +1289,7 @@ g_scanner_get_token_ll (GScanner *scanner,
ch = 0;
break;
case '"':
case '"':
if (!config->scan_string_dq)
goto default_case;
token = G_TOKEN_STRING;
@ -1308,41 +1312,41 @@ g_scanner_get_token_ll (GScanner *scanner,
register guint i;
register guint fchar;
case 0:
case 0:
break;
case '\\':
case '\\':
gstring = g_string_append_c (gstring, '\\');
break;
case 'n':
case 'n':
gstring = g_string_append_c (gstring, '\n');
break;
case 't':
case 't':
gstring = g_string_append_c (gstring, '\t');
break;
case 'r':
case 'r':
gstring = g_string_append_c (gstring, '\r');
break;
case 'b':
case 'b':
gstring = g_string_append_c (gstring, '\b');
break;
case 'f':
case 'f':
gstring = g_string_append_c (gstring, '\f');
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
i = ch - '0';
fchar = g_scanner_peek_next_char (scanner);
if (fchar >= '0' && fchar <= '7')
@ -1371,7 +1375,7 @@ g_scanner_get_token_ll (GScanner *scanner,
ch = 0;
break;
case '.':
case '.':
if (!config->scan_float)
goto default_case;
token = G_TOKEN_FLOAT;
@ -1379,14 +1383,14 @@ g_scanner_get_token_ll (GScanner *scanner,
ch = g_scanner_get_char (scanner, line_p, position_p);
goto number_parsing;
case '$':
case '$':
if (!config->scan_hex_dollar)
goto default_case;
token = G_TOKEN_HEX;
ch = g_scanner_get_char (scanner, line_p, position_p);
goto number_parsing;
case '0':
case '0':
if (config->scan_octal)
token = G_TOKEN_OCTAL;
else
@ -1435,15 +1439,15 @@ g_scanner_get_token_ll (GScanner *scanner,
else
ch = '0';
/* fall through */
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
number_parsing:
{
register gboolean in_number = TRUE;