Generated by Cython 0.28.2

Yellow lines hint at Python interaction.
Click on a line that starts with a "+" to see the C code that Cython generated for it.

Raw output: membuf.c

 001: # -*- coding: utf-8 -*-
 002: # This file is part of Xpra.
 003: # Copyright (C) 2015-2017 Antoine Martin <antoine@devloop.org.uk>
 004: # Xpra is released under the terms of the GNU GPL v2, or, at your option, any
 005: # later version. See the file COPYING for details.
 006: 
 007: # Memory buffers functions:
 008: #
 009: # 1) Buffer code found here and also similar to the Cython docs:
 010: #    http://stackoverflow.com/a/28166272/428751
 011: #    Allows to return a malloced python buffer,
 012: #    which will be freed when the python object is garbage collected
 013: #    (also uses memalign to allocate the buffer)
 014: # 2) object to buffer conversion utility functions,
 015: # 3) xxhash wrapper
 016: 
 017: #cython: auto_pickle=False, wraparound=False, cdivision=True
 018: from __future__ import absolute_import
 019: 
 020: 
 021: from cpython.buffer cimport PyBuffer_FillInfo
 022: from libc.stdlib cimport free
 023: from libc.string cimport memcpy
 024: from libc.stdint cimport uintptr_t
 025: 
 026: cdef extern from "memalign.h":
 027:     void *xmemalign(size_t size) nogil
 028:     int MEMALIGN_ALIGNMENT
 029: 
 030: cdef extern from "buffers.h":
 031:     object _memory_as_pybuffer(void* ptr, Py_ssize_t buf_len, int readonly)
 032:     int _object_as_buffer(object obj, const void ** buffer, Py_ssize_t * buffer_len)
 033:     int _object_as_write_buffer(object obj, void ** buffer, Py_ssize_t * buffer_len)
 034: 
 035: cdef extern from "xxhash.h":
 036:     ctypedef unsigned long long XXH64_hash_t
 037:     XXH64_hash_t XXH64(const void* input, size_t length, unsigned long long seed) nogil
 038: 
 039: 
+040: cdef void free_buf(const void *p, size_t l, void *arg):
static void __pyx_f_4xpra_7buffers_6membuf_free_buf(void const *__pyx_v_p, CYTHON_UNUSED size_t __pyx_v_l, CYTHON_UNUSED void *__pyx_v_arg) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("free_buf", 0);
/* … */
  /* function exit code */
  __Pyx_RefNannyFinishContext();
}
+041:     free(<void *>p)
  free(((void *)__pyx_v_p));
 042: 
+043: cdef getbuf(size_t l):
static PyObject *__pyx_f_4xpra_7buffers_6membuf_getbuf(size_t __pyx_v_l) {
  void const *__pyx_v_p;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getbuf", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("xpra.buffers.membuf.getbuf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+044:     cdef const void *p = xmemalign(l)
  __pyx_v_p = xmemalign(__pyx_v_l);
+045:     assert p!=NULL, "failed to allocate %i bytes of memory" % l
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_p != NULL) != 0))) {
      __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_l); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_failed_to_allocate_i_bytes_of_me, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(0, 45, __pyx_L1_error)
    }
  }
  #endif
+046:     return MemBuf_init(p, l, &free_buf, NULL)
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_4xpra_7buffers_6membuf_MemBuf_init(__pyx_v_p, __pyx_v_l, (&__pyx_f_4xpra_7buffers_6membuf_free_buf), NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;
 047: 
+048: cdef padbuf(size_t l, size_t padding):
static PyObject *__pyx_f_4xpra_7buffers_6membuf_padbuf(size_t __pyx_v_l, size_t __pyx_v_padding) {
  void const *__pyx_v_p;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("padbuf", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("xpra.buffers.membuf.padbuf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+049:     cdef const void *p = xmemalign(l+padding)
  __pyx_v_p = xmemalign((__pyx_v_l + __pyx_v_padding));
+050:     assert p!=NULL, "failed to allocate %i bytes of memory" % l
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_p != NULL) != 0))) {
      __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_l); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_failed_to_allocate_i_bytes_of_me, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(0, 50, __pyx_L1_error)
    }
  }
  #endif
