FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cpython/Include/cpython/bytesobject.h at main · Eclips4/cpython · GitHub
Eclips4
/
cpython
Public
forked from
python/cpython
Notifications
You must be signed in to change notification settings
Fork
0
Star
2
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cpython
/
Include
/
cpython
/
bytesobject.h
Copy path
More file actions
More file actions
Latest commit
History
History
History
85 lines (70 loc) · 2.39 KB
Breadcrumbs
cpython
/
Include
/
cpython
/
bytesobject.h
Copy path
File metadata and controls
85 lines (70 loc) · 2.39 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#ifndef
Py_CPYTHON_BYTESOBJECT_H
# error
"this header file must not be included directly"
#endif
typedef
struct
{
PyObject_VAR_HEAD
Py_DEPRECATED
(
3.11
)
Py_hash_t
ob_shash
;
char
ob_sval
[
1
];
/* Invariants:
* ob_sval contains space for 'ob_size+1' elements.
* ob_sval[ob_size] == 0.
* ob_shash is the hash of the byte string or -1 if not computed yet.
*/
}
PyBytesObject
;
PyAPI_FUNC
(
int
)
_PyBytes_Resize
(
PyObject
*
*
,
Py_ssize_t
);
/* Macros and static inline functions, trading safety for speed */
#define
_PyBytes_CAST
(
op
) \
(assert(PyBytes_Check(op)), _Py_CAST(PyBytesObject*, op))
static
inline
char
*
PyBytes_AS_STRING
(
PyObject
*
op
)
{
return
_PyBytes_CAST
(
op
)
->
ob_sval
;
}
#define
PyBytes_AS_STRING
(
op
) PyBytes_AS_STRING(_PyObject_CAST(op))
static
inline
Py_ssize_t
PyBytes_GET_SIZE
(
PyObject
*
op
) {
PyBytesObject
*
self
=
_PyBytes_CAST
(
op
);
return
Py_SIZE
(
self
);
}
#define
PyBytes_GET_SIZE
(
self
) PyBytes_GET_SIZE(_PyObject_CAST(self))
PyAPI_FUNC
(
PyObject
*
)
PyBytes_Join
(
PyObject
*
sep
,
PyObject
*
iterable
);
// Deprecated alias kept for backward compatibility
Py_DEPRECATED
(
3.14
)
static
inline
PyObject
*
_PyBytes_Join
(
PyObject
*
sep
,
PyObject
*
iterable
)
{
return
PyBytes_Join
(
sep
,
iterable
);
}
// --- PyBytesWriter API -----------------------------------------------------
typedef
struct
PyBytesWriter
PyBytesWriter
;
PyAPI_FUNC
(
PyBytesWriter
*
)
PyBytesWriter_Create
(
Py_ssize_t
size
);
PyAPI_FUNC
(
void
)
PyBytesWriter_Discard
(
PyBytesWriter
*
writer
);
PyAPI_FUNC
(
PyObject
*
)
PyBytesWriter_Finish
(
PyBytesWriter
*
writer
);
PyAPI_FUNC
(
PyObject
*
)
PyBytesWriter_FinishWithSize
(
PyBytesWriter
*
writer
,
Py_ssize_t
size
);
PyAPI_FUNC
(
PyObject
*
)
PyBytesWriter_FinishWithPointer
(
PyBytesWriter
*
writer
,
void
*
buf
);
PyAPI_FUNC
(
void
*
)
PyBytesWriter_GetData
(
PyBytesWriter
*
writer
);
PyAPI_FUNC
(
Py_ssize_t
)
PyBytesWriter_GetSize
(
PyBytesWriter
*
writer
);
PyAPI_FUNC
(
int
)
PyBytesWriter_WriteBytes
(
PyBytesWriter
*
writer
,
const
void
*
bytes
,
Py_ssize_t
size
);
PyAPI_FUNC
(
int
)
PyBytesWriter_Format
(
PyBytesWriter
*
writer
,
const
char
*
format
,
...);
PyAPI_FUNC
(
int
)
PyBytesWriter_Resize
(
PyBytesWriter
*
writer
,
Py_ssize_t
size
);
PyAPI_FUNC
(
int
)
PyBytesWriter_Grow
(
PyBytesWriter
*
writer
,
Py_ssize_t
size
);
PyAPI_FUNC
(
void
*
)
PyBytesWriter_GrowAndUpdatePointer
(
PyBytesWriter
*
writer
,
Py_ssize_t
size
,
void
*
buf
);
Back
|
FazBrowse Home
|
New Git URL