Lines Matching refs:cs
16 static struct comm_str *comm_str__get(struct comm_str *cs) in comm_str__get() argument
18 if (cs) in comm_str__get()
19 atomic_inc(&cs->refcnt); in comm_str__get()
20 return cs; in comm_str__get()
23 static void comm_str__put(struct comm_str *cs) in comm_str__put() argument
25 if (cs && atomic_dec_and_test(&cs->refcnt)) { in comm_str__put()
26 rb_erase(&cs->rb_node, &comm_str_root); in comm_str__put()
27 zfree(&cs->str); in comm_str__put()
28 free(cs); in comm_str__put()
34 struct comm_str *cs; in comm_str__alloc() local
36 cs = zalloc(sizeof(*cs)); in comm_str__alloc()
37 if (!cs) in comm_str__alloc()
40 cs->str = strdup(str); in comm_str__alloc()
41 if (!cs->str) { in comm_str__alloc()
42 free(cs); in comm_str__alloc()
46 atomic_set(&cs->refcnt, 0); in comm_str__alloc()
48 return cs; in comm_str__alloc()