Kaydet (Commit) d6c16742 authored tarafından Enrico Tröger's avatar Enrico Tröger

replaced macro __unix__ by HAVE_GLOB_H (closes #1387828)


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@85 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 88f81a13
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <ctype.h> #include <ctype.h>
#include <sys/types.h> #include <sys/types.h>
#include <string.h> #include <string.h>
#ifdef __unix__ #ifdef HAVE_GLOB_H
# include <glob.h> # include <glob.h>
#else #else
# ifndef P_tmpdir # ifndef P_tmpdir
...@@ -148,8 +148,9 @@ gboolean tm_workspace_load_global_tags(const char *tags_file) ...@@ -148,8 +148,9 @@ gboolean tm_workspace_load_global_tags(const char *tags_file)
gboolean tm_workspace_create_global_tags(const char *pre_process, const char **includes gboolean tm_workspace_create_global_tags(const char *pre_process, const char **includes
, int includes_count, const char *tags_file) , int includes_count, const char *tags_file)
{ {
#ifdef __unix__ #ifdef HAVE_GLOB_H
glob_t globbuf; glob_t globbuf;
#endif
int idx_inc; int idx_inc;
int idx_glob; int idx_glob;
char *command; char *command;
...@@ -168,7 +169,8 @@ gboolean tm_workspace_create_global_tags(const char *pre_process, const char **i ...@@ -168,7 +169,8 @@ gboolean tm_workspace_create_global_tags(const char *pre_process, const char **i
, tm_tag_attr_type_t, 0}; , tm_tag_attr_type_t, 0};
if (NULL == (fp = fopen(temp_file, "w"))) if (NULL == (fp = fopen(temp_file, "w")))
return FALSE; return FALSE;
#ifdef HAVE_GLOB_H
globbuf.gl_offs = 0; globbuf.gl_offs = 0;
for(idx_inc = 0; idx_inc < includes_count; idx_inc++) for(idx_inc = 0; idx_inc < includes_count; idx_inc++)
{ {
...@@ -188,6 +190,12 @@ gboolean tm_workspace_create_global_tags(const char *pre_process, const char **i ...@@ -188,6 +190,12 @@ gboolean tm_workspace_create_global_tags(const char *pre_process, const char **i
globfree(&globbuf); globfree(&globbuf);
free(clean_path); free(clean_path);
} }
#else
for(idx_inc = 0; idx_inc < includes_count; idx_inc++)
{
includes_files = g_list_append(includes_files, strdup(includes[idx_inc]));
}
#endif
/* Checks for duplicate file entries which would case trouble */ /* Checks for duplicate file entries which would case trouble */
...@@ -196,7 +204,7 @@ gboolean tm_workspace_create_global_tags(const char *pre_process, const char **i ...@@ -196,7 +204,7 @@ gboolean tm_workspace_create_global_tags(const char *pre_process, const char **i
struct stat sub_stat; struct stat sub_stat;
remove_count = 0; remove_count = 0;
list_len = g_list_length(includes_files); list_len = g_list_length(includes_files);
/* We look for files with the same inode */ /* We look for files with the same inode */
...@@ -207,20 +215,20 @@ gboolean tm_workspace_create_global_tags(const char *pre_process, const char **i ...@@ -207,20 +215,20 @@ gboolean tm_workspace_create_global_tags(const char *pre_process, const char **i
for(idx_sub = idx_main + 1; idx_sub < list_len; idx_sub++) for(idx_sub = idx_main + 1; idx_sub < list_len; idx_sub++)
{ {
GList *element = NULL; GList *element = NULL;
stat(g_list_nth_data(includes_files, idx_sub), &sub_stat); stat(g_list_nth_data(includes_files, idx_sub), &sub_stat);
if(main_stat.st_ino != sub_stat.st_ino) if(main_stat.st_ino != sub_stat.st_ino)
continue; continue;
/* Inodes match */ /* Inodes match */
element = g_list_nth(includes_files, idx_sub); element = g_list_nth(includes_files, idx_sub);
/* printf("%s == %s\n", g_list_nth_data(includes_files, idx_main), /* printf("%s == %s\n", g_list_nth_data(includes_files, idx_main),
g_list_nth_data(includes_files, idx_sub)); */ g_list_nth_data(includes_files, idx_sub)); */
/* We delete the duplicate entry from the list */ /* We delete the duplicate entry from the list */
includes_files = g_list_remove_link(includes_files, element); includes_files = g_list_remove_link(includes_files, element);
remove_count++; remove_count++;
...@@ -228,7 +236,7 @@ gboolean tm_workspace_create_global_tags(const char *pre_process, const char **i ...@@ -228,7 +236,7 @@ gboolean tm_workspace_create_global_tags(const char *pre_process, const char **i
/* Don't forget to free the mallocs (we duplicated every string earlier!) */ /* Don't forget to free the mallocs (we duplicated every string earlier!) */
free(element->data); free(element->data);
idx_sub--; /* Cause the inner loop not to move; good since we removed idx_sub--; /* Cause the inner loop not to move; good since we removed
an element at the current position; we don't have to worry an element at the current position; we don't have to worry
about the outer loop because the inner loop always starts about the outer loop because the inner loop always starts
after the outer loop's index */ after the outer loop's index */
...@@ -252,7 +260,7 @@ gboolean tm_workspace_create_global_tags(const char *pre_process, const char **i ...@@ -252,7 +260,7 @@ gboolean tm_workspace_create_global_tags(const char *pre_process, const char **i
free(str); free(str);
free(g_list_nth(includes_files, idx_main) -> data); free(g_list_nth(includes_files, idx_main) -> data);
} }
fclose(fp); fclose(fp);
command = g_strdup_printf("%s %s >%s", pre_process, temp_file, temp_file2); command = g_strdup_printf("%s %s >%s", pre_process, temp_file, temp_file2);
...@@ -301,7 +309,6 @@ gboolean tm_workspace_create_global_tags(const char *pre_process, const char **i ...@@ -301,7 +309,6 @@ gboolean tm_workspace_create_global_tags(const char *pre_process, const char **i
tm_source_file_free(source_file); tm_source_file_free(source_file);
g_ptr_array_free(tags_array, TRUE); g_ptr_array_free(tags_array, TRUE);
return TRUE; return TRUE;
#endif
} }
TMWorkObject *tm_workspace_find_object(TMWorkObject *work_object, const char *file_name TMWorkObject *tm_workspace_find_object(TMWorkObject *work_object, const char *file_name
...@@ -371,7 +378,7 @@ gboolean tm_workspace_update(TMWorkObject *workspace, gboolean force ...@@ -371,7 +378,7 @@ gboolean tm_workspace_update(TMWorkObject *workspace, gboolean force
{ {
guint i; guint i;
gboolean update_tags = force; gboolean update_tags = force;
#ifdef TM_DEBUG #ifdef TM_DEBUG
g_message("Updating workspace"); g_message("Updating workspace");
#endif #endif
...@@ -423,7 +430,7 @@ const GPtrArray *tm_workspace_find(const char *name, int type, TMTagAttrType *at ...@@ -423,7 +430,7 @@ const GPtrArray *tm_workspace_find(const char *name, int type, TMTagAttrType *at
static GPtrArray *tags = NULL; static GPtrArray *tags = NULL;
TMTag **matches[2], **match; TMTag **matches[2], **match;
int i, len, tagCount[2]={0,0}, tagIter; int i, len, tagCount[2]={0,0}, tagIter;
if ((!theWorkspace) || (!name)) if ((!theWorkspace) || (!name))
return NULL; return NULL;
len = strlen(name); len = strlen(name);
......
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