Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11_abseil
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11_abseil
Commits
baadf890
Commit
baadf890
authored
Aug 15, 2024
by
pybind11_abseil authors
Committed by
Copybara-Service
Aug 15, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid extra string-copies in `typecaster<absl::Cord>`.
PiperOrigin-RevId: 663348039
parent
4222c78a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletions
+10
-1
pybind11_abseil/absl_casters.h
+10
-1
No files found.
pybind11_abseil/absl_casters.h
View file @
baadf890
...
@@ -42,6 +42,7 @@
...
@@ -42,6 +42,7 @@
#include <cmath>
#include <cmath>
#include <complex>
#include <complex>
#include <cstdint>
#include <cstdint>
#include <cstring>
#include <tuple>
#include <tuple>
#include <type_traits>
#include <type_traits>
#include <vector>
#include <vector>
...
@@ -634,7 +635,15 @@ struct type_caster<absl::Cord> {
...
@@ -634,7 +635,15 @@ struct type_caster<absl::Cord> {
return
str
(
std
::
string
(
src
)).
release
();
return
str
(
std
::
string
(
src
)).
release
();
}
}
#endif
#endif
return
bytes
(
std
::
string
(
src
)).
release
();
bytes
data
(
nullptr
,
src
.
size
());
// Cord::CopyToArray is not always available so we need to copy
// the cord manually.
char
*
ptr
=
PyBytes_AS_STRING
(
data
.
ptr
());
for
(
absl
::
string_view
chunk
:
src
.
Chunks
())
{
std
::
memcpy
(
ptr
,
chunk
.
data
(),
chunk
.
size
());
ptr
+=
chunk
.
size
();
}
return
data
.
release
();
}
}
};
};
...
...
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