- or download this
// should NOT alter refcount
Node* set_parent(Node* self, Node* parent) {
self->parent = parent;
return self;
}
- or download this
void set_parent(Node* self, Node* parent) {
self->parent = parent;
}
- or download this
#!perl -l
use warnings;
...
print "x: $x";
print "y: $y";
- or download this
x refcnt: 2
x refcnt: 1
...
Use of uninitialized value $x in concatenation (.) or string at try.pl
+ line 31.
x:
y: 42
- or download this
Node* get_parent(Node* self) {
SvREFCNT_inc(self->parent);
return self->parent;
}
- or download this
NODE: SV = IV(0x2c22740) at 0x2c22744
REFCNT = 1
...
---
destroying Node=SCALAR(0x45807c) at rut.pl line 58.
destroying Node=SCALAR(0x45812c) at rut.pl line 58.
- or download this
void destroy_node(Node* self) {
Safefree(self->parent);
Safefree(self);
}