summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Krol <[email protected]>2009-11-21 20:44:16 +0100
committerMichal Krol <[email protected]>2009-11-21 20:44:16 +0100
commit6199a0cf89034ab92ac61158a25902acc17604f4 (patch)
tree5f12c228f669297108c298071802c4a02ebb7525
parent1cf021475a6628cdf4c26457bc7ca0c603fe2c7c (diff)
glsl/apps: No need to purify source text for tokeniser.
-rw-r--r--src/glsl/apps/compile.c19
-rw-r--r--src/glsl/apps/process.c19
-rw-r--r--src/glsl/apps/tokenise.c19
-rw-r--r--src/glsl/apps/version.c19
4 files changed, 16 insertions, 60 deletions
diff --git a/src/glsl/apps/compile.c b/src/glsl/apps/compile.c
index edc426528bd..d16dac58681 100644
--- a/src/glsl/apps/compile.c
+++ b/src/glsl/apps/compile.c
@@ -41,7 +41,6 @@ main(int argc,
long size;
char *inbuf;
struct sl_pp_purify_options options;
- char *outbuf;
char errmsg[100] = "";
unsigned int errline = 0;
struct sl_pp_context *context;
@@ -105,35 +104,25 @@ main(int argc,
memset(&options, 0, sizeof(options));
- if (sl_pp_purify(inbuf, &options, &outbuf, errmsg, sizeof(errmsg), &errline)) {
- fprintf(out, "$PURIFYERROR %s\n", errmsg);
-
- free(inbuf);
- fclose(out);
- return 1;
- }
-
- free(inbuf);
-
context = sl_pp_context_create();
if (!context) {
fprintf(out, "$CONTEXERROR\n");
- free(outbuf);
+ free(inbuf);
fclose(out);
return 1;
}
- if (sl_pp_tokenise(context, outbuf, &tokens)) {
+ if (sl_pp_tokenise(context, inbuf, &options, &tokens)) {
fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context));
sl_pp_context_destroy(context);
- free(outbuf);
+ free(inbuf);
fclose(out);
return 1;
}
- free(outbuf);
+ free(inbuf);
if (sl_pp_version(context, tokens, &version, &tokens_eaten)) {
fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context));
diff --git a/src/glsl/apps/process.c b/src/glsl/apps/process.c
index 7f392613e09..2cec9a99719 100644
--- a/src/glsl/apps/process.c
+++ b/src/glsl/apps/process.c
@@ -40,7 +40,6 @@ main(int argc,
long size;
char *inbuf;
struct sl_pp_purify_options options;
- char *outbuf;
char errmsg[100] = "";
unsigned int errline = 0;
struct sl_pp_context *context;
@@ -93,35 +92,25 @@ main(int argc,
memset(&options, 0, sizeof(options));
- if (sl_pp_purify(inbuf, &options, &outbuf, errmsg, sizeof(errmsg), &errline)) {
- fprintf(out, "$PURIFYERROR %s\n", errmsg);
-
- free(inbuf);
- fclose(out);
- return 1;
- }
-
- free(inbuf);
-
context = sl_pp_context_create();
if (!context) {
fprintf(out, "$CONTEXERROR\n");
- free(outbuf);
+ free(inbuf);
fclose(out);
return 1;
}
- if (sl_pp_tokenise(context, outbuf, &tokens)) {
+ if (sl_pp_tokenise(context, inbuf, &options, &tokens)) {
fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context));
sl_pp_context_destroy(context);
- free(outbuf);
+ free(inbuf);
fclose(out);
return 1;
}
- free(outbuf);
+ free(inbuf);
if (sl_pp_version(context, tokens, &version, &tokens_eaten)) {
fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context));
diff --git a/src/glsl/apps/tokenise.c b/src/glsl/apps/tokenise.c
index 9dd9631a4ed..eb86e3df69e 100644
--- a/src/glsl/apps/tokenise.c
+++ b/src/glsl/apps/tokenise.c
@@ -40,7 +40,6 @@ main(int argc,
long size;
char *inbuf;
struct sl_pp_purify_options options;
- char *outbuf;
char errmsg[100] = "";
unsigned int errline = 0;
struct sl_pp_context *context;
@@ -90,35 +89,25 @@ main(int argc,
memset(&options, 0, sizeof(options));
- if (sl_pp_purify(inbuf, &options, &outbuf, errmsg, sizeof(errmsg), &errline)) {
- fprintf(out, "$PURIFYERROR %s\n", errmsg);
-
- free(inbuf);
- fclose(out);
- return 1;
- }
-
- free(inbuf);
-
context = sl_pp_context_create();
if (!context) {
fprintf(out, "$CONTEXERROR\n");
- free(outbuf);
+ free(inbuf);
fclose(out);
return 1;
}
- if (sl_pp_tokenise(context, outbuf, &tokens)) {
+ if (sl_pp_tokenise(context, inbuf, &options, &tokens)) {
fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context));
sl_pp_context_destroy(context);
- free(outbuf);
+ free(inbuf);
fclose(out);
return 1;
}
- free(outbuf);
+ free(inbuf);
for (i = 0; tokens[i].token != SL_PP_EOF; i++) {
switch (tokens[i].token) {
diff --git a/src/glsl/apps/version.c b/src/glsl/apps/version.c
index 1127dae5161..b1d0d6ff282 100644
--- a/src/glsl/apps/version.c
+++ b/src/glsl/apps/version.c
@@ -40,7 +40,6 @@ main(int argc,
long size;
char *inbuf;
struct sl_pp_purify_options options;
- char *outbuf;
char errmsg[100] = "";
unsigned int errline = 0;
struct sl_pp_context *context;
@@ -91,35 +90,25 @@ main(int argc,
memset(&options, 0, sizeof(options));
- if (sl_pp_purify(inbuf, &options, &outbuf, errmsg, sizeof(errmsg), &errline)) {
- fprintf(out, "$PURIFYERROR %s\n", errmsg);
-
- free(inbuf);
- fclose(out);
- return 1;
- }
-
- free(inbuf);
-
context = sl_pp_context_create();
if (!context) {
fprintf(out, "$CONTEXERROR\n");
- free(outbuf);
+ free(inbuf);
fclose(out);
return 1;
}
- if (sl_pp_tokenise(context, outbuf, &tokens)) {
+ if (sl_pp_tokenise(context, inbuf, &options, &tokens)) {
fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context));
sl_pp_context_destroy(context);
- free(outbuf);
+ free(inbuf);
fclose(out);
return 1;
}
- free(outbuf);
+ free(inbuf);
if (sl_pp_version(context, tokens, &version, &tokens_eaten)) {
fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context));