Kaydet (Commit) 3e31b904 authored tarafından Nick Treleaven's avatar Nick Treleaven

Make build_parse_make_dir() more efficient.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1156 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 7170df59
2007-01-04 Nick Treleaven <nick.treleaven@btinternet.com>
* src/build.c, src/build.h:
Make build_parse_make_dir() more efficient.
2007-01-03 Nick Treleaven <nick.treleaven@btinternet.com>
* src/sci_cb.c, tagmanager/entry.h, tagmanager/tm_tag.c,
......
......@@ -691,13 +691,16 @@ static gboolean build_iofunc(GIOChannel *ioc, GIOCondition cond, gpointer data)
{
//if (s != G_IO_STATUS_NORMAL && s != G_IO_STATUS_EOF) break;
gint color;
gchar *tmp;
color = (GPOINTER_TO_INT(data)) ? COLOR_DARK_RED : COLOR_BLACK;
g_strstrip(msg);
if (strstr(msg, "Entering directory") != NULL) {
if (build_parse_make_dir(msg, &tmp))
{
if (dir != NULL)
g_free(dir);
build_parse_make_dir(msg, &dir);
dir = tmp;
}
if (app->pref_editor_use_indicators)
......@@ -729,39 +732,37 @@ static gboolean build_iofunc(GIOChannel *ioc, GIOCondition cond, gpointer data)
}
gboolean build_parse_make_dir(gchar *string, gchar **prefix)
gboolean build_parse_make_dir(const gchar *string, gchar **prefix)
{
gchar *pos, *input;
const gchar *pos;
*prefix = NULL;
input = g_strdup(string);
if (input == NULL)
if (string == NULL)
return FALSE;
if ((pos = strstr(input, "Entering directory")) != NULL)
if ((pos = strstr(string, "Entering directory")) != NULL)
{
gsize len = strlen(input);
gsize len;
gchar *input;
//get the start of the path
pos = strstr(input, "/");
// get the start of the path
pos = strstr(string, "/");
if (pos == NULL) {
g_free(input);
if (pos == NULL)
return FALSE;
}
//kill the ' at the end of the path
input[len-1] = '\0';
input = g_strdup(pos);
//duplicate
*prefix = g_strdup(pos);
// kill the ' at the end of the path
len = strlen(input);
input[len - 1] = '\0';
input = g_realloc(input, len); // shorten by 1
*prefix = input;
g_free(input);
return TRUE;
}
g_free(input);
return FALSE;
}
......
......@@ -74,7 +74,7 @@ GPid build_view_tex_file(gint idx, gint mode);
GPid build_run_cmd(gint idx);
gboolean build_parse_make_dir(gchar *string, gchar **prefix);
gboolean build_parse_make_dir(const gchar *string, gchar **prefix);
void build_menu_update(gint idx);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment