LCOV - code coverage report
Current view: top level - Include/cpython - bytearrayobject.h (source / functions) Hit Total Coverage
Test: CPython 3.12 LCOV report [commit 5e6661bce9] Lines: 8 8 100.0 %
Date: 2023-03-20 08:15:36 Functions: 2 2 100.0 %
Branches: 2 6 33.3 %

           Branch data     Line data    Source code
       1                 :            : #ifndef Py_CPYTHON_BYTEARRAYOBJECT_H
       2                 :            : #  error "this header file must not be included directly"
       3                 :            : #endif
       4                 :            : 
       5                 :            : /* Object layout */
       6                 :            : typedef struct {
       7                 :            :     PyObject_VAR_HEAD
       8                 :            :     Py_ssize_t ob_alloc;   /* How many bytes allocated in ob_bytes */
       9                 :            :     char *ob_bytes;        /* Physical backing buffer */
      10                 :            :     char *ob_start;        /* Logical start inside ob_bytes */
      11                 :            :     Py_ssize_t ob_exports; /* How many buffer exports */
      12                 :            : } PyByteArrayObject;
      13                 :            : 
      14                 :            : PyAPI_DATA(char) _PyByteArray_empty_string[];
      15                 :            : 
      16                 :            : /* Macros and static inline functions, trading safety for speed */
      17                 :            : #define _PyByteArray_CAST(op) \
      18                 :            :     (assert(PyByteArray_Check(op)), _Py_CAST(PyByteArrayObject*, op))
      19                 :            : 
      20                 :       6284 : static inline char* PyByteArray_AS_STRING(PyObject *op)
      21                 :            : {
      22         [ #  # ]:       6284 :     PyByteArrayObject *self = _PyByteArray_CAST(op);
      23         [ +  + ]:       6284 :     if (Py_SIZE(self)) {
      24                 :       6283 :         return self->ob_start;
      25                 :            :     }
      26                 :          1 :     return _PyByteArray_empty_string;
      27                 :            : }
      28                 :            : #define PyByteArray_AS_STRING(self) PyByteArray_AS_STRING(_PyObject_CAST(self))
      29                 :            : 
      30                 :       1298 : static inline Py_ssize_t PyByteArray_GET_SIZE(PyObject *op) {
      31         [ #  # ]:       1298 :     PyByteArrayObject *self = _PyByteArray_CAST(op);
      32                 :       1298 :     return Py_SIZE(self);
      33                 :            : }
      34                 :            : #define PyByteArray_GET_SIZE(self) PyByteArray_GET_SIZE(_PyObject_CAST(self))

Generated by: LCOV version 1.14