int decref(Ref *r)
typedef struct struct Ref { Lock; long ref; } Ref;
The reference count proper is found in ref; the Lock prevents concurrent updates (see lock(10.2)).
Incref atomically increments the reference count r, and returns the new count.
Decref atomically decrements the reference count r, and returns the new count.
if(decref(s) == 0) free(s);
REF(10.2 ) | Rev: Tue Mar 31 02:42:39 GMT 2015 |