MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / q2str

Function q2str

qvalue.h:133–167  ·  view source on GitHub ↗

! \brief * Convert q value to string */

Source from the content-addressed store, hash-verified

131 * Convert q value to string
132 */
133static inline char* q2str(qvalue_t q, unsigned int* len)
134{
135 static char buf[sizeof("0.123")];
136 char* p;
137
138 p = buf;
139 if (q == Q_UNSPECIFIED) {
140 /* Do nothing */
141 } else if (q >= MAX_Q) {
142 memcpy(p, MAX_Q_STR, MAX_Q_STR_LEN);
143 p += MAX_Q_STR_LEN;
144 } else if (q <= MIN_Q) {
145 memcpy(p, MIN_Q_STR, MIN_Q_STR_LEN);
146 p += MIN_Q_STR_LEN;
147 } else {
148 memcpy(p, Q_PREFIX, Q_PREFIX_LEN);
149 p += Q_PREFIX_LEN;
150
151 *p++ = q / 100 + '0';
152 q %= 100;
153 if (!q) goto end;
154
155 *p++ = q / 10 + '0';
156 q %= 10;
157 if (!q) goto end;
158
159 *p++ = q + '0';
160 }
161 end:
162 *p = '\0';
163 if (len) {
164 *len = p - buf;
165 }
166 return buf;
167}
168
169
170/*! \brief

Callers 8

get_branch_fieldFunction · 0.85
get_msg_branch_fieldFunction · 0.85
print_dsetFunction · 0.85
build_contactFunction · 0.85
mi_add_aor_nodeFunction · 0.85
print_ucontactFunction · 0.85
_pv_get_tm_branch_fieldFunction · 0.85
build_contactFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected