On Tue, 2010-08-31 at 14:18 +0200, Łukasz Czerwiński wrote:
> Passing a string literal directly to g_message() is also not a
> idea. Please use g_message("%s", message) instead. But I
> understand what this part of your patch is trying to achieve.
> Why it's not a good idea? What's the difference? Nevertheless, ok,
> I'll change it.
It's potentially dangerous. g_message() takes a format string as the
first parameter. Of course you can pass a literal string to it. But in
case that literal string contains printf-like format directive, your
code will crash. Since we can't safely assume that the error message
will definitely not contain such format directives, it is safer to use
"%s" as the format string.
> A description of an optimization: all script-fu scripts loaded on
> startup was loaded using a command "(load ...)" of a TinyScheme
> language. This means running several functions escaping a path to a
> script, interpreting the string, choping it to tokens, analyzing,
> unescaping and finally loading the script. My optimization makes Gimp
> call directly a function loading a script without using a slow
> (comparing to calling one function in native C) TinyScheme
> interpreter. Instead I've written two helper functions
> (load_script_file and scheme_file_push) responsible for loading
> I have done also a second modification - connected with comparing
> strings (stricmp), but I've just spotted an error in it, so I'll fix
> it and send it later.
It would be best if you could start to use git for your changes. You can
then make separate commits for each of your changes and submit your
changes broken into smaller commits. That makes review a lot easier. It
is also easier for us to apply your patches then.
Gimp-developer mailing list