Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tarantool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
tarantool
Commits
a9890515
Commit
a9890515
authored
13 years ago
by
Konstantin Osipov
Browse files
Options
Downloads
Patches
Plain Diff
Bug#773058: review fixes.
Adjust signature of tbuf_ltrim, add comments, replace a check with an assert.
parent
e4d88801
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/tbuf.c
+7
-8
7 additions, 8 deletions
core/tbuf.c
include/tbuf.h
+10
-1
10 additions, 1 deletion
include/tbuf.h
with
17 additions
and
9 deletions
core/tbuf.c
+
7
−
8
View file @
a9890515
...
@@ -124,17 +124,16 @@ tbuf_peek(struct tbuf *b, size_t count)
...
@@ -124,17 +124,16 @@ tbuf_peek(struct tbuf *b, size_t count)
return
NULL
;
return
NULL
;
}
}
void
*
/** Remove first count bytes from the beginning. */
void
tbuf_ltrim
(
struct
tbuf
*
b
,
size_t
count
)
tbuf_ltrim
(
struct
tbuf
*
b
,
size_t
count
)
{
{
void
*
p
=
NULL
;
tbuf_assert
(
b
);
tbuf_assert
(
b
);
if
(
count
<=
b
->
len
)
{
assert
(
count
<=
b
->
len
);
p
=
memmove
(
b
->
data
,
b
->
data
+
count
,
b
->
len
-
count
);
b
->
len
-=
count
;
memmove
(
b
->
data
,
b
->
data
+
count
,
b
->
len
-
count
);
}
b
->
len
-=
count
;
return
p
;
}
}
size_t
size_t
...
...
This diff is collapsed.
Click to expand it.
include/tbuf.h
+
10
−
1
View file @
a9890515
...
@@ -63,7 +63,16 @@ struct tbuf *tbuf_split(struct tbuf *e, size_t at);
...
@@ -63,7 +63,16 @@ struct tbuf *tbuf_split(struct tbuf *e, size_t at);
size_t
tbuf_reserve
(
struct
tbuf
*
b
,
size_t
count
);
size_t
tbuf_reserve
(
struct
tbuf
*
b
,
size_t
count
);
void
tbuf_reset
(
struct
tbuf
*
b
);
void
tbuf_reset
(
struct
tbuf
*
b
);
void
*
tbuf_peek
(
struct
tbuf
*
b
,
size_t
count
);
void
*
tbuf_peek
(
struct
tbuf
*
b
,
size_t
count
);
void
*
tbuf_ltrim
(
struct
tbuf
*
b
,
size_t
count
);
/**
* Remove count bytes from the beginning, and adjust all sizes
* accordingly.
*
* @param count the number of bytes to forget about.
*
* @pre 0 <= count <= tbuf->len
*/
void
tbuf_ltrim
(
struct
tbuf
*
b
,
size_t
count
);
void
tbuf_append_field
(
struct
tbuf
*
b
,
void
*
f
);
void
tbuf_append_field
(
struct
tbuf
*
b
,
void
*
f
);
void
tbuf_vprintf
(
struct
tbuf
*
b
,
const
char
*
format
,
va_list
ap
)
void
tbuf_vprintf
(
struct
tbuf
*
b
,
const
char
*
format
,
va_list
ap
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment