kamailio: backport and move to PCRE2
[feed/telephony.git] / net / kamailio / patches / 020-lcr-clang-format-for-coherent-indentation-and-coding.patch
1 From ecc2c9e54fa8f24c1e96860c1f59b43f2e1e8b7a Mon Sep 17 00:00:00 2001
2 From: Victor Seva <linuxmaniac@torreviejawireless.org>
3 Date: Wed, 17 May 2023 16:36:55 +0200
4 Subject: [PATCH] lcr: clang-format for coherent indentation and coding style
5
6 ---
7 src/modules/lcr/lcr_mod.c | 125 +++++++++++++++++++++-----------------
8 src/modules/lcr/lcr_rpc.c | 65 ++++++++++----------
9 2 files changed, 102 insertions(+), 88 deletions(-)
10
11 --- a/src/modules/lcr/lcr_mod.c
12 +++ b/src/modules/lcr/lcr_mod.c
13 @@ -259,7 +259,8 @@ static int inactivate_gw(struct sip_msg
14 static int defunct_gw(struct sip_msg *_m, char *_s1, char *_s2);
15 static int from_gw_1(struct sip_msg *_m, char *_s1, char *_s2);
16 static int from_gw_3(struct sip_msg *_m, char *_s1, char *_s2, char *_s3);
17 -static int from_gw_4(struct sip_msg *_m, char *_s1, char *_s2, char *_s3, char *_s4);
18 +static int from_gw_4(
19 + struct sip_msg *_m, char *_s1, char *_s2, char *_s3, char *_s4);
20 static int from_any_gw_0(struct sip_msg *_m, char *_s1, char *_s2);
21 static int from_any_gw_2(struct sip_msg *_m, char *_s1, char *_s2);
22 static int from_any_gw_3(struct sip_msg *_m, char *_s1, char *_s2, char *_s3);
23 @@ -554,7 +555,8 @@ static int mod_init(void)
24 LM_ERR("malformed or non AVP definition <%s>\n", rule_id_avp_param);
25 return -1;
26 }
27 - if(pv_get_avp_name(0, &(avp_spec->pvp), &rule_id_avp, &avp_flags) != 0) {
28 + if(pv_get_avp_name(0, &(avp_spec->pvp), &rule_id_avp, &avp_flags)
29 + != 0) {
30 LM_ERR("invalid AVP definition <%s>\n", rule_id_avp_param);
31 return -1;
32 }
33 @@ -680,18 +682,21 @@ static int mod_init(void)
34 LM_ERR("unable to open database connection\n");
35 return -1;
36 }
37 - if(db_check_table_version(&lcr_dbf, dbh, &lcr_rule_table,
38 - LCR_RULE_TABLE_VERSION) < 0) {
39 + if(db_check_table_version(
40 + &lcr_dbf, dbh, &lcr_rule_table, LCR_RULE_TABLE_VERSION)
41 + < 0) {
42 DB_TABLE_VERSION_ERROR(lcr_rule_table);
43 goto dberror;
44 }
45 if(db_check_table_version(&lcr_dbf, dbh, &lcr_rule_target_table,
46 - LCR_RULE_TARGET_TABLE_VERSION) < 0) {
47 + LCR_RULE_TARGET_TABLE_VERSION)
48 + < 0) {
49 DB_TABLE_VERSION_ERROR(lcr_rule_target_table);
50 goto dberror;
51 }
52 - if (db_check_table_version(&lcr_dbf, dbh, &lcr_gw_table,
53 - LCR_GW_TABLE_VERSION) < 0) {
54 + if(db_check_table_version(
55 + &lcr_dbf, dbh, &lcr_gw_table, LCR_GW_TABLE_VERSION)
56 + < 0) {
57 DB_TABLE_VERSION_ERROR(lcr_gw_table);
58 goto dberror;
59 }
60 @@ -923,20 +928,24 @@ static int comp_gws(const void *_g1, con
61 /*
62 * Compare a gateway using IP address and the src port
63 */
64 -static struct gw_info * find_gateway_by_ip_and_port(struct gw_info * gw, struct gw_info * gws) {
65 +static struct gw_info *find_gateway_by_ip_and_port(
66 + struct gw_info *gw, struct gw_info *gws)
67 +{
68 int tmp = 0, gw_index = 0, i;
69
70 - for (i = 1; i <= gws[0].ip_addr.u.addr32[0]; i++) {
71 - tmp = memcmp(gws[i].ip_addr.u.addr, gw->ip_addr.u.addr, gws[i].ip_addr.len);
72 - if (gws[i].ip_addr.af == gw->ip_addr.af &&
73 - gws[i].ip_addr.len == gw->ip_addr.len &&
74 - tmp == 0 && /* a comparison of the IP address value */
75 - gws[i].port == gw->port) {
76 - gw_index = i;
77 - break;
78 + for(i = 1; i <= gws[0].ip_addr.u.addr32[0]; i++) {
79 + tmp = memcmp(
80 + gws[i].ip_addr.u.addr, gw->ip_addr.u.addr, gws[i].ip_addr.len);
81 + if(gws[i].ip_addr.af == gw->ip_addr.af
82 + && gws[i].ip_addr.len == gw->ip_addr.len && tmp == 0
83 + && /* a comparison of the IP address value */
84 + gws[i].port == gw->port) {
85 + gw_index = i;
86 + break;
87 }
88 }
89 - if (gw_index != 0) return &(gws[gw_index]);
90 + if(gw_index != 0)
91 + return &(gws[gw_index]);
92
93 return NULL;
94 }
95 @@ -1074,7 +1083,7 @@ static int insert_gws(db1_res_t *res, st
96 row = RES_ROWS(res) + i;
97 if((VAL_NULL(ROW_VALUES(row) + 12) == 1)
98 || ((VAL_TYPE(ROW_VALUES(row) + 12) != DB1_INT)
99 - && (VAL_TYPE(ROW_VALUES(row) + 12) != DB1_UINT))) {
100 + && (VAL_TYPE(ROW_VALUES(row) + 12) != DB1_UINT))) {
101 LM_ERR("lcr_gw id at row <%u> is null or not int\n", i);
102 return 0;
103 }
104 @@ -1501,8 +1510,7 @@ int reload_tables()
105
106 if((VAL_NULL(ROW_VALUES(row)) == 1)
107 || ((VAL_TYPE(ROW_VALUES(row)) != DB1_INT)
108 - && (VAL_TYPE(ROW_VALUES(row))
109 - != DB1_UINT))) {
110 + && (VAL_TYPE(ROW_VALUES(row)) != DB1_UINT))) {
111 LM_ERR("lcr rule id at row <%u> is null or not int\n", i);
112 goto err;
113 }
114 @@ -1544,8 +1552,8 @@ int reload_tables()
115
116 if((VAL_NULL(ROW_VALUES(row) + 3) == 1)
117 || ((VAL_TYPE(ROW_VALUES(row) + 3) != DB1_INT)
118 - && (VAL_TYPE(ROW_VALUES(row) + 3)
119 - != DB1_UINT))) {
120 + && (VAL_TYPE(ROW_VALUES(row) + 3)
121 + != DB1_UINT))) {
122 LM_ERR("lcr rule <%u> stopper is NULL or not int\n",
123 rule_id);
124 goto err;
125 @@ -1558,8 +1566,8 @@ int reload_tables()
126
127 if((VAL_NULL(ROW_VALUES(row) + 4) == 1)
128 || ((VAL_TYPE(ROW_VALUES(row) + 4) != DB1_INT)
129 - && (VAL_TYPE(ROW_VALUES(row) + 4)
130 - != DB1_UINT))) {
131 + && (VAL_TYPE(ROW_VALUES(row) + 4)
132 + != DB1_UINT))) {
133 LM_ERR("lcr rule <%u> enabled is NULL or not int\n",
134 rule_id);
135 goto err;
136 @@ -1769,8 +1777,7 @@ int reload_tables()
137 row = RES_ROWS(res) + i;
138 if((VAL_NULL(ROW_VALUES(row)) == 1)
139 || ((VAL_TYPE(ROW_VALUES(row)) != DB1_INT)
140 - && (VAL_TYPE(ROW_VALUES(row))
141 - != DB1_UINT))) {
142 + && (VAL_TYPE(ROW_VALUES(row)) != DB1_UINT))) {
143 LM_ERR("lcr_rule_target rule_id at row <%u> is null "
144 "or not int\n",
145 i);
146 @@ -1779,8 +1786,8 @@ int reload_tables()
147 rule_id = (unsigned int)VAL_INT(ROW_VALUES(row));
148 if((VAL_NULL(ROW_VALUES(row) + 1) == 1)
149 || ((VAL_TYPE(ROW_VALUES(row) + 1) != DB1_INT)
150 - && (VAL_TYPE(ROW_VALUES(row) + 1)
151 - != DB1_UINT))) {
152 + && (VAL_TYPE(ROW_VALUES(row) + 1)
153 + != DB1_UINT))) {
154 LM_ERR("lcr_rule_target gw_id at row <%u> is null "
155 "or not int\n",
156 i);
157 @@ -1789,8 +1796,8 @@ int reload_tables()
158 gw_id = (unsigned int)VAL_INT(ROW_VALUES(row) + 1);
159 if((VAL_NULL(ROW_VALUES(row) + 2) == 1)
160 || ((VAL_TYPE(ROW_VALUES(row) + 2) != DB1_INT)
161 - && (VAL_TYPE(ROW_VALUES(row) + 2)
162 - != DB1_UINT))) {
163 + && (VAL_TYPE(ROW_VALUES(row) + 2)
164 + != DB1_UINT))) {
165 LM_ERR("lcr_rule_target priority at row <%u> is null "
166 "or not int\n",
167 i);
168 @@ -1805,8 +1812,8 @@ int reload_tables()
169 }
170 if((VAL_NULL(ROW_VALUES(row) + 3) == 1)
171 || ((VAL_TYPE(ROW_VALUES(row) + 3) != DB1_INT)
172 - && (VAL_TYPE(ROW_VALUES(row) + 3)
173 - != DB1_UINT))) {
174 + && (VAL_TYPE(ROW_VALUES(row) + 3)
175 + != DB1_UINT))) {
176 LM_ERR("lcr_rule_target weight at row <%u> is null "
177 "or not int\n",
178 i);
179 @@ -2087,10 +2094,10 @@ void add_gws_into_avps(struct gw_info *g
180 if(5 /* gw_index */ + 5 /* scheme */ + 4 /* strip */ + prefix_len
181 + tag_len + 1 /* @ */
182 + ((hostname_len > IP6_MAX_STR_SIZE + 2)
183 - ? hostname_len
184 - : IP6_MAX_STR_SIZE + 2)
185 + ? hostname_len
186 + : IP6_MAX_STR_SIZE + 2)
187 + 6 /* port */ + params_len /* params */
188 - + 15 /* transport */ + 10 /* flags */
189 + + 15 /* transport */ + 10 /* flags */
190 + 7 /* separators */
191 + 10 /* rule_id */
192 > MAX_URI_LEN) {
193 @@ -2174,7 +2181,7 @@ int load_gws_dummy(int lcr_id, str *ruri
194 if((rule->from_uri_len != 0)
195 && (pcre_exec(rule->from_uri_re, NULL, from_uri->s,
196 from_uri->len, 0, 0, NULL, 0)
197 - < 0))
198 + < 0))
199 goto next;
200
201 if((from_uri->len > 0) && (rule->mt_tvalue_len > 0)) {
202 @@ -2339,7 +2346,7 @@ static int ki_load_gws_furi(
203 if((rule->from_uri_len != 0)
204 && (pcre_exec(rule->from_uri_re, NULL, from_uri->s,
205 from_uri->len, 0, 0, NULL, 0)
206 - < 0)) {
207 + < 0)) {
208 LM_DBG("from uri <%.*s> did not match to from regex <%.*s>\n",
209 from_uri->len, from_uri->s, rule->from_uri_len,
210 rule->from_uri);
211 @@ -2375,7 +2382,7 @@ static int ki_load_gws_furi(
212 if((rule->request_uri_len != 0)
213 && (pcre_exec(rule->request_uri_re, NULL, request_uri->s,
214 request_uri->len, 0, 0, NULL, 0)
215 - < 0)) {
216 + < 0)) {
217 LM_DBG("request uri <%.*s> did not match to request regex "
218 "<%.*s>\n",
219 request_uri->len, request_uri->s, rule->request_uri_len,
220 @@ -2549,7 +2556,8 @@ static int generate_uris(struct sip_msg
221 return 0; /* No more gateways left */
222
223 decode_avp_value(gw_uri_val.s.s, gw_index, &scheme, &strip, &prefix,
224 - &tmp_tag, addr, &hostname, &port, &params, &transport, flags, rule_id);
225 + &tmp_tag, addr, &hostname, &port, &params, &transport, flags,
226 + rule_id);
227
228 if(addr->af != 0) {
229 addr_str.s = ip_addr2a(addr);
230 @@ -2560,8 +2568,8 @@ static int generate_uris(struct sip_msg
231
232 if(scheme.len + r_uri_user->len - strip + prefix.len + 1 /* @ */
233 + ((hostname.len > IP6_MAX_STR_SIZE + 2)
234 - ? hostname.len
235 - : IP6_MAX_STR_SIZE + 2)
236 + ? hostname.len
237 + : IP6_MAX_STR_SIZE + 2)
238 + 1 /* : */ + port.len + params.len + transport.len
239 + 1 /* null */
240 > MAX_URI_LEN) {
241 @@ -2992,7 +3000,7 @@ static int ki_next_gw(sip_msg_t *_m)
242 if(rule_id_avp_param) {
243 val.n = rule_id;
244 add_avp(rule_id_avp_type, rule_id_avp, val);
245 - LM_DBG("added rule_id_avp <%u>\n", (unsigned int)val.n);
246 + LM_DBG("added rule_id_avp <%u>\n", (unsigned int)val.n);
247 }
248
249 /* Add index of selected gw to defunct gw AVP */
250 @@ -3018,7 +3026,8 @@ static int next_gw(struct sip_msg *_m, c
251 * Checks if request comes from ip address of a gateway
252 */
253 static int do_from_gw(struct sip_msg *_m, unsigned int lcr_id,
254 - struct ip_addr *src_addr, uri_transport transport, unsigned int src_port)
255 + struct ip_addr *src_addr, uri_transport transport,
256 + unsigned int src_port)
257 {
258 struct gw_info *res, gw, *gws;
259 int_str val;
260 @@ -3032,18 +3041,20 @@ static int do_from_gw(struct sip_msg *_m
261 }
262
263 gw.ip_addr = *src_addr;
264 - if (src_port != 0) {
265 + if(src_port != 0) {
266 /* Search for gw based on its ip address and port */
267 gw.port = src_port;
268 res = find_gateway_by_ip_and_port(&gw, gws);
269 } else {
270 /* Search for gw based on its ip address */
271 - res = (struct gw_info *)bsearch(&gw, &(gws[1]), gws[0].ip_addr.u.addr32[0],
272 - sizeof(struct gw_info), comp_gws);
273 + res = (struct gw_info *)bsearch(&gw, &(gws[1]),
274 + gws[0].ip_addr.u.addr32[0], sizeof(struct gw_info), comp_gws);
275 }
276
277 /* Store tag and flags and return result */
278 - if((res != NULL) && ((transport == PROTO_NONE) || (res->transport_code == transport))) {
279 + if((res != NULL)
280 + && ((transport == PROTO_NONE)
281 + || (res->transport_code == transport))) {
282 LM_DBG("request came from gw\n");
283 if(tag_avp_param) {
284 val.s.s = res->tag;
285 @@ -3178,8 +3189,8 @@ static int from_gw_3(
286 return ki_from_gw_addr_port(_m, lcr_id, &addr_str, transport, 0);
287 }
288
289 -static int from_gw_4(
290 - struct sip_msg *_m, char *_lcr_id, char *_addr, char *_transport, char *_src_port)
291 +static int from_gw_4(struct sip_msg *_m, char *_lcr_id, char *_addr,
292 + char *_transport, char *_src_port)
293 {
294 int lcr_id;
295 str addr_str;
296 @@ -3202,7 +3213,7 @@ static int from_gw_4(
297 LM_ERR("invalid transport parameter %s\n", _lcr_id);
298 return -1;
299 }
300 - tmp=0;
301 + tmp = 0;
302 src_port = strtol(_src_port, &tmp, 10);
303 if((tmp == 0) || (*tmp) || (tmp == _src_port)) {
304 LM_ERR("invalid port parameter %s\n", _src_port);
305 @@ -3243,8 +3254,8 @@ static int from_any_gw_0(struct sip_msg
306 * Checks if request comes from ip address of a gateway taking source
307 * IP address, transport protocol and source port from parameters.
308 */
309 -static int ki_from_any_gw_addr_port(sip_msg_t *_m, str *addr_str, int transport,
310 - int src_port)
311 +static int ki_from_any_gw_addr_port(
312 + sip_msg_t *_m, str *addr_str, int transport, int src_port)
313 {
314 unsigned int i;
315 struct ip_addr *ip, src_addr;
316 @@ -3307,7 +3318,8 @@ static int from_any_gw_2(struct sip_msg
317 return ki_from_any_gw_addr_port(_m, &addr_str, transport, 0);
318 }
319
320 -static int from_any_gw_3(struct sip_msg *_m, char *_addr, char *_transport, char *_src_port)
321 +static int from_any_gw_3(
322 + struct sip_msg *_m, char *_addr, char *_transport, char *_src_port)
323 {
324 str addr_str;
325 uri_transport transport;
326 @@ -3323,7 +3335,7 @@ static int from_any_gw_3(struct sip_msg
327 LM_ERR("invalid transport parameter %s\n", _transport);
328 return -1;
329 }
330 - tmp=0;
331 + tmp = 0;
332 src_port = strtol(_src_port, &tmp, 10);
333 if((tmp == 0) || (*tmp) || (tmp == _src_port)) {
334 LM_ERR("invalid port parameter %s\n", _src_port);
335 @@ -3355,8 +3367,9 @@ static int do_to_gw(struct sip_msg *_m,
336 sizeof(struct gw_info), comp_gws);
337
338 /* Return result */
339 - if((res != NULL) && ((transport == PROTO_NONE)
340 - || (res->transport_code == transport))) {
341 + if((res != NULL)
342 + && ((transport == PROTO_NONE)
343 + || (res->transport_code == transport))) {
344 LM_DBG("request goes to gw\n");
345 return 1;
346 } else {
347 --- a/src/modules/lcr/lcr_rpc.c
348 +++ b/src/modules/lcr/lcr_rpc.c
349 @@ -48,7 +48,8 @@ static void reload(rpc_t *rpc, void *c)
350 static const char *dump_gws_doc[2] = {"Dump the contents of lcr_gws table.", 0};
351
352
353 -static void dump_gw(rpc_t *rpc, void *st, struct gw_info *gw, unsigned int gw_index, unsigned int lcr_id)
354 +static void dump_gw(rpc_t *rpc, void *st, struct gw_info *gw,
355 + unsigned int gw_index, unsigned int lcr_id)
356 {
357 str scheme, gw_name, hostname, params, transport;
358 str prefix, tag;
359 @@ -72,14 +73,10 @@ static void dump_gw(rpc_t *rpc, void *st
360 break;
361 case AF_INET6:
362 rpc->struct_printf(st, "ip_addr", "%x:%x:%x:%x:%x:%x:%x:%x",
363 - gw->ip_addr.u.addr16[0],
364 - gw->ip_addr.u.addr16[1],
365 - gw->ip_addr.u.addr16[2],
366 - gw->ip_addr.u.addr16[3],
367 - gw->ip_addr.u.addr16[4],
368 - gw->ip_addr.u.addr16[5],
369 - gw->ip_addr.u.addr16[6],
370 - gw->ip_addr.u.addr16[7]);
371 + gw->ip_addr.u.addr16[0], gw->ip_addr.u.addr16[1],
372 + gw->ip_addr.u.addr16[2], gw->ip_addr.u.addr16[3],
373 + gw->ip_addr.u.addr16[4], gw->ip_addr.u.addr16[5],
374 + gw->ip_addr.u.addr16[6], gw->ip_addr.u.addr16[7]);
375 break;
376 case 0:
377 rpc->struct_add(st, "s", "ip_addr", "0.0.0.0");
378 @@ -99,11 +96,10 @@ static void dump_gw(rpc_t *rpc, void *st
379 prefix.len = gw->prefix_len;
380 tag.s = gw->tag;
381 tag.len = gw->tag_len;
382 - start = int2strbuf(
383 - gw->defunct_until, &(buf[0]), INT2STR_MAX_LEN, &len);
384 - rpc->struct_add(st, "dSSdds", "strip", gw->strip, "prefix",
385 - &prefix, "tag", &tag, "flags", gw->flags, "state",
386 - gw->state, "defunct_until", start);
387 + start = int2strbuf(gw->defunct_until, &(buf[0]), INT2STR_MAX_LEN, &len);
388 + rpc->struct_add(st, "dSSdds", "strip", gw->strip, "prefix", &prefix, "tag",
389 + &tag, "flags", gw->flags, "state", gw->state, "defunct_until",
390 + start);
391 }
392
393 static void dump_gws(rpc_t *rpc, void *c)
394 @@ -119,7 +115,7 @@ static void dump_gws(rpc_t *rpc, void *c
395 gws = gw_pt[j];
396
397 for(i = 1; i <= gws[0].ip_addr.u.addr32[0]; i++) {
398 - if (srec==NULL) {
399 + if(srec == NULL) {
400 /* We create one array per lcr_id */
401 if(rpc->add(c, "{", &rec) < 0)
402 return;
403 @@ -143,7 +139,7 @@ static void dump_rules(rpc_t *rpc, void
404 int i, j;
405 int _filter_by_prefix = 0;
406 int _lcr_id = 0;
407 - str _prefix = {NULL,0};
408 + str _prefix = {NULL, 0};
409 struct rule_info **rules, *rule;
410 struct target *t;
411 void *rec = NULL;
412 @@ -151,29 +147,32 @@ static void dump_rules(rpc_t *rpc, void
413 void *st, *sst, *ssst;
414 str prefix, from_uri, request_uri;
415
416 - if (rpc->scan(c, "d", &_lcr_id)>0) {
417 - if (rpc->scan(c, ".S", &_prefix)>0) {
418 + if(rpc->scan(c, "d", &_lcr_id) > 0) {
419 + if(rpc->scan(c, ".S", &_prefix) > 0) {
420 _filter_by_prefix = 1;
421 }
422 }
423
424 for(j = 1; j <= lcr_count_param; j++) {
425
426 - if (_lcr_id && _lcr_id!=j) continue;
427 + if(_lcr_id && _lcr_id != j)
428 + continue;
429
430 rules = rule_pt[j];
431
432 for(i = 0; i < lcr_rule_hash_size_param; i++) {
433 rule = rules[i];
434 while(rule) {
435 - if (_filter_by_prefix && _prefix.len && _prefix.s) {
436 - if (_prefix.len < rule->prefix_len ||
437 - strncmp(_prefix.s, rule->prefix, rule->prefix_len)!=0) {
438 + if(_filter_by_prefix && _prefix.len && _prefix.s) {
439 + if(_prefix.len < rule->prefix_len
440 + || strncmp(_prefix.s, rule->prefix,
441 + rule->prefix_len)
442 + != 0) {
443 rule = rule->next;
444 continue;
445 }
446 }
447 - if (srec==NULL) {
448 + if(srec == NULL) {
449 /* We create one array per lcr_id */
450 if(rpc->add(c, "{", &rec) < 0)
451 return;
452 @@ -192,11 +191,11 @@ static void dump_rules(rpc_t *rpc, void
453 rule->rule_id, "prefix", &prefix, "from_uri", &from_uri,
454 "request_uri", &request_uri, "stopper", rule->stopper);
455 t = rule->targets;
456 - if (t) {
457 - if (rpc->struct_add(st, "[", "gw", &sst) < 0)
458 + if(t) {
459 + if(rpc->struct_add(st, "[", "gw", &sst) < 0)
460 return;
461 while(t) {
462 - if (rpc->array_add(sst, "{", &ssst) < 0)
463 + if(rpc->array_add(sst, "{", &ssst) < 0)
464 return;
465 rpc->struct_add(ssst, "ddd", "gw_index", t->gw_index,
466 "priority", t->priority, "weight", t->weight);
467 @@ -210,10 +209,10 @@ static void dump_rules(rpc_t *rpc, void
468 /* Mark the end of rule array */
469 srec = NULL;
470
471 - if (_filter_by_prefix)
472 + if(_filter_by_prefix)
473 continue;
474 rule = rules[lcr_rule_hash_size_param];
475 - if (rule) {
476 + if(rule) {
477 if(rpc->struct_add(rec, "[", "prefix_len", &st) < 0)
478 return;
479 while(rule) {
480 @@ -222,7 +221,8 @@ static void dump_rules(rpc_t *rpc, void
481 }
482 }
483 }
484 - if (rec==NULL) rpc->fault(c, 404, "Empty reply");
485 + if(rec == NULL)
486 + rpc->fault(c, 404, "Empty reply");
487 }
488
489
490 @@ -269,8 +269,9 @@ static void load_gws(rpc_t *rpc, void *c
491
492 ret = rpc->scan(c, "dS*SS", &lcr_id, &uri_user, &caller_uri, &request_uri);
493 if(ret == -1) {
494 - rpc->fault(c, 400, "parameter error; if using cli, remember to prefix "
495 - "numeric uri_user param value with 's:'");
496 + rpc->fault(c, 400,
497 + "parameter error; if using cli, remember to prefix "
498 + "numeric uri_user param value with 's:'");
499 return;
500 }
501
502 @@ -289,7 +290,7 @@ static void load_gws(rpc_t *rpc, void *c
503
504 gws = gw_pt[lcr_id];
505 for(j = 0; j < gw_count; j++) {
506 - if (rec==NULL) {
507 + if(rec == NULL) {
508 if(rpc->add(c, "[", &rec) < 0)
509 return;
510 }