+051:     return MemBuf_init(p, l, &free_buf, NULL)
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_4xpra_7buffers_6membuf_MemBuf_init(__pyx_v_p, __pyx_v_l, (&__pyx_f_4xpra_7buffers_6membuf_free_buf), NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;
 052: 
+053: cdef makebuf(void *p, size_t l):
static PyObject *__pyx_f_4xpra_7buffers_6membuf_makebuf(void *__pyx_v_p, size_t __pyx_v_l) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("makebuf", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("xpra.buffers.membuf.makebuf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+054:     assert p!=NULL, "invalid NULL buffer pointer"
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_p != NULL) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_invalid_NULL_buffer_pointer);
      __PYX_ERR(0, 54, __pyx_L1_error)
    }
  }
  #endif
+055:     return MemBuf_init(p, l, &free_buf, NULL)
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_4xpra_7buffers_6membuf_MemBuf_init(__pyx_v_p, __pyx_v_l, (&__pyx_f_4xpra_7buffers_6membuf_free_buf), NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;
 056: 
 057: 
+058: cdef void *memalign(size_t size) nogil:
static void *__pyx_f_4xpra_7buffers_6membuf_memalign(size_t __pyx_v_size) {
  void *__pyx_r;
/* … */
  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}
+059:     return xmemalign(size)
  __pyx_r = xmemalign(__pyx_v_size);
  goto __pyx_L0;
 060: 
 061: 
+062: cdef object memory_as_pybuffer(void* ptr, Py_ssize_t buf_len, int readonly):
static PyObject *__pyx_f_4xpra_7buffers_6membuf_memory_as_pybuffer(void *__pyx_v_ptr, Py_ssize_t __pyx_v_buf_len, int __pyx_v_readonly) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("memory_as_pybuffer", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("xpra.buffers.membuf.memory_as_pybuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+063:     return _memory_as_pybuffer(ptr, buf_len, readonly)
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = _memory_as_pybuffer(__pyx_v_ptr, __pyx_v_buf_len, __pyx_v_readonly); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;
 064: 
+065: cdef int object_as_buffer(object obj, const void ** buffer, Py_ssize_t * buffer_len):
static int __pyx_f_4xpra_7buffers_6membuf_object_as_buffer(PyObject *__pyx_v_obj, void const **__pyx_v_buffer, Py_ssize_t *__pyx_v_buffer_len) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("object_as_buffer", 0);
/* … */
  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+066:     return _object_as_buffer(obj, buffer, buffer_len)
  __pyx_r = _object_as_buffer(__pyx_v_obj, __pyx_v_buffer, __pyx_v_buffer_len);
  goto __pyx_L0;
 067: 
+068: cdef int object_as_write_buffer(object obj, void ** buffer, Py_ssize_t * buffer_len):
static int __pyx_f_4xpra_7buffers_6membuf_object_as_write_buffer(PyObject *__pyx_v_obj, void **__pyx_v_buffer, Py_ssize_t *__pyx_v_buffer_len) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("object_as_write_buffer", 0);
/* … */
  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+069:     return _object_as_write_buffer(obj, buffer, buffer_len)
  __pyx_r = _object_as_write_buffer(__pyx_v_obj, __pyx_v_buffer, __pyx_v_buffer_len);
  goto __pyx_L0;
 070: 
 071: 
+072: cdef class MemBuf:
struct __pyx_vtabstruct_4xpra_7buffers_6membuf_MemBuf {
  void const *(*get_mem)(struct __pyx_obj_4xpra_7buffers_6membuf_MemBuf *);
};
static struct __pyx_vtabstruct_4xpra_7buffers_6membuf_MemBuf *__pyx_vtabptr_4xpra_7buffers_6membuf_MemBuf;
 073: 
+074:     def __len__(self):
/* Python wrapper */
static Py_ssize_t __pyx_pw_4xpra_7buffers_6membuf_6MemBuf_1__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_4xpra_7buffers_6membuf_6MemBuf_1__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4xpra_7buffers_6membuf_6MemBuf___len__(((struct __pyx_obj_4xpra_7buffers_6membuf_MemBuf *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_4xpra_7buffers_6membuf_6MemBuf___len__(struct __pyx_obj_4xpra_7buffers_6membuf_MemBuf *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);
/* … */
  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+075:         return self.l
  __pyx_r = __pyx_v_self->l;
  goto __pyx_L0;
 076: 
+077:     def __repr__(self):
/* Python wrapper */
static PyObject *__pyx_pw_4xpra_7buffers_6membuf_6MemBuf_3__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4xpra_7buffers_6membuf_6MemBuf_3__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4xpra_7buffers_6membuf_6MemBuf_2__repr__(((struct __pyx_obj_4xpra_7buffers_6membuf_MemBuf *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4xpra_7buffers_6membuf_6MemBuf_2__repr__(struct __pyx_obj_4xpra_7buffers_6membuf_MemBuf *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("xpra.buffers.membuf.MemBuf.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+078:         return "MemBuf(%#x)" % (<uintptr_t> self.p)
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_self->p)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemBuf_x, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;
 079: 
+080:     cdef const void *get_mem(self):
static void const *__pyx_f_4xpra_7buffers_6membuf_6MemBuf_get_mem(struct __pyx_obj_4xpra_7buffers_6membuf_MemBuf *__pyx_v_self) {
  void const *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_mem", 0);
/* … */
  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+081:         return self.p
  __pyx_r = __pyx_v_self->p;
  goto __pyx_L0;
 082: 
+083:     def __getbuffer__(self, Py_buffer *view, int flags):
/* Python wrapper */
static CYTHON_UNUSED int __pyx_pw_4xpra_7buffers_6membuf_6MemBuf_5__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_view, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_pw_4xpra_7buffers_6membuf_6MemBuf_5__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_view, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_r = __pyx_pf_4xpra_7buffers_6membuf_6MemBuf_4__getbuffer__(((struct __pyx_obj_4xpra_7buffers_6membuf_MemBuf *)__pyx_v_self), ((Py_buffer *)__pyx_v_view), ((int)__pyx_v_flags));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_4xpra_7buffers_6membuf_6MemBuf_4__getbuffer__(struct __pyx_obj_4xpra_7buffers_6membuf_MemBuf *__pyx_v_self, Py_buffer *__pyx_v_view, int __pyx_v_flags) {
  int __pyx_r;
  if (__pyx_v_view == NULL) {
    PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
    return -1;
  }
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  __pyx_v_view->obj = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(__pyx_v_view->obj);
/* … */
  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("xpra.buffers.membuf.MemBuf.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_view->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_view->obj);
    __Pyx_DECREF(__pyx_v_view->obj); __pyx_v_view->obj = 0;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_view->obj == Py_None) {
    __Pyx_GOTREF(__pyx_v_view->obj);
    __Pyx_DECREF(__pyx_v_view->obj); __pyx_v_view->obj = 0;
  }
  __pyx_L2:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+084:         PyBuffer_FillInfo(view, self, <void *>self.p, self.l, 1, flags)
  __pyx_t_1 = PyBuffer_FillInfo(__pyx_v_view, ((PyObject *)__pyx_v_self), ((void *)__pyx_v_self->p), __pyx_v_self->l, 1, __pyx_v_flags); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 84, __pyx_L1_error)
 085: 
+086:     def __releasebuffer__(self, Py_buffer *view):
/* Python wrapper */
static CYTHON_UNUSED void __pyx_pw_4xpra_7buffers_6membuf_6MemBuf_7__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_view); /*proto*/
static CYTHON_UNUSED void __pyx_pw_4xpra_7buffers_6membuf_6MemBuf_7__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_view) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
  __pyx_pf_4xpra_7buffers_6membuf_6MemBuf_6__releasebuffer__(((struct __pyx_obj_4xpra_7buffers_6membuf_MemBuf *)__pyx_v_self), ((Py_buffer *)__pyx_v_view));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_4xpra_7buffers_6membuf_6MemBuf_6__releasebuffer__(CYTHON_UNUSED struct __pyx_obj_4xpra_7buffers_6membuf_MemBuf *__pyx_v_self, CYTHON_UNUSED Py_buffer *__pyx_v_view) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__releasebuffer__", 0);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}
 087:         pass
 088: 
+089:     def __dealloc__(self):
/* Python wrapper */
static void __pyx_pw_4xpra_7buffers_6membuf_6MemBuf_9__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4xpra_7buffers_6membuf_6MemBuf_9__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_4xpra_7buffers_6membuf_6MemBuf_8__dealloc__(((struct __pyx_obj_4xpra_7buffers_6membuf_MemBuf *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_4xpra_7buffers_6membuf_6MemBuf_8__dealloc__(struct __pyx_obj_4xpra_7buffers_6membuf_MemBuf *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);
/* … */
  /* function exit code */
  __Pyx_RefNannyFinishContext();
}
+090:         if self.dealloc_cb_p != NULL:
  __pyx_t_1 = ((__pyx_v_self->dealloc_cb_p != NULL) != 0);
  if (__pyx_t_1) {
/* … */
  }
+091:             self.dealloc_cb_p(self.p, self.l, self.dealloc_cb_arg)
    __pyx_v_self->dealloc_cb_p(__pyx_v_self->p, __pyx_v_self->l, __pyx_v_self->dealloc_cb_arg);
 092: 
 093: # Call this instead of constructing a MemBuf directly.  The __cinit__
 094: # and __init__ methods can only take Python objects, so the real
 095: # constructor is here.  See:
 096: # https://mail.python.org/pipermail/cython-devel/2012-June/002734.html
+097: cdef MemBuf MemBuf_init(const void *p, size_t l,
static struct __pyx_obj_4xpra_7buffers_6membuf_MemBuf *__pyx_f_4xpra_7buffers_6membuf_MemBuf_init(void const *__pyx_v_p, size_t __pyx_v_l, __pyx_t_4xpra_7buffers_6membuf_dealloc_callback *__pyx_v_dealloc_cb_p, void *__pyx_v_dealloc_cb_arg) {
  struct __pyx_obj_4xpra_7buffers_6membuf_MemBuf *__pyx_v_ret = 0;
  struct __pyx_obj_4xpra_7buffers_6membuf_MemBuf *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("MemBuf_init", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("xpra.buffers.membuf.MemBuf_init", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ret);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 098:                         dealloc_callback *dealloc_cb_p,
 099:                         void *dealloc_cb_arg):
+100:     cdef MemBuf ret = MemBuf()
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_4xpra_7buffers_6membuf_MemBuf)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ret = ((struct __pyx_obj_4xpra_7buffers_6membuf_MemBuf *)__pyx_t_1);
  __pyx_t_1 = 0;
+101:     ret.p = p
  __pyx_v_ret->p = __pyx_v_p;
+102:     ret.l = l
  __pyx_v_ret->l = __pyx_v_l;
+103:     ret.dealloc_cb_p = dealloc_cb_p
  __pyx_v_ret->dealloc_cb_p = __pyx_v_dealloc_cb_p;
+104:     ret.dealloc_cb_arg = dealloc_cb_arg
  __pyx_v_ret->dealloc_cb_arg = __pyx_v_dealloc_cb_arg;
+105:     return ret
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_ret));
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;
 106: 
 107: 
+108: cdef unsigned long long xxh64(const void* input, size_t length, unsigned long long seed) nogil:
static unsigned PY_LONG_LONG __pyx_f_4xpra_7buffers_6membuf_xxh64(void const *__pyx_v_input, size_t __pyx_v_length, unsigned PY_LONG_LONG __pyx_v_seed) {
  unsigned PY_LONG_LONG __pyx_r;
/* … */
  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}
+109:     return XXH64(input, length, seed)
  __pyx_r = XXH64(__pyx_v_input, __pyx_v_length, __pyx_v_seed);
  goto __pyx_L0;