Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
tci-gateway-module
Grpc
Commits
d5d851ba
Commit
d5d851ba
authored
8 years ago
by
Robbie Shade
Browse files
Options
Downloads
Patches
Plain Diff
Add byte_buffer_eq_slice method
parent
c6f77675
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/core/end2end/cq_verifier.c
+20
-5
20 additions, 5 deletions
test/core/end2end/cq_verifier.c
with
20 additions
and
5 deletions
test/core/end2end/cq_verifier.c
+
20
−
5
View file @
d5d851ba
...
...
@@ -128,14 +128,14 @@ static gpr_slice merge_slices(gpr_slice *slices, size_t nslices) {
return
out
;
}
int
byte_buffer_eq_slice
(
grpc_byte_buffer
*
bb
,
gpr_slice
b
)
{
int
raw_
byte_buffer_eq_slice
(
grpc_byte_buffer
*
r
bb
,
gpr_slice
b
)
{
gpr_slice
a
;
int
ok
;
if
(
!
bb
)
return
0
;
if
(
!
r
bb
)
return
0
;
a
=
merge_slices
(
bb
->
data
.
raw
.
slice_buffer
.
slices
,
bb
->
data
.
raw
.
slice_buffer
.
count
);
a
=
merge_slices
(
r
bb
->
data
.
raw
.
slice_buffer
.
slices
,
r
bb
->
data
.
raw
.
slice_buffer
.
count
);
ok
=
GPR_SLICE_LENGTH
(
a
)
==
GPR_SLICE_LENGTH
(
b
)
&&
0
==
memcmp
(
GPR_SLICE_START_PTR
(
a
),
GPR_SLICE_START_PTR
(
b
),
GPR_SLICE_LENGTH
(
a
));
...
...
@@ -144,6 +144,21 @@ int byte_buffer_eq_slice(grpc_byte_buffer *bb, gpr_slice b) {
return
ok
;
}
int
byte_buffer_eq_slice
(
grpc_byte_buffer
*
bb
,
gpr_slice
b
)
{
grpc_byte_buffer_reader
reader
;
grpc_byte_buffer
*
rbb
;
int
res
;
GPR_ASSERT
(
grpc_byte_buffer_reader_init
(
&
reader
,
bb
)
&&
"Couldn't init byte buffer reader"
);
rbb
=
grpc_raw_byte_buffer_from_reader
(
&
reader
);
res
=
raw_byte_buffer_eq_slice
(
rbb
,
b
);
grpc_byte_buffer_reader_destroy
(
&
reader
);
grpc_byte_buffer_destroy
(
rbb
);
return
res
;
}
int
byte_buffer_eq_string
(
grpc_byte_buffer
*
bb
,
const
char
*
str
)
{
grpc_byte_buffer_reader
reader
;
grpc_byte_buffer
*
rbb
;
...
...
@@ -152,7 +167,7 @@ int byte_buffer_eq_string(grpc_byte_buffer *bb, const char *str) {
GPR_ASSERT
(
grpc_byte_buffer_reader_init
(
&
reader
,
bb
)
&&
"Couldn't init byte buffer reader"
);
rbb
=
grpc_raw_byte_buffer_from_reader
(
&
reader
);
res
=
byte_buffer_eq_slice
(
rbb
,
gpr_slice_from_copied_string
(
str
));
res
=
raw_
byte_buffer_eq_slice
(
rbb
,
gpr_slice_from_copied_string
(
str
));
grpc_byte_buffer_reader_destroy
(
&
reader
);
grpc_byte_buffer_destroy
(
rbb
);
...
...
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