~mdw
/
catacomb-python
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
838ab17
)
buffer.c: Add `WriteBuffer.contents' property.
author
Mark Wooding
<mdw@distorted.org.uk>
Sat, 29 Jul 2017 00:12:14 +0000
(
01:12
+0100)
committer
Mark Wooding
<mdw@distorted.org.uk>
Sat, 10 Nov 2018 01:30:58 +0000
(
01:30
+0000)
I'm fed of writing `C.ByteString(buf)'.
buffer.c
patch
|
blob
|
blame
|
history
diff --git
a/buffer.c
b/buffer.c
index
4160638
..
d2aa8d5
100644
(file)
--- a/
buffer.c
+++ b/
buffer.c
@@
-482,9
+482,13
@@
static PyObject *wbmeth_putgeraw(PyObject *me, PyObject *arg)
static PyObject *wbget_size(PyObject *me, void *hunoz)
{ return (PyInt_FromLong(BLEN(BUF_B(me)))); }
+static PyObject *wbget_contents(PyObject *me, void *hunoz)
+ { return (bytestring_pywrap(BBASE(BUF_B(me)), BLEN(BUF_B(me)))); }
+
static PyGetSetDef wbuf_pygetset[] = {
#define GETSETNAME(op, name) wb##op##_##name
GET (size, "WBUF.size -> SIZE")
+ GET (contents, "WBUF.contents -> STR")
#undef GETSETNAME
{ 0 }
};