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
ed4f95e5
Commit
ed4f95e5
authored
Mar 05, 2013
by
Russell Belfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add const to some buffer functions
parent
9952f24e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
src/buffer.h
+5
-6
No files found.
src/buffer.h
View file @
ed4f95e5
...
...
@@ -119,7 +119,7 @@ void git_buf_copy_cstr(char *data, size_t datasize, const git_buf *buf);
#define git_buf_PUTS(buf, str) git_buf_put(buf, str, sizeof(str) - 1)
GIT_INLINE
(
ssize_t
)
git_buf_rfind_next
(
git_buf
*
buf
,
char
ch
)
GIT_INLINE
(
ssize_t
)
git_buf_rfind_next
(
const
git_buf
*
buf
,
char
ch
)
{
ssize_t
idx
=
(
ssize_t
)
buf
->
size
-
1
;
while
(
idx
>=
0
&&
buf
->
ptr
[
idx
]
==
ch
)
idx
--
;
...
...
@@ -127,18 +127,17 @@ GIT_INLINE(ssize_t) git_buf_rfind_next(git_buf *buf, char ch)
return
idx
;
}
GIT_INLINE
(
ssize_t
)
git_buf_rfind
(
git_buf
*
buf
,
char
ch
)
GIT_INLINE
(
ssize_t
)
git_buf_rfind
(
const
git_buf
*
buf
,
char
ch
)
{
ssize_t
idx
=
(
ssize_t
)
buf
->
size
-
1
;
while
(
idx
>=
0
&&
buf
->
ptr
[
idx
]
!=
ch
)
idx
--
;
return
idx
;
}
GIT_INLINE
(
ssize_t
)
git_buf_find
(
git_buf
*
buf
,
char
ch
)
GIT_INLINE
(
ssize_t
)
git_buf_find
(
const
git_buf
*
buf
,
char
ch
)
{
size_t
idx
=
0
;
while
(
idx
<
buf
->
size
&&
buf
->
ptr
[
idx
]
!=
ch
)
idx
++
;
return
(
idx
==
buf
->
size
)
?
-
1
:
(
ssize_t
)
idx
;
void
*
found
=
memchr
(
buf
->
ptr
,
ch
,
buf
->
size
);
return
found
?
(
ssize_t
)((
const
char
*
)
found
-
buf
->
ptr
)
:
-
1
;
}
/* Remove whitespace from the end of the buffer */
...
...
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