avoid excessive use of strdup() and strcmp(). The strings are all constant

2004-08-30  Sven Neumann  <sven@gimp.org>

	* app/tools/gimpvectortool.[ch] (gimp_vector_tool_status_set):
	avoid excessive use of strdup() and strcmp(). The strings are all
	constant anyway.
This commit is contained in:
Sven Neumann 2004-08-30 15:08:02 +00:00 committed by Sven Neumann
parent 509b88e815
commit d1825782ea
3 changed files with 11 additions and 9 deletions

View File

@ -1,3 +1,9 @@
2004-08-30 Sven Neumann <sven@gimp.org>
* app/tools/gimpvectortool.[ch] (gimp_vector_tool_status_set):
avoid extensive use of strdup() and strcmp(). The strings are all
constant anyway.
2004-08-30 Michael Natterer <mitch@gimp.org>
Brought the PDB progress into a working state. Fixes bug #6010,

View File

@ -1174,7 +1174,7 @@ gimp_vector_tool_status_update (GimpTool *tool,
{
GimpVectorTool *vector_tool = GIMP_VECTOR_TOOL (tool);
GimpDisplayShell *shell;
gchar *new_status = NULL;
const gchar *new_status = NULL;
shell = tool->gdisp ? GIMP_DISPLAY_SHELL (tool->gdisp->shell) : NULL;
@ -1245,24 +1245,20 @@ gimp_vector_tool_status_set (GimpTool *tool,
const gchar *message)
{
GimpVectorTool *vector_tool = GIMP_VECTOR_TOOL (tool);
gboolean msg_differs = TRUE;
if (vector_tool->status_msg && message)
msg_differs = strcmp (vector_tool->status_msg, message);
if (tool->gdisp && msg_differs)
if (tool->gdisp &&
vector_tool->status_msg != message)
{
if (vector_tool->status_msg)
{
gimp_tool_pop_status (tool);
g_free (vector_tool->status_msg);
vector_tool->status_msg = NULL;
}
if (message)
{
gimp_tool_push_status (tool, message);
vector_tool->status_msg = g_strdup (message);
vector_tool->status_msg = message;
}
}
}

View File

@ -63,7 +63,7 @@ struct _GimpVectorTool
{
GimpDrawTool parent_instance;
gchar *status_msg; /* keep track of the status message */
const gchar *status_msg; /* current status message */
GimpVectorFunction function; /* function we're performing */
GimpAnchorFeatureType restriction; /* movement restriction */