Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Günther Wagner
gnome-builder
Commits
8280d7a8
Commit
8280d7a8
authored
Jan 18, 2018
by
Christian Hergert
Browse files
code-index: remove dead code
parent
879ed40a
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/code-index/ide-code-index-index.c
View file @
8280d7a8
...
...
@@ -206,108 +206,6 @@ ide_code_index_index_load (IdeCodeIndexIndex *self,
return
TRUE
;
}
/**
* ide_code_index_index_load_if_nmod:
* @self: a #IdeCodeIndexIndex
* @directory: a #GFile of the directory to load
* @files: (element-type Gio.File): a #GPtrArray of #GFile
* @mod_time: the modified time
* @cancellable: (nullable): a #GCancellable or %NULL
* @error: a location for a #GError, or %NULL
*
* This function will load index from directory if it is not modified. This
* fuction will only load if all "files" (GPtrArray) and only those "files" are
* there in index.
*
* Returns: %TRUE if there were no modifications; otherwise %FALSE. It is possible
* for %FALSE to be returned and @error will not be set.
*
* Thread safety: You may call this function from a thread, given that the thread has
* it's own reference to @self.
*/
gboolean
ide_code_index_index_load_if_nmod
(
IdeCodeIndexIndex
*
self
,
GFile
*
directory
,
GPtrArray
*
files
,
GTimeVal
mod_time
,
GCancellable
*
cancellable
,
GError
**
error
)
{
g_autoptr
(
DirectoryIndex
)
dir_index
=
NULL
;
g_autoptr
(
GFileInfo
)
file_info
=
NULL
;
g_autoptr
(
GFile
)
names_file
=
NULL
;
g_autofree
gchar
*
dir_name
=
NULL
;
GTimeVal
index_mod_time
;
gpointer
value
=
NULL
;
g_return_val_if_fail
(
IDE_IS_CODE_INDEX_INDEX
(
self
),
FALSE
);
g_return_val_if_fail
(
G_IS_FILE
(
directory
),
FALSE
);
g_return_val_if_fail
(
files
!=
NULL
,
FALSE
);
if
(
!
(
dir_index
=
directory_index_new
(
directory
,
cancellable
,
error
)))
return
FALSE
;
/*
* Return false if current number of files in directory != number of files that are
* indexed previously in the same directory.
*/
if
(
dzl_fuzzy_index_get_metadata_uint32
(
dir_index
->
symbol_names
,
"n_files"
)
!=
files
->
len
)
return
FALSE
;
/* Return false if files are modified after they are indexed. */
names_file
=
g_file_get_child
(
directory
,
"SymbolNames"
);
file_info
=
g_file_query_info
(
names_file
,
G_FILE_ATTRIBUTE_TIME_MODIFIED
,
G_FILE_QUERY_INFO_NONE
,
cancellable
,
error
);
if
(
file_info
==
NULL
)
return
FALSE
;
g_file_info_get_modification_time
(
file_info
,
&
index_mod_time
);
if
((
mod_time
.
tv_sec
>
index_mod_time
.
tv_sec
)
||
((
mod_time
.
tv_sec
==
index_mod_time
.
tv_sec
)
&&
(
mod_time
.
tv_usec
>
index_mod_time
.
tv_usec
)))
return
FALSE
;
/* Return false if all current files in directory are not there in index. */
for
(
guint
i
=
0
;
i
<
files
->
len
;
i
++
)
{
GFile
*
file
=
g_ptr_array_index
(
files
,
i
);
g_autofree
gchar
*
path
=
g_file_get_path
(
file
);
if
(
!
dzl_fuzzy_index_get_metadata_uint32
(
dir_index
->
symbol_names
,
path
))
return
FALSE
;
}
dir_name
=
g_file_get_path
(
directory
);
g_mutex_lock
(
&
self
->
mutex
);
if
(
g_hash_table_lookup_extended
(
self
->
directories
,
dir_name
,
NULL
,
&
value
))
{
guint
i
=
GPOINTER_TO_UINT
(
value
);
g_assert
(
i
<
self
->
indexes
->
len
);
g_assert
(
self
->
indexes
->
len
>
0
);
directory_index_free
(
g_ptr_array_index
(
self
->
indexes
,
i
));
g_ptr_array_index
(
self
->
indexes
,
i
)
=
g_steal_pointer
(
&
dir_index
);
}
else
{
g_hash_table_insert
(
self
->
directories
,
g_steal_pointer
(
&
dir_name
),
GUINT_TO_POINTER
(
self
->
indexes
->
len
));
g_ptr_array_add
(
self
->
indexes
,
g_steal_pointer
(
&
dir_index
));
}
g_mutex_unlock
(
&
self
->
mutex
);
return
TRUE
;
}
/* Create a new IdeCodeIndexSearchResult based on match from fuzzy index */
static
IdeCodeIndexSearchResult
*
ide_code_index_index_create_search_result
(
IdeContext
*
context
,
...
...
src/plugins/code-index/ide-code-index-index.h
View file @
8280d7a8
...
...
@@ -27,12 +27,6 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE
(
IdeCodeIndexIndex
,
ide_code_index_index
,
IDE
,
CODE_INDEX_INDEX
,
IdeObject
)
IdeCodeIndexIndex
*
ide_code_index_index_new
(
IdeContext
*
context
);
gboolean
ide_code_index_index_load_if_nmod
(
IdeCodeIndexIndex
*
self
,
GFile
*
directory
,
GPtrArray
*
files
,
GTimeVal
mod_time
,
GCancellable
*
cancellable
,
GError
**
error
);
gboolean
ide_code_index_index_load
(
IdeCodeIndexIndex
*
self
,
GFile
*
directory
,
GCancellable
*
cancellable
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment