Dan Hipschman wrote:
This is just a minor cleanup patch. Even if we're definitely sure a string doesn't contain any % signs, it's still better not to use it as a printf format string.
fputs() would be a faster alternative to that. Though i doubt that matters in this case.
bye michael
tools/widl/typegen.c | 4 ++-- tools/widl/widl.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index bf24d3f..53ec78c 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -2501,7 +2501,7 @@ void print_phase_basetype(FILE *file, int indent, enum remoting_phase phase, fprintf(file, " *)_StubMsg.Buffer = *"); else fprintf(file, " *)_StubMsg.Buffer = ");
fprintf(file, varname);
} else if (phase == PHASE_UNMARSHAL)fprintf(file, "%s", varname); fprintf(file, ";\n");
@@ -2510,7 +2510,7 @@ void print_phase_basetype(FILE *file, int indent, enum remoting_phase phase, print_file(file, indent, ""); else print_file(file, indent, "*");
fprintf(file, varname);
fprintf(file, "%s", varname); if (pass == PASS_IN && is_ptr(type)) fprintf(file, " = ("); else
diff --git a/tools/widl/widl.c b/tools/widl/widl.c index 53c9e29..37f1a5e 100644 --- a/tools/widl/widl.c +++ b/tools/widl/widl.c @@ -422,13 +422,13 @@ int main(int argc,char *argv[]) idfile_name = xstrdup(optarg); break; case 'V':
printf(version_string);
case 'W': pedantic = 1; break; default:printf("%s", version_string); return 0;
fprintf(stderr, usage);
} }fprintf(stderr, "%s", usage); return 1;
@@ -458,7 +458,7 @@ int main(int argc,char *argv[]) input_name = xstrdup(argv[optind]); } else {
- fprintf(stderr, usage);
- fprintf(stderr, "%s", usage); return 1; }
On Thu, Oct 18, 2007 at 11:12:23AM +0200, Michael Stefaniuc wrote:
Dan Hipschman wrote:
This is just a minor cleanup patch. Even if we're definitely sure a string doesn't contain any % signs, it's still better not to use it as a printf format string.
fputs() would be a faster alternative to that. Though i doubt that matters in this case.
You're right, I just use fputs so rarely that I sometimes forget it exists. Feel free to change them, but like you said, it probably doesn't matter much here.
Thanks.
Dan Hipschman wrote:
On Thu, Oct 18, 2007 at 11:12:23AM +0200, Michael Stefaniuc wrote:
Dan Hipschman wrote:
This is just a minor cleanup patch. Even if we're definitely sure a string doesn't contain any % signs, it's still better not to use it as a printf format string.
fputs() would be a faster alternative to that. Though i doubt that matters in this case.
You're right, I just use fputs so rarely that I sometimes forget it exists. Feel free to change them, but like you said, it probably doesn't matter much here.
No, i don't like fputs(). It has the arguments the wrong way around which is more confusing then using fprintf() (of course if it's not in the hot path and performance critical).
bye michael
On Thu, Oct 18, 2007 at 11:12:23AM +0200, Michael Stefaniuc wrote:
fprintf(file, varname);
fprintf(file, "%s", varname);
fputs() would be a faster alternative to that. Though i doubt that matters in this case.
FWIW gcc tends to convert fprintf(file, "%s", arg) into fputs(arg, file). Discovered on a semi-embedded system which had fprintf, but not fputs :-)
David