Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
0f49200c
Commit
0f49200c
authored
May 09, 2012
by
Vicent Martí
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvc: Do not use `isspace`
Locale-aware bullshit bitting my ass again yo
parent
e65752bb
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
33 additions
and
18 deletions
+33
-18
src/attr_file.c
+6
-6
src/buffer.c
+1
-1
src/config_file.c
+8
-8
src/message.c
+1
-1
src/repository.c
+1
-1
src/util.c
+1
-1
src/util.h
+15
-0
No files found.
src/attr_file.c
View file @
0f49200c
...
...
@@ -344,7 +344,7 @@ int git_attr_fnmatch__parse(
pattern
=
*
base
;
while
(
isspace
(
*
pattern
))
pattern
++
;
while
(
git__
isspace
(
*
pattern
))
pattern
++
;
if
(
!*
pattern
||
*
pattern
==
'#'
)
{
*
base
=
git__next_line
(
pattern
);
return
GIT_ENOTFOUND
;
...
...
@@ -368,7 +368,7 @@ int git_attr_fnmatch__parse(
slash_count
=
0
;
for
(
scan
=
pattern
;
*
scan
!=
'\0'
;
++
scan
)
{
/* scan until (non-escaped) white space */
if
(
isspace
(
*
scan
)
&&
*
(
scan
-
1
)
!=
'\\'
)
if
(
git__
isspace
(
*
scan
)
&&
*
(
scan
-
1
)
!=
'\\'
)
break
;
if
(
*
scan
==
'/'
)
{
...
...
@@ -485,7 +485,7 @@ int git_attr_assignment__parse(
const
char
*
name_start
,
*
value_start
;
/* skip leading blanks */
while
(
isspace
(
*
scan
)
&&
*
scan
!=
'\n'
)
scan
++
;
while
(
git__
isspace
(
*
scan
)
&&
*
scan
!=
'\n'
)
scan
++
;
/* allocate assign if needed */
if
(
!
assign
)
{
...
...
@@ -509,7 +509,7 @@ int git_attr_assignment__parse(
/* find the name */
name_start
=
scan
;
while
(
*
scan
&&
!
isspace
(
*
scan
)
&&
*
scan
!=
'='
)
{
while
(
*
scan
&&
!
git__
isspace
(
*
scan
)
&&
*
scan
!=
'='
)
{
assign
->
name_hash
=
((
assign
->
name_hash
<<
5
)
+
assign
->
name_hash
)
+
*
scan
;
scan
++
;
...
...
@@ -518,7 +518,7 @@ int git_attr_assignment__parse(
/* must have found lone prefix (" - ") or leading = ("=foo")
* or end of buffer -- advance until whitespace and continue
*/
while
(
*
scan
&&
!
isspace
(
*
scan
))
scan
++
;
while
(
*
scan
&&
!
git__
isspace
(
*
scan
))
scan
++
;
continue
;
}
...
...
@@ -528,7 +528,7 @@ int git_attr_assignment__parse(
/* if there is an equals sign, find the value */
if
(
*
scan
==
'='
)
{
for
(
value_start
=
++
scan
;
*
scan
&&
!
isspace
(
*
scan
);
++
scan
);
for
(
value_start
=
++
scan
;
*
scan
&&
!
git__
isspace
(
*
scan
);
++
scan
);
/* if we found a value, allocate permanent storage for it */
if
(
scan
>
value_start
)
{
...
...
src/buffer.c
View file @
0f49200c
...
...
@@ -400,7 +400,7 @@ int git_buf_join(
void
git_buf_rtrim
(
git_buf
*
buf
)
{
while
(
buf
->
size
>
0
)
{
if
(
!
isspace
(
buf
->
ptr
[
buf
->
size
-
1
]))
if
(
!
git__
isspace
(
buf
->
ptr
[
buf
->
size
-
1
]))
break
;
buf
->
size
--
;
...
...
src/config_file.c
View file @
0f49200c
...
...
@@ -525,7 +525,7 @@ static int cfg_getchar(diskfile_backend *cfg_file, int flags)
assert
(
cfg_file
->
reader
.
read_ptr
);
do
c
=
cfg_getchar_raw
(
cfg_file
);
while
(
skip_whitespace
&&
isspace
(
c
)
&&
while
(
skip_whitespace
&&
git__
isspace
(
c
)
&&
!
cfg_file
->
reader
.
eof
);
if
(
skip_comments
&&
(
c
==
'#'
||
c
==
';'
))
{
...
...
@@ -573,7 +573,7 @@ static char *cfg_readline(diskfile_backend *cfg, bool skip_whitespace)
if
(
skip_whitespace
)
{
/* Skip empty empty lines */
while
(
isspace
(
*
line_src
))
while
(
git__
isspace
(
*
line_src
))
++
line_src
;
}
...
...
@@ -592,7 +592,7 @@ static char *cfg_readline(diskfile_backend *cfg, bool skip_whitespace)
memcpy
(
line
,
line_src
,
line_len
);
do
line
[
line_len
]
=
'\0'
;
while
(
line_len
--
>
0
&&
isspace
(
line
[
line_len
]));
while
(
line_len
--
>
0
&&
git__
isspace
(
line
[
line_len
]));
if
(
*
line_end
==
'\n'
)
line_end
++
;
...
...
@@ -737,7 +737,7 @@ static int parse_section_header(diskfile_backend *cfg, char **section_out)
c
=
line
[
pos
++
];
do
{
if
(
isspace
(
c
)){
if
(
git__
isspace
(
c
)){
name
[
name_length
]
=
'\0'
;
result
=
parse_section_header_ext
(
cfg
,
line
,
name
,
section_out
);
git__free
(
line
);
...
...
@@ -844,7 +844,7 @@ static int strip_comments(char *line, int in_quotes)
}
/* skip any space at the end */
if
(
isspace
(
ptr
[
-
1
]))
{
if
(
git__
isspace
(
ptr
[
-
1
]))
{
ptr
--
;
}
ptr
[
0
]
=
'\0'
;
...
...
@@ -1272,9 +1272,9 @@ static int parse_variable(diskfile_backend *cfg, char **var_name, char **var_val
else
value_start
=
var_end
+
1
;
if
(
isspace
(
var_end
[
-
1
]))
{
if
(
git__
isspace
(
var_end
[
-
1
]))
{
do
var_end
--
;
while
(
isspace
(
var_end
[
0
]));
while
(
git__
isspace
(
var_end
[
0
]));
}
*
var_name
=
git__strndup
(
line
,
var_end
-
line
+
1
);
...
...
@@ -1287,7 +1287,7 @@ static int parse_variable(diskfile_backend *cfg, char **var_name, char **var_val
* Now, let's try to parse the value
*/
if
(
value_start
!=
NULL
)
{
while
(
isspace
(
value_start
[
0
]))
while
(
git__
isspace
(
value_start
[
0
]))
value_start
++
;
if
(
is_multiline_var
(
value_start
))
{
...
...
src/message.c
View file @
0f49200c
...
...
@@ -12,7 +12,7 @@ static size_t line_length_without_trailing_spaces(const char *line, size_t len)
{
while
(
len
)
{
unsigned
char
c
=
line
[
len
-
1
];
if
(
!
isspace
(
c
))
if
(
!
git__
isspace
(
c
))
break
;
len
--
;
}
...
...
src/repository.c
View file @
0f49200c
...
...
@@ -246,7 +246,7 @@ static int read_gitfile(git_buf *path_out, const char *file_path)
}
else
if
((
error
=
git_path_dirname_r
(
path_out
,
file_path
))
>=
0
)
{
const
char
*
gitlink
=
((
const
char
*
)
file
.
ptr
)
+
prefix_len
;
while
(
*
gitlink
&&
isspace
(
*
gitlink
))
gitlink
++
;
while
(
*
gitlink
&&
git__
isspace
(
*
gitlink
))
gitlink
++
;
error
=
git_path_prettify_dir
(
path_out
,
gitlink
,
path_out
->
ptr
);
}
...
...
src/util.c
View file @
0f49200c
...
...
@@ -75,7 +75,7 @@ int git__strtol64(int64_t *result, const char *nptr, const char **endptr, int ba
/*
* White space
*/
while
(
isspace
(
*
p
))
while
(
git__
isspace
(
*
p
))
p
++
;
/*
...
...
src/util.h
View file @
0f49200c
...
...
@@ -194,4 +194,19 @@ GIT_INLINE(size_t) git__size_t_powerof2(size_t v)
return
git__size_t_bitmask
(
v
)
+
1
;
}
GIT_INLINE
(
bool
)
git__isupper
(
int
c
)
{
return
(
c
>=
'A'
&&
c
<=
'Z'
);
}
GIT_INLINE
(
bool
)
git__isalpha
(
int
c
)
{
return
((
c
>=
'A'
&&
c
<=
'Z'
)
||
(
c
>=
'a'
&&
c
<=
'z'
));
}
GIT_INLINE
(
bool
)
git__isspace
(
int
c
)
{
return
(
c
==
' '
||
c
==
'\t'
||
c
==
'\n'
||
c
==
'\12'
);
}
#endif
/* INCLUDE_util_h__ */
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