aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/glcpp/pp.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-02-01 10:02:38 +0000
committermarha <marha@users.sourceforge.net>2011-02-01 10:02:38 +0000
commit0bf07d32cbd460220c67d726900772cf3692746d (patch)
treeba6b1e1937e42744591715078444891d4ade5b1e /mesalib/src/glsl/glcpp/pp.c
parentcacf23d832a26e35851c9cc666304ac72cf8fe34 (diff)
downloadvcxsrv-0bf07d32cbd460220c67d726900772cf3692746d.tar.gz
vcxsrv-0bf07d32cbd460220c67d726900772cf3692746d.tar.bz2
vcxsrv-0bf07d32cbd460220c67d726900772cf3692746d.zip
libX11 libXinerama mesa git update 1 Feb 2011
Diffstat (limited to 'mesalib/src/glsl/glcpp/pp.c')
-rw-r--r--mesalib/src/glsl/glcpp/pp.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/mesalib/src/glsl/glcpp/pp.c b/mesalib/src/glsl/glcpp/pp.c
index e1a3a88a3..3640896a2 100644
--- a/mesalib/src/glsl/glcpp/pp.c
+++ b/mesalib/src/glsl/glcpp/pp.c
@@ -33,16 +33,15 @@ glcpp_error (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...)
va_list ap;
parser->error = 1;
- parser->info_log = talloc_asprintf_append(parser->info_log,
- "%u:%u(%u): "
+ ralloc_asprintf_append(&parser->info_log, "%u:%u(%u): "
"preprocessor error: ",
locp->source,
locp->first_line,
locp->first_column);
va_start(ap, fmt);
- parser->info_log = talloc_vasprintf_append(parser->info_log, fmt, ap);
+ ralloc_vasprintf_append(&parser->info_log, fmt, ap);
va_end(ap);
- parser->info_log = talloc_strdup_append(parser->info_log, "\n");
+ ralloc_strcat(&parser->info_log, "\n");
}
void
@@ -50,16 +49,15 @@ glcpp_warning (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...)
{
va_list ap;
- parser->info_log = talloc_asprintf_append(parser->info_log,
- "%u:%u(%u): "
+ ralloc_asprintf_append(&parser->info_log, "%u:%u(%u): "
"preprocessor warning: ",
locp->source,
locp->first_line,
locp->first_column);
va_start(ap, fmt);
- parser->info_log = talloc_vasprintf_append(parser->info_log, fmt, ap);
+ ralloc_vasprintf_append(&parser->info_log, fmt, ap);
va_end(ap);
- parser->info_log = talloc_strdup_append(parser->info_log, "\n");
+ ralloc_strcat(&parser->info_log, "\n");
}
/* Searches backwards for '^ *#' from a given starting point. */
@@ -92,7 +90,7 @@ remove_line_continuations(glcpp_parser_t *ctx, const char *shader)
{
int in_continued_line = 0;
int extra_newlines = 0;
- char *clean = talloc_strdup(ctx, "");
+ char *clean = ralloc_strdup(ctx, "");
const char *search_start = shader;
const char *newline;
while ((newline = strchr(search_start, '\n')) != NULL) {
@@ -122,27 +120,27 @@ remove_line_continuations(glcpp_parser_t *ctx, const char *shader)
}
if (in_continued_line) {
/* Copy everything before the \ */
- clean = talloc_strndup_append(clean, shader, backslash - shader);
+ ralloc_strncat(&clean, shader, backslash - shader);
shader = newline + 1;
extra_newlines++;
}
} else if (in_continued_line) {
/* Copy everything up to and including the \n */
- clean = talloc_strndup_append(clean, shader, newline - shader + 1);
+ ralloc_strncat(&clean, shader, newline - shader + 1);
shader = newline + 1;
/* Output extra newlines to make line numbers match */
for (; extra_newlines > 0; extra_newlines--)
- clean = talloc_strdup_append(clean, "\n");
+ ralloc_strcat(&clean, "\n");
in_continued_line = 0;
}
search_start = newline + 1;
}
- clean = talloc_strdup_append(clean, shader);
+ ralloc_strcat(&clean, shader);
return clean;
}
int
-preprocess(void *talloc_ctx, const char **shader, char **info_log,
+preprocess(void *ralloc_ctx, const char **shader, char **info_log,
const struct gl_extensions *extensions, int api)
{
int errors;
@@ -156,9 +154,9 @@ preprocess(void *talloc_ctx, const char **shader, char **info_log,
if (parser->skip_stack)
glcpp_error (&parser->skip_stack->loc, parser, "Unterminated #if\n");
- *info_log = talloc_strdup_append(*info_log, parser->info_log);
+ ralloc_strcat(info_log, parser->info_log);
- talloc_steal(talloc_ctx, parser->output);
+ ralloc_steal(ralloc_ctx, parser->output);
*shader = parser->output;
errors = parser->error;