Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
G
geany
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
geany
Commits
8f16685d
Kaydet (Commit)
8f16685d
authored
Ara 02, 2018
tarafından
Colomban Wendling
Kaydeden (comit)
Thomas Martitz
Ara 03, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix a few signed vs unsigned comparisons
üst
724e7886
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
17 deletions
+18
-17
utils.c
src/utils.c
+17
-16
utils.h
src/utils.h
+1
-1
No files found.
src/utils.c
Dosyayı görüntüle @
8f16685d
...
@@ -2049,18 +2049,19 @@ gchar **utils_strv_join(gchar **first, gchar **second)
...
@@ -2049,18 +2049,19 @@ gchar **utils_strv_join(gchar **first, gchar **second)
* The size of the list may be given explicitely, but defaults to @c g_strv_length(strv).
* The size of the list may be given explicitely, but defaults to @c g_strv_length(strv).
*
*
* @param strv The list of strings to process.
* @param strv The list of strings to process.
* @param
num
The number of strings contained in @a strv. Can be -1 if it's terminated by @c NULL.
* @param
strv_len
The number of strings contained in @a strv. Can be -1 if it's terminated by @c NULL.
*
*
* @return The common prefix that is part of all strings (maybe empty), or NULL if an empty list
* @return The common prefix that is part of all strings (maybe empty), or NULL if an empty list
* was passed in.
* was passed in.
*/
*/
static
gchar
*
utils_strv_find_common_prefix
(
gchar
**
strv
,
gssize
num
)
static
gchar
*
utils_strv_find_common_prefix
(
gchar
**
strv
,
gssize
strv_len
)
{
{
gsize
num
;
if
(
!
NZV
(
strv
))
if
(
!
NZV
(
strv
))
return
NULL
;
return
NULL
;
if
(
num
==
-
1
)
num
=
(
strv_len
==
-
1
)
?
g_strv_length
(
strv
)
:
(
gsize
)
strv_len
;
num
=
g_strv_length
(
strv
);
for
(
gsize
i
=
0
;
strv
[
0
][
i
];
i
++
)
for
(
gsize
i
=
0
;
strv
[
0
][
i
];
i
++
)
{
{
...
@@ -2083,22 +2084,21 @@ static gchar *utils_strv_find_common_prefix(gchar **strv, gssize num)
...
@@ -2083,22 +2084,21 @@ static gchar *utils_strv_find_common_prefix(gchar **strv, gssize num)
* The size of the list may be given explicitely, but defaults to @c g_strv_length(strv).
* The size of the list may be given explicitely, but defaults to @c g_strv_length(strv).
*
*
* @param strv The list of strings to process.
* @param strv The list of strings to process.
* @param
num
The number of strings contained in @a strv. Can be -1 if it's terminated by @c NULL.
* @param
strv_len
The number of strings contained in @a strv. Can be -1 if it's terminated by @c NULL.
*
*
* @return The common prefix that is part of all strings.
* @return The common prefix that is part of all strings.
*/
*/
static
gchar
*
utils_strv_find_lcs
(
gchar
**
strv
,
gssize
num
)
static
gchar
*
utils_strv_find_lcs
(
gchar
**
strv
,
gssize
strv_len
)
{
{
gchar
*
first
,
*
_sub
,
*
sub
;
gchar
*
first
,
*
_sub
,
*
sub
;
gsize
num
;
gsize
n_chars
;
gsize
n_chars
;
gsize
len
;
gsize
len
;
gsize
max
=
0
;
gsize
max
=
0
;
char
*
lcs
;
char
*
lcs
;
gsize
found
;
gsize
found
;
if
(
num
==
-
1
)
num
=
(
strv_len
==
-
1
)
?
g_strv_length
(
strv
)
:
(
gsize
)
strv_len
;
num
=
g_strv_length
(
strv
);
if
(
num
<
1
)
if
(
num
<
1
)
return
NULL
;
return
NULL
;
...
@@ -2147,29 +2147,30 @@ static gchar *utils_strv_find_lcs(gchar **strv, gssize num)
...
@@ -2147,29 +2147,30 @@ static gchar *utils_strv_find_lcs(gchar **strv, gssize num)
* The algorthm strips the common prefix (e-g. the user's home directory) and
* The algorthm strips the common prefix (e-g. the user's home directory) and
* replaces the longest common substring with an ellipsis ("...").
* replaces the longest common substring with an ellipsis ("...").
*
*
* @param file_names @array{length=num} The list of strings to process.
* @param file_names @array{length=file_names_len} The list of strings to process.
* @param num The number of strings contained in @a file_names. Can be -1 if it's terminated by @c NULL.
* @param file_names_len The number of strings contained in @a file_names. Can be -1 if it's
* terminated by @c NULL.
* @return @transfer{full} A newly-allocated array of transformed paths strings, terminated by
* @return @transfer{full} A newly-allocated array of transformed paths strings, terminated by
@c NULL. Use @c g_strfreev() to free it.
@c NULL. Use @c g_strfreev() to free it.
*
*
* @since 1.34 (API 239)
* @since 1.34 (API 239)
*/
*/
GEANY_API_SYMBOL
GEANY_API_SYMBOL
gchar
**
utils_strv_shorten_file_list
(
gchar
**
file_names
,
gssize
num
)
gchar
**
utils_strv_shorten_file_list
(
gchar
**
file_names
,
gssize
file_names_len
)
{
{
gsize
num
;
gsize
i
;
gsize
i
;
gchar
*
prefix
,
*
substring
,
*
lcs
;
gchar
*
prefix
,
*
substring
,
*
lcs
;
gchar
*
start
,
*
end
;
gchar
*
start
,
*
end
;
gchar
**
names
;
gchar
**
names
;
gsize
prefix_len
,
lcs_len
;
gsize
prefix_len
,
lcs_len
;
/* We don't dereference file_names if
num
== 0. */
/* We don't dereference file_names if
file_names_len
== 0. */
g_return_val_if_fail
(
num
==
0
||
file_names
!=
NULL
,
NULL
);
g_return_val_if_fail
(
file_names_len
==
0
||
file_names
!=
NULL
,
NULL
);
/* The return value shall have exactly the same size as the input. If the input is a
/* The return value shall have exactly the same size as the input. If the input is a
* GStrv (last element is NULL), the output will follow suit. */
* GStrv (last element is NULL), the output will follow suit. */
if
(
num
==
-
1
)
num
=
(
file_names_len
==
-
1
)
?
g_strv_length
(
file_names
)
:
(
gsize
)
file_names_len
;
num
=
g_strv_length
(
file_names
);
/* Always include a terminating NULL, enables easy freeing with g_strfreev() */
/* Always include a terminating NULL, enables easy freeing with g_strfreev() */
names
=
g_new0
(
gchar
*
,
num
+
1
);
names
=
g_new0
(
gchar
*
,
num
+
1
);
...
...
src/utils.h
Dosyayı görüntüle @
8f16685d
...
@@ -301,7 +301,7 @@ gchar **utils_strv_new(const gchar *first, ...) G_GNUC_NULL_TERMINATED;
...
@@ -301,7 +301,7 @@ gchar **utils_strv_new(const gchar *first, ...) G_GNUC_NULL_TERMINATED;
gchar
**
utils_strv_join
(
gchar
**
first
,
gchar
**
second
)
G_GNUC_WARN_UNUSED_RESULT
;
gchar
**
utils_strv_join
(
gchar
**
first
,
gchar
**
second
)
G_GNUC_WARN_UNUSED_RESULT
;
gchar
**
utils_strv_shorten_file_list
(
gchar
**
file_names
,
gssize
num
);
gchar
**
utils_strv_shorten_file_list
(
gchar
**
file_names
,
gssize
file_names_len
);
GSList
*
utils_get_config_files
(
const
gchar
*
subdir
);
GSList
*
utils_get_config_files
(
const
gchar
*
subdir
);
...
...
Write
Preview
Markdown
is supported
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