glcpp: Remove xtalloc wrappers in favor of plain talloc.
Calling exit() on a memory failure probably made sense for the standalone preprocessor, but doesn't seem too appealing as part of the GL library. Also, we don't use it in the main compiler.
This commit is contained in:
@@ -503,7 +503,7 @@ _string_list_create (void *ctx)
|
||||
{
|
||||
string_list_t *list;
|
||||
|
||||
list = xtalloc (ctx, string_list_t);
|
||||
list = talloc (ctx, string_list_t);
|
||||
list->head = NULL;
|
||||
list->tail = NULL;
|
||||
|
||||
@@ -515,8 +515,8 @@ _string_list_append_item (string_list_t *list, const char *str)
|
||||
{
|
||||
string_node_t *node;
|
||||
|
||||
node = xtalloc (list, string_node_t);
|
||||
node->str = xtalloc_strdup (node, str);
|
||||
node = talloc (list, string_node_t);
|
||||
node->str = talloc_strdup (node, str);
|
||||
|
||||
node->next = NULL;
|
||||
|
||||
@@ -569,7 +569,7 @@ _argument_list_create (void *ctx)
|
||||
{
|
||||
argument_list_t *list;
|
||||
|
||||
list = xtalloc (ctx, argument_list_t);
|
||||
list = talloc (ctx, argument_list_t);
|
||||
list->head = NULL;
|
||||
list->tail = NULL;
|
||||
|
||||
@@ -581,7 +581,7 @@ _argument_list_append (argument_list_t *list, token_list_t *argument)
|
||||
{
|
||||
argument_node_t *node;
|
||||
|
||||
node = xtalloc (list, argument_node_t);
|
||||
node = talloc (list, argument_node_t);
|
||||
node->argument = argument;
|
||||
|
||||
node->next = NULL;
|
||||
@@ -638,7 +638,7 @@ _token_create_str (void *ctx, int type, char *str)
|
||||
{
|
||||
token_t *token;
|
||||
|
||||
token = xtalloc (ctx, token_t);
|
||||
token = talloc (ctx, token_t);
|
||||
token->type = type;
|
||||
token->value.str = talloc_steal (token, str);
|
||||
|
||||
@@ -650,7 +650,7 @@ _token_create_ival (void *ctx, int type, int ival)
|
||||
{
|
||||
token_t *token;
|
||||
|
||||
token = xtalloc (ctx, token_t);
|
||||
token = talloc (ctx, token_t);
|
||||
token->type = type;
|
||||
token->value.ival = ival;
|
||||
|
||||
@@ -662,7 +662,7 @@ _token_list_create (void *ctx)
|
||||
{
|
||||
token_list_t *list;
|
||||
|
||||
list = xtalloc (ctx, token_list_t);
|
||||
list = talloc (ctx, token_list_t);
|
||||
list->head = NULL;
|
||||
list->tail = NULL;
|
||||
list->non_space_tail = NULL;
|
||||
@@ -675,8 +675,8 @@ _token_list_append (token_list_t *list, token_t *token)
|
||||
{
|
||||
token_node_t *node;
|
||||
|
||||
node = xtalloc (list, token_node_t);
|
||||
node->token = xtalloc_reference (list, token);
|
||||
node = talloc (list, token_node_t);
|
||||
node->token = talloc_reference (list, token);
|
||||
|
||||
node->next = NULL;
|
||||
|
||||
@@ -871,8 +871,8 @@ _token_paste (glcpp_parser_t *parser, token_t *token, token_t *other)
|
||||
{
|
||||
char *str;
|
||||
|
||||
str = xtalloc_asprintf (token, "%s%s",
|
||||
token->value.str, other->value.str);
|
||||
str = talloc_asprintf (token, "%s%s", token->value.str,
|
||||
other->value.str);
|
||||
combined = _token_create_str (token, token->type, str);
|
||||
combined->location = token->location;
|
||||
return combined;
|
||||
@@ -927,7 +927,7 @@ glcpp_parser_create (const struct gl_extensions *extensions)
|
||||
glcpp_parser_t *parser;
|
||||
int language_version;
|
||||
|
||||
parser = xtalloc (NULL, glcpp_parser_t);
|
||||
parser = talloc (NULL, glcpp_parser_t);
|
||||
|
||||
glcpp_lex_init_extra (parser, &parser->scanner);
|
||||
parser->defines = hash_table_ctor (32, hash_table_string_hash,
|
||||
@@ -1294,7 +1294,7 @@ _glcpp_parser_expand_node (glcpp_parser_t *parser,
|
||||
token_list_t *expansion;
|
||||
token_t *final;
|
||||
|
||||
str = xtalloc_strdup (parser, token->value.str);
|
||||
str = talloc_strdup (parser, token->value.str);
|
||||
final = _token_create_str (parser, OTHER, str);
|
||||
expansion = _token_list_create (parser);
|
||||
_token_list_append (expansion, final);
|
||||
@@ -1330,8 +1330,8 @@ _active_list_push (active_list_t *list,
|
||||
{
|
||||
active_list_t *node;
|
||||
|
||||
node = xtalloc (list, active_list_t);
|
||||
node->identifier = xtalloc_strdup (node, identifier);
|
||||
node = talloc (list, active_list_t);
|
||||
node->identifier = talloc_strdup (node, identifier);
|
||||
node->marker = marker;
|
||||
node->next = list;
|
||||
|
||||
@@ -1481,7 +1481,7 @@ _define_object_macro (glcpp_parser_t *parser,
|
||||
if (loc != NULL)
|
||||
_check_for_reserved_macro_name(parser, loc, identifier);
|
||||
|
||||
macro = xtalloc (parser, macro_t);
|
||||
macro = talloc (parser, macro_t);
|
||||
|
||||
macro->is_function = 0;
|
||||
macro->parameters = NULL;
|
||||
@@ -1502,7 +1502,7 @@ _define_function_macro (glcpp_parser_t *parser,
|
||||
|
||||
_check_for_reserved_macro_name(parser, loc, identifier);
|
||||
|
||||
macro = xtalloc (parser, macro_t);
|
||||
macro = talloc (parser, macro_t);
|
||||
|
||||
macro->is_function = 1;
|
||||
macro->parameters = talloc_steal (macro, parameters);
|
||||
@@ -1628,7 +1628,7 @@ _glcpp_parser_skip_stack_push_if (glcpp_parser_t *parser, YYLTYPE *loc,
|
||||
if (parser->skip_stack)
|
||||
current = parser->skip_stack->type;
|
||||
|
||||
node = xtalloc (parser, skip_node_t);
|
||||
node = talloc (parser, skip_node_t);
|
||||
node->loc = *loc;
|
||||
|
||||
if (current == SKIP_NO_SKIP) {
|
||||
|
||||
Reference in New Issue
Block a user