[geany/geany] 9eefdb: Where possible, convert functions to static in TM
Jiří Techet
git-noreply at xxxxx
Sat Nov 8 18:57:55 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: 9eefdb0efcdc22d3d65e6f1d4e975f225eb18569
https://github.com/geany/geany/commit/9eefdb0efcdc22d3d65e6f1d4e975f225eb18569
Log Message:
-----------
Where possible, convert functions to static in TM
Modified Paths:
--------------
tagmanager/src/tm_source_file.c
tagmanager/src/tm_source_file.h
tagmanager/src/tm_tag.c
tagmanager/src/tm_tag.h
tagmanager/src/tm_workspace.c
tagmanager/src/tm_workspace.h
Modified: tagmanager/src/tm_source_file.c
90 lines changed, 45 insertions(+), 45 deletions(-)
===================================================================
@@ -100,8 +100,49 @@ gchar *tm_get_real_path(const gchar *file_name)
return NULL;
}
+/*
+ This function is registered into the ctags parser when a file is parsed for
+ the first time. The function is then called by the ctags parser each time
+ it finds a new tag. You should not have to use this function.
+ @see tm_source_file_parse()
+*/
+static int tm_source_file_tags(const tagEntryInfo *tag)
+{
+ if (NULL == current_source_file)
+ return 0;
+ if (NULL == current_source_file->tags_array)
+ current_source_file->tags_array = g_ptr_array_new();
+ g_ptr_array_add(current_source_file->tags_array,
+ tm_tag_new(current_source_file, tag));
+ return TRUE;
+}
+
+/* Set the argument list of tag identified by its name */
+static void tm_source_file_set_tag_arglist(const char *tag_name, const char *arglist)
+{
+ int count;
+ TMTag **tags, *tag;
+
+ if (NULL == arglist ||
+ NULL == tag_name ||
+ NULL == current_source_file ||
+ NULL == current_source_file->tags_array)
+ {
+ return;
+ }
+
+ tags = tm_tags_find(current_source_file->tags_array, tag_name, FALSE, FALSE,
+ &count);
+ if (tags != NULL && count == 1)
+ {
+ tag = tags[0];
+ g_free(tag->atts.entry.arglist);
+ tag->atts.entry.arglist = g_strdup(arglist);
+ }
+}
+
/* Initializes a TMSourceFile structure from a file name. */
-gboolean tm_source_file_init(TMSourceFile *source_file, const char *file_name
+static gboolean tm_source_file_init(TMSourceFile *source_file, const char *file_name
, gboolean update, const char* name)
{
struct stat s;
@@ -175,7 +216,7 @@ TMSourceFile *tm_source_file_new(const char *file_name, gboolean update, const c
source file and are also destroyed when the source file is destroyed. If pointers
to these tags are used elsewhere, then those tag arrays should be rebuilt.
*/
-void tm_source_file_destroy(TMSourceFile *source_file)
+static void tm_source_file_destroy(TMSourceFile *source_file)
{
#ifdef TM_DEBUG
g_message("Destroying source file: %s", source_file->file_name);
@@ -204,7 +245,7 @@ void tm_source_file_free(TMSourceFile *source_file)
@return TRUE on success, FALSE on failure
@see tm_source_file_update()
*/
-gboolean tm_source_file_parse(TMSourceFile *source_file)
+static gboolean tm_source_file_parse(TMSourceFile *source_file)
{
const char *file_name;
gboolean status = TRUE;
@@ -267,7 +308,7 @@ gboolean tm_source_file_parse(TMSourceFile *source_file)
@return TRUE on success, FALSE on failure
@see tm_source_file_update()
*/
-gboolean tm_source_file_buffer_parse(TMSourceFile *source_file, guchar* text_buf, gint buf_size)
+static gboolean tm_source_file_buffer_parse(TMSourceFile *source_file, guchar* text_buf, gint buf_size)
{
const char *file_name;
gboolean status = TRUE;
@@ -339,47 +380,6 @@ gboolean tm_source_file_buffer_parse(TMSourceFile *source_file, guchar* text_buf
return status;
}
-/* Set the argument list of tag identified by its name */
-void tm_source_file_set_tag_arglist(const char *tag_name, const char *arglist)
-{
- int count;
- TMTag **tags, *tag;
-
- if (NULL == arglist ||
- NULL == tag_name ||
- NULL == current_source_file ||
- NULL == current_source_file->tags_array)
- {
- return;
- }
-
- tags = tm_tags_find(current_source_file->tags_array, tag_name, FALSE, FALSE,
- &count);
- if (tags != NULL && count == 1)
- {
- tag = tags[0];
- g_free(tag->atts.entry.arglist);
- tag->atts.entry.arglist = g_strdup(arglist);
- }
-}
-
-/*
- This function is registered into the ctags parser when a file is parsed for
- the first time. The function is then called by the ctags parser each time
- it finds a new tag. You should not have to use this function.
- @see tm_source_file_parse()
-*/
-int tm_source_file_tags(const tagEntryInfo *tag)
-{
- if (NULL == current_source_file)
- return 0;
- if (NULL == current_source_file->tags_array)
- current_source_file->tags_array = g_ptr_array_new();
- g_ptr_array_add(current_source_file->tags_array,
- tm_tag_new(current_source_file, tag));
- return TRUE;
-}
-
/** Updates the source file by reparsing. The tags array and
the tags themselves are destroyed and re-created, hence any other tag arrays
pointing to these tags should be rebuilt as well. All sorting information is
Modified: tagmanager/src/tm_source_file.h
13 lines changed, 0 insertions(+), 13 deletions(-)
===================================================================
@@ -55,26 +55,13 @@ gchar *tm_get_real_path(const gchar *file_name);
#ifdef GEANY_PRIVATE
-gboolean tm_source_file_init(TMSourceFile *source_file, const char *file_name,
- gboolean update, const char *name);
-
-void tm_source_file_destroy(TMSourceFile *source_file);
-
void tm_source_file_buffer_update(TMSourceFile *source_file, guchar* text_buf,
gint buf_size, gboolean update_workspace);
-gboolean tm_source_file_parse(TMSourceFile *source_file);
-
-gboolean tm_source_file_buffer_parse(TMSourceFile *source_file, guchar* text_buf, gint buf_size);
-
-int tm_source_file_tags(const tagEntryInfo *tag);
-
const gchar *tm_source_file_get_lang_name(gint lang);
gint tm_source_file_get_named_lang(const gchar *name);
-void tm_source_file_set_tag_arglist(const char *tag_name, const char *arglist);
-
#endif /* GEANY_PRIVATE */
#ifdef __cplusplus
Modified: tagmanager/src/tm_tag.c
10 lines changed, 5 insertions(+), 5 deletions(-)
===================================================================
@@ -219,7 +219,7 @@ static char get_tag_access(const char *access)
@param tag_entry Tag information gathered by the ctags parser
@return TRUE on success, FALSE on failure
*/
-gboolean tm_tag_init(TMTag *tag, TMSourceFile *file, const tagEntryInfo *tag_entry)
+static gboolean tm_tag_init(TMTag *tag, TMSourceFile *file, const tagEntryInfo *tag_entry)
{
tag->refcount = 1;
if (NULL == tag_entry)
@@ -295,7 +295,7 @@ TMTag *tm_tag_new(TMSourceFile *file, const tagEntryInfo *tag_entry)
@param fp FILE pointer from where the tag line is read
@return TRUE on success, FALSE on FAILURE
*/
-gboolean tm_tag_init_from_file(TMTag *tag, TMSourceFile *file, FILE *fp)
+static gboolean tm_tag_init_from_file(TMTag *tag, TMSourceFile *file, FILE *fp)
{
guchar buf[BUFSIZ];
guchar *start, *end;
@@ -392,7 +392,7 @@ gboolean tm_tag_init_from_file(TMTag *tag, TMSourceFile *file, FILE *fp)
/* alternative parser for Pascal and LaTeX global tags files with the following format
* tagname|return value|arglist|description\n */
-gboolean tm_tag_init_from_file_alt(TMTag *tag, TMSourceFile *file, FILE *fp)
+static gboolean tm_tag_init_from_file_alt(TMTag *tag, TMSourceFile *file, FILE *fp)
{
guchar buf[BUFSIZ];
guchar *start, *end;
@@ -439,7 +439,7 @@ gboolean tm_tag_init_from_file_alt(TMTag *tag, TMSourceFile *file, FILE *fp)
Same as tm_tag_init_from_file(), but parsing CTags tag file format
(http://ctags.sourceforge.net/FORMAT)
*/
-gboolean tm_tag_init_from_file_ctags(TMTag *tag, TMSourceFile *file, FILE *fp)
+static gboolean tm_tag_init_from_file_ctags(TMTag *tag, TMSourceFile *file, FILE *fp)
{
gchar buf[BUFSIZ];
gchar *p, *tab;
@@ -709,7 +709,7 @@ TMTag *tm_tag_ref(TMTag *tag)
static variables to be set. Always use tm_tags_sort() and tm_tags_dedup()
instead.
*/
-int tm_tag_compare(const void *ptr1, const void *ptr2)
+static int tm_tag_compare(const void *ptr1, const void *ptr2)
{
unsigned int *sort_attr;
int returnval = 0;
Modified: tagmanager/src/tm_tag.h
10 lines changed, 0 insertions(+), 10 deletions(-)
===================================================================
@@ -165,22 +165,12 @@ typedef enum {
GType tm_tag_get_type(void) G_GNUC_CONST;
-gboolean tm_tag_init(TMTag *tag, TMSourceFile *file, const tagEntryInfo *tag_entry);
-
-gboolean tm_tag_init_from_file(TMTag *tag, TMSourceFile *file, FILE *fp);
-
-gboolean tm_tag_init_from_file_alt(TMTag *tag, TMSourceFile *file, FILE *fp);
-
-gboolean tm_tag_init_from_file_ctags(TMTag *tag, TMSourceFile *file, FILE *fp);
-
TMTag *tm_tag_new(TMSourceFile *file, const tagEntryInfo *tag_entry);
TMTag *tm_tag_new_from_file(TMSourceFile *file, FILE *fp, gint mode, TMFileFormat format);
gboolean tm_tag_write(TMTag *tag, FILE *file, guint attrs);
-int tm_tag_compare(const void *ptr1, const void *ptr2);
-
GPtrArray *tm_tags_remove_file_tags(TMSourceFile *source_file, GPtrArray *tags_array);
GPtrArray *tm_tags_merge(GPtrArray *big_array, GPtrArray *small_array, TMTagAttrType *sort_attributes);
Modified: tagmanager/src/tm_workspace.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -497,7 +497,7 @@ gboolean tm_workspace_create_global_tags(const char *pre_process, const char **i
all member source files. You shouldn't have to call this directly since
this is called automatically by tm_workspace_update().
*/
-void tm_workspace_recreate_tags_array(void)
+static void tm_workspace_recreate_tags_array(void)
{
guint i, j;
TMSourceFile *w;
Modified: tagmanager/src/tm_workspace.h
2 lines changed, 0 insertions(+), 2 deletions(-)
===================================================================
@@ -50,8 +50,6 @@ gboolean tm_workspace_load_global_tags(const char *tags_file, gint mode);
gboolean tm_workspace_create_global_tags(const char *pre_process, const char **includes,
int includes_count, const char *tags_file, int lang);
-void tm_workspace_recreate_tags_array(void);
-
const GPtrArray *tm_workspace_find(const char *name, int type, TMTagAttrType *attrs
, gboolean partial, langType lang);
--------------
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