[GRASS-dev] G_message () family of functions

Ivan Shmakov ivan at theory.asu.ru
Sat Jan 12 12:06:32 EST 2008


>>>>> Ivan Shmakov <ivan at theory.asu.ru> writes:
>>>>> Glynn Clements <glynn at gclements.plus.com> writes:

 >> More generally, anything matching:

 >> grep '\[[0-9][0-9][0-9]*\]'

 >> deserves at least a cursory glance. Many of those should really be
 >> using a #define'd constant, even if it's local to a single source
 >> file.

[...]

 > * misused G_warning (), etc.; like:

 > char BUF[...]; sprintf (BUF, FORMAT, ...); G_warning (BUF);

 > instead of:

 > G_warning (FORMAT, ...);

 > (the documentation should emphasize the first argument being the
 > printf ()-style format string, and /not/ the message); there're just
 > too many of these and I hope to handle them with a script;

	The following command should catch most of these:

$ grep --context=5 --recurse --include=\*.c -E \
      'G_(warning|fatal_error|([[:alnum:]_]+_)?message)[[:blank:]]*([[:alnum:]_]+)' \
      .

	BTW, the correct pattern for issuing a string message is:

   G_message ("%s", string);

	not:

   G_message (string);

[...]



More information about the grass-dev mailing list