Lines Matching full:cs
24 static void comm_strs__remove_if_last(struct comm_str *cs);
44 static refcount_t *comm_str__refcnt(struct comm_str *cs) in comm_str__refcnt() argument
46 return &RC_CHK_ACCESS(cs)->refcnt; in comm_str__refcnt()
49 static const char *comm_str__str(const struct comm_str *cs) in comm_str__str() argument
51 return &RC_CHK_ACCESS(cs)->str[0]; in comm_str__str()
54 static struct comm_str *comm_str__get(struct comm_str *cs) in comm_str__get() argument
58 if (RC_CHK_GET(result, cs)) in comm_str__get()
59 refcount_inc_not_zero(comm_str__refcnt(cs)); in comm_str__get()
64 static void comm_str__put(struct comm_str *cs) in comm_str__put() argument
66 if (!cs) in comm_str__put()
69 if (refcount_dec_and_test(comm_str__refcnt(cs))) { in comm_str__put()
70 RC_CHK_FREE(cs); in comm_str__put()
72 if (refcount_read(comm_str__refcnt(cs)) == 1) in comm_str__put()
73 comm_strs__remove_if_last(cs); in comm_str__put()
75 RC_CHK_PUT(cs); in comm_str__put()
82 RC_STRUCT(comm_str) *cs; in comm_str__new()
84 cs = malloc(sizeof(*cs) + strlen(str) + 1); in comm_str__new()
85 if (ADD_RC_CHK(result, cs)) { in comm_str__new()
87 strcpy(&cs->str[0], str); in comm_str__new()
100 static void comm_strs__remove_if_last(struct comm_str *cs) in comm_strs__remove_if_last() argument
109 if (refcount_read(comm_str__refcnt(cs)) == 1) { in comm_strs__remove_if_last()
112 entry = bsearch(comm_str__str(cs), comm_strs->strs, comm_strs->num_strs, in comm_strs__remove_if_last()