mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-31 20:00:24 +01:00
report error message when something fails
This commit is contained in:
parent
203946e1f9
commit
dceae2829e
1 changed files with 23 additions and 2 deletions
|
|
@ -260,6 +260,8 @@
|
|||
first).
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
static void mem_free (void **);
|
||||
|
||||
/*
|
||||
|
|
@ -2797,10 +2799,16 @@ static void grammar_load_state_destroy (grammar_load_state **gr)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static void error_msg(int line, const char *msg)
|
||||
{
|
||||
fprintf(stderr, "Error in grammar_load_from_text() at line %d: %s\n", line, msg);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
the API
|
||||
*/
|
||||
|
||||
grammar grammar_load_from_text (const byte *text)
|
||||
{
|
||||
grammar_load_state *g = NULL;
|
||||
|
|
@ -2809,13 +2817,16 @@ grammar grammar_load_from_text (const byte *text)
|
|||
clear_last_error ();
|
||||
|
||||
grammar_load_state_create (&g);
|
||||
if (g == NULL)
|
||||
if (g == NULL) {
|
||||
error_msg(__LINE__, "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
dict_create (&g->di);
|
||||
if (g->di == NULL)
|
||||
{
|
||||
grammar_load_state_destroy (&g);
|
||||
error_msg(__LINE__, "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -2829,6 +2840,7 @@ grammar grammar_load_from_text (const byte *text)
|
|||
if (get_identifier (&text, &g->syntax_symbol))
|
||||
{
|
||||
grammar_load_state_destroy (&g);
|
||||
error_msg(__LINE__, "");
|
||||
return 0;
|
||||
}
|
||||
eat_spaces (&text);
|
||||
|
|
@ -2848,6 +2860,7 @@ grammar grammar_load_from_text (const byte *text)
|
|||
if (get_identifier (&text, &symbol))
|
||||
{
|
||||
grammar_load_state_destroy (&g);
|
||||
error_msg(__LINE__, "");
|
||||
return 0;
|
||||
}
|
||||
eat_spaces (&text);
|
||||
|
|
@ -2862,6 +2875,7 @@ grammar grammar_load_from_text (const byte *text)
|
|||
if (get_emtcode (&text, &ma))
|
||||
{
|
||||
grammar_load_state_destroy (&g);
|
||||
error_msg(__LINE__, "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -2877,6 +2891,7 @@ grammar grammar_load_from_text (const byte *text)
|
|||
if (get_regbyte (&text, &ma))
|
||||
{
|
||||
grammar_load_state_destroy (&g);
|
||||
error_msg(__LINE__, "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -2892,6 +2907,7 @@ grammar grammar_load_from_text (const byte *text)
|
|||
if (get_errtext (&text, &ma))
|
||||
{
|
||||
grammar_load_state_destroy (&g);
|
||||
error_msg(__LINE__, "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -2905,12 +2921,14 @@ grammar grammar_load_from_text (const byte *text)
|
|||
if (g->di->m_string != NULL)
|
||||
{
|
||||
grammar_load_state_destroy (&g);
|
||||
error_msg(__LINE__, "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (get_identifier (&text, &g->string_symbol))
|
||||
{
|
||||
grammar_load_state_destroy (&g);
|
||||
error_msg(__LINE__, "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -2927,6 +2945,7 @@ grammar grammar_load_from_text (const byte *text)
|
|||
if (get_rule (&text, &ru, g->maps, g->mapb))
|
||||
{
|
||||
grammar_load_state_destroy (&g);
|
||||
error_msg(__LINE__, "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -2940,6 +2959,7 @@ grammar grammar_load_from_text (const byte *text)
|
|||
if (ma == NULL)
|
||||
{
|
||||
grammar_load_state_destroy (&g);
|
||||
error_msg(__LINE__, "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -2953,6 +2973,7 @@ grammar grammar_load_from_text (const byte *text)
|
|||
g->di->m_regbytes))
|
||||
{
|
||||
grammar_load_state_destroy (&g);
|
||||
error_msg(__LINE__, "update_dependencies() failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue