[geany/geany] 52076d: Remove unused tm_file_entry.[ch]
Jiří Techet
git-noreply at xxxxx
Sat Nov 8 18:57:46 UTC 2014
Branch: refs/heads/master
Author: Jiří Techet <techet at gmail.com>
Committer: Jiří Techet <techet at gmail.com>
Date: Sat, 18 Oct 2014 19:40:10 UTC
Commit: 52076d19e8fe7ab41ebc92928ef7832c248a51f2
https://github.com/geany/geany/commit/52076d19e8fe7ab41ebc92928ef7832c248a51f2
Log Message:
-----------
Remove unused tm_file_entry.[ch]
Modified Paths:
--------------
tagmanager/src/Makefile.am
tagmanager/src/makefile.win32
tagmanager/src/tm_file_entry.c
tagmanager/src/tm_file_entry.h
tagmanager/src/tm_tagmanager.h
wscript
Modified: tagmanager/src/Makefile.am
2 lines changed, 0 insertions(+), 2 deletions(-)
===================================================================
@@ -23,8 +23,6 @@ tagmanager_include_HEADERS = \
libtagmanager_a_SOURCES =\
tm_tagmanager.h \
tm_parser.h \
- tm_file_entry.h \
- tm_file_entry.c \
tm_source_file.h \
tm_source_file.c \
tm_tag.h \
Modified: tagmanager/src/makefile.win32
3 lines changed, 1 insertions(+), 2 deletions(-)
===================================================================
@@ -44,8 +44,7 @@ all: $(COMPLIB)
clean:
-$(RM) deps.mak *.o $(COMPLIB)
-$(COMPLIB): tm_workspace.o tm_source_file.o tm_tag.o \
-tm_file_entry.o
+$(COMPLIB): tm_workspace.o tm_source_file.o tm_tag.o
$(AR) rc $@ $^
$(RANLIB) $@
Modified: tagmanager/src/tm_file_entry.c
281 lines changed, 0 insertions(+), 281 deletions(-)
===================================================================
@@ -1,281 +0,0 @@
-/*
-*
-* Copyright (c) 2001-2002, Biswapesh Chattopadhyay
-*
-* This source code is released for free distribution under the terms of the
-* GNU General Public License.
-*
-*/
-
-#include "general.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <dirent.h>
-#ifdef HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifdef HAVE_FNMATCH_H
-# include <fnmatch.h>
-#endif
-#include <glib/gstdio.h>
-
-#include "tm_file_entry.h"
-#include "tm_source_file.h"
-
-#define FILE_NEW(T) ((T) = g_slice_new0(TMFileEntry))
-#define FILE_FREE(T) g_slice_free(TMFileEntry, (T))
-
-
-void tm_file_entry_print(TMFileEntry *entry, gpointer UNUSED user_data
- , guint level)
-{
- guint i;
-
- g_return_if_fail(entry);
- for (i=0; i < level; ++i)
- fputc('\t', stderr);
- fprintf(stderr, "%s\n", entry->name);
-}
-
-gint tm_file_entry_compare(TMFileEntry *e1, TMFileEntry *e2)
-{
- g_return_val_if_fail(e1 && e2 && e1->name && e2->name, 0);
-#ifdef TM_DEBUG
- g_message("Comparing %s and %s", e1->name, e2->name);
-#endif
- return strcmp(e1->name, e2->name);
-}
-
-/* TTimo - modified to handle symlinks */
-static TMFileType tm_file_entry_type(const char *path)
-{
- struct stat s;
-
-#ifndef G_OS_WIN32
- if (0 != g_lstat(path, &s))
- return tm_file_unknown_t;
-#endif
- if (S_ISDIR(s.st_mode))
- return tm_file_dir_t;
-#ifndef G_OS_WIN32
- else if (S_ISLNK(s.st_mode))
- return tm_file_link_t;
-#endif
- else if (S_ISREG(s.st_mode))
- return tm_file_regular_t;
- else
- return tm_file_unknown_t;
-}
-
-static gboolean apply_filter(const char *name, GList *match, GList *unmatch
- , gboolean ignore_hidden)
-{
- GList *tmp;
- gboolean matched = (match == NULL);
- g_return_val_if_fail(name, FALSE);
- if (ignore_hidden && ('.' == name[0]))
- return FALSE;
- /* TTimo - ignore .svn directories */
- if (!strcmp(name, ".svn"))
- return FALSE;
- for (tmp = match; tmp; tmp = g_list_next(tmp))
- {
- if (0 == fnmatch((char *) tmp->data, name, 0))
- {
- matched = TRUE;
- break;
- }
- }
- if (!matched)
- return FALSE;
- for (tmp = unmatch; tmp; tmp = g_list_next(tmp))
- {
- if (0 == fnmatch((char *) tmp->data, name, 0))
- {
- return FALSE;
- }
- }
- return matched;
-}
-
-TMFileEntry *tm_file_entry_new(const char *path, TMFileEntry *parent
- , gboolean recurse, GList *file_match, GList *file_unmatch
- , GList *dir_match, GList *dir_unmatch, gboolean ignore_hidden_files
- , gboolean ignore_hidden_dirs)
-{
- TMFileEntry *entry;
- /* GList *tmp; */
- char *real_path;
- DIR *dir;
- struct dirent *dir_entry;
- TMFileEntry *new_entry;
- char *file_name;
- struct stat s;
- char *entries = NULL;
-
- g_return_val_if_fail (path != NULL, NULL);
-
- /* TTimo - don't follow symlinks */
- if (tm_file_entry_type(path) == tm_file_link_t)
- return NULL;
- real_path = tm_get_real_path(path);
- if (!real_path)
- return NULL;
- FILE_NEW(entry);
- entry->type = tm_file_entry_type(real_path);
- entry->parent = parent;
- entry->path = real_path;
- entry->name = strrchr(entry->path, '/');
- if (entry->name)
- ++ (entry->name);
- else
- entry->name = entry->path;
- switch(entry->type)
- {
- case tm_file_unknown_t:
- g_free(real_path);
- FILE_FREE(entry);
- return NULL;
- case tm_file_link_t:
- case tm_file_regular_t:
- if (parent && !apply_filter(entry->name, file_match, file_unmatch
- , ignore_hidden_files))
- {
- tm_file_entry_free(entry);
- return NULL;
- }
- break;
- case tm_file_dir_t:
- if (parent && !(recurse && apply_filter(entry->name, dir_match
- , dir_unmatch, ignore_hidden_dirs)))
- {
- tm_file_entry_free(entry);
- return NULL;
- }
- file_name = g_strdup_printf("%s/CVS/Entries", entry->path);
- if (0 == g_stat(file_name, &s))
- {
- if (S_ISREG(s.st_mode))
- {
- int fd;
- entries = g_new(char, s.st_size + 2);
- if (0 > (fd = open(file_name, O_RDONLY)))
- {
- g_free(entries);
- entries = NULL;
- }
- else
- {
- off_t n =0;
- off_t total_read = 1;
- while (0 < (n = read(fd, entries + total_read, s.st_size - total_read)))
- total_read += n;
- entries[s.st_size] = '\0';
- entries[0] = '\n';
- close(fd);
- entry->version = g_strdup("D");
- }
- }
- }
- g_free(file_name);
- if (NULL != (dir = opendir(entry->path)))
- {
- while (NULL != (dir_entry = readdir(dir)))
- {
- if ((0 == strcmp(dir_entry->d_name, "."))
- || (0 == strcmp(dir_entry->d_name, "..")))
- continue;
- file_name = g_strdup_printf("%s/%s", entry->path, dir_entry->d_name);
- new_entry = tm_file_entry_new(file_name, entry, recurse
- , file_match, file_unmatch, dir_match, dir_unmatch
- , ignore_hidden_files, ignore_hidden_dirs);
- g_free(file_name);
- if (new_entry)
- {
- if (entries)
- {
- char *str = g_strconcat("\n/", new_entry->name, "/", NULL);
- char *name_pos = strstr(entries, str);
- if (NULL != name_pos)
- {
- int len = strlen(str);
- char *version_pos = strchr(name_pos + len, '/');
- if (NULL != version_pos)
- {
- *version_pos = '\0';
- new_entry->version = g_strdup(name_pos + len);
- *version_pos = '/';
- }
- }
- g_free(str);
- }
- entry->children = g_slist_prepend(entry->children, new_entry);
- }
- }
- }
- closedir(dir);
- entry->children = g_slist_sort(entry->children, (GCompareFunc) tm_file_entry_compare);
- g_free(entries);
- break;
- }
- return entry;
-}
-
-void tm_file_entry_free(gpointer entry)
-{
- if (entry)
- {
- TMFileEntry *file_entry = TM_FILE_ENTRY(entry);
- if (file_entry->children)
- {
- GSList *tmp;
- for (tmp = file_entry->children; tmp; tmp = g_slist_next(tmp))
- tm_file_entry_free(tmp->data);
- g_slist_free(file_entry->children);
- }
- g_free(file_entry->version);
- g_free(file_entry->path);
- FILE_FREE(file_entry);
- }
-}
-
-void tm_file_entry_foreach(TMFileEntry *entry, TMFileEntryFunc func
- , gpointer user_data, guint level, gboolean reverse)
-{
- g_return_if_fail (entry != NULL);
- g_return_if_fail (func != NULL);
-
- if ((reverse) && (entry->children))
- {
- GSList *tmp;
- for (tmp = entry->children; tmp; tmp = g_slist_next(tmp))
- tm_file_entry_foreach(TM_FILE_ENTRY(tmp->data), func
- , user_data, level + 1, TRUE);
- }
- func(entry, user_data, level);
- if ((!reverse) && (entry->children))
- {
- GSList *tmp;
- for (tmp = entry->children; tmp; tmp = g_slist_next(tmp))
- tm_file_entry_foreach(TM_FILE_ENTRY(tmp->data), func
- , user_data, level + 1, FALSE);
- }
-}
-
-GList *tm_file_entry_list(TMFileEntry *entry, GList *files)
-{
- GSList *tmp;
- files = g_list_prepend(files, g_strdup(entry->path));
- for (tmp = entry->children; tmp; tmp = g_slist_next(tmp))
- {
- files = tm_file_entry_list((TMFileEntry *) tmp->data, files);
- }
- if (!files)
- files = g_list_reverse(files);
- return files;
-}
Modified: tagmanager/src/tm_file_entry.h
124 lines changed, 0 insertions(+), 124 deletions(-)
===================================================================
@@ -1,124 +0,0 @@
-/*
-*
-* Copyright (c) 2001-2002, Biswapesh Chattopadhyay
-*
-* This source code is released for free distribution under the terms of the
-* GNU General Public License.
-*
-*/
-
-#ifndef TM_FILE_ENTRY_H
-#define TM_FILE_ENTRY_H
-
-#include <glib.h>
-
-/* \file
-The TMFileEntry structure and associated functions can be used
-for file and directory traversal. The following example demonstrates
-the use of TMFileEntry.
-\include tm_file_tree_dump.c
-*/
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-/* Enum defining file types */
-typedef enum
-{
- tm_file_unknown_t, /* Unknown file type/file does not exist */
- tm_file_regular_t, /* Is a regular file */
- tm_file_dir_t, /* Is a directory */
- tm_file_link_t /* Is a symbolic link */
-} TMFileType;
-
-/*
- This example demonstrates the use of TMFileEntry and associated functions
- for managing file hierarchies in a project.
-
- \example tm_file_tree_dump.c
-*/
-
-/* This structure stores the file tree */
-typedef struct _TMFileEntry
-{
- TMFileType type; /* File type */
- char *path; /* Full path to the file (incl. dir and name) */
- char *name; /* Just the file name (path minus the directory) */
- char *version; /* CVS version in case there is a CVS entry for this file */
- struct _TMFileEntry *parent; /* The parent directory file entry */
- GSList *children; /* List of children (for directory) */
-} TMFileEntry;
-
-/* Prototype for the function that gets called for each entry when
- tm_file_entry_foreach() is called.
-*/
-typedef void (*TMFileEntryFunc) (TMFileEntry *entry, gpointer user_data
- , guint level);
-
-/* Convinience casting macro */
-#define TM_FILE_ENTRY(E) ((TMFileEntry *) (E))
-
-/* Function that compares two file entries on name and returns the
- difference
-*/
-gint tm_file_entry_compare(TMFileEntry *e1, TMFileEntry *e2);
-
-/* Function to create a new file entry structure.
-\param path Path to the file for which the entry is to be created.
-\param parent Should be NULL for the first call. Since the function calls
- itself recursively, this parameter is required to build the hierarchy.
-\param recurse Whether the entry is to be recursively scanned (for
- directories only)
-\param file_match List of file name patterns to match. If set to NULL,
- all files match. You can use wildcards like '*.c'. See the example program
- for usage.
-\param file_unmatch Opposite of file_match. All files matching any of the patterns
- supplied are ignored. If set to NULL, no file is ignored.
-\param dir_match List of directory name patterns to match. If set to NULL,
- all directories match. You can use wildcards like '\.*'.
-\param dir_unmatch Opposite of dir_match. All directories matching any of the
- patterns supplied are ignored. If set to NULL, no directory is ignored.
-\param ignore_hidden_files If set to TRUE, hidden files (starting with '.')
- are ignored.
-\param ignore_hidden_dirs If set to TRUE, hidden directories (starting with '.')
- are ignored.
-\return Populated TMFileEntry structure on success, NULL on failure.
-*/
-TMFileEntry *tm_file_entry_new(const char *path, TMFileEntry *parent
- , gboolean recurse, GList *file_match, GList *file_unmatch
- , GList *dir_match, GList *dir_unmatch, gboolean ignore_hidden_files
- , gboolean ignore_hidden_dirs);
-
-/* Frees a TMFileEntry structure. Freeing is recursive, so all child
- entries are freed as well.
-\param entry The TMFileEntry structure to be freed.
-*/
-void tm_file_entry_free(gpointer entry);
-
-/* This will call the function func() for each file entry.
-\param entry The root file entry.
-\param func The function to be called.
-\param user_data Extra information to be passed to the function.
-\param level The recursion level. You should set this to 0 initially.
-\param reverse If set to TRUE, traversal is in reverse hierarchical order
-*/
-void tm_file_entry_foreach(TMFileEntry *entry, TMFileEntryFunc func
- , gpointer user_data, guint level, gboolean reverse);
-
-/* This is a sample function to show the use of tm_file_entry_foreach().
-*/
-void tm_file_entry_print(TMFileEntry *entry, gpointer user_data, guint level);
-
-/* Creates a list of path names from a TMFileEntry structure.
-\param entry The TMFileEntry structure.
-\files Current file list. Should be NULL.
-*/
-GList *tm_file_entry_list(TMFileEntry *entry, GList *files);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* TM_FILE_ENTRY_H */
Modified: tagmanager/src/tm_tagmanager.h
1 lines changed, 0 insertions(+), 1 deletions(-)
===================================================================
@@ -14,7 +14,6 @@
#include "tm_workspace.h"
#include "tm_source_file.h"
#ifdef GEANY_PRIVATE
-#include "tm_file_entry.h"
#include "tm_parser.h"
#endif /* GEANY_PRIVATE */
Modified: wscript
1 lines changed, 0 insertions(+), 1 deletions(-)
===================================================================
@@ -118,7 +118,6 @@ ctags_sources = set([
'tagmanager/ctags/vstring.c'])
tagmanager_sources = set([
- 'tagmanager/src/tm_file_entry.c',
'tagmanager/src/tm_source_file.c',
'tagmanager/src/tm_tag.c',
'tagmanager/src/tm_workspace.c'])
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list