@@ -160,9 +160,9 @@ static int trim_to_single_contact(struct sip_msg *msg, str *aor)
160
160
return -1 ;
161
161
}
162
162
163
- if (anchor == NULL ) {
163
+ if (! anchor ) {
164
164
anchor = anchor_lump (msg , msg -> unparsed - msg -> buf , 0 );
165
- if (anchor == NULL ) {
165
+ if (! anchor ) {
166
166
LM_ERR ("failed to add anchor lump\n" );
167
167
return -1 ;
168
168
}
@@ -191,7 +191,7 @@ static int trim_to_single_contact(struct sip_msg *msg, str *aor)
191
191
/* > ;expires=<integer> \0 */
192
192
193
193
buf = pkg_malloc (len );
194
- if (buf == NULL ) {
194
+ if (! buf ) {
195
195
LM_ERR ("oom\n" );
196
196
return -1 ;
197
197
}
@@ -985,7 +985,7 @@ int append_contacts(ucontact_t *contacts, struct sip_msg *msg)
985
985
}
986
986
987
987
len = sprintf (buf , "%.*s" , contact .data_len , contact .buf );
988
- if (insert_new_lump_after (anchor , buf , len , HDR_CONTACT_T ) == NULL ) {
988
+ if (! insert_new_lump_after (anchor , buf , len , HDR_CONTACT_T )) {
989
989
pkg_free (buf );
990
990
return -1 ;
991
991
}
@@ -1261,21 +1261,18 @@ static inline int save_restore_rpl_contacts(struct sip_msg *req,
1261
1261
else
1262
1262
mri -> ul_flags = FL_NONE ;
1263
1263
1264
- if (is_tcp_based_proto (req -> rcv .proto ) && ( req -> flags & tcp_persistent_flag )) {
1264
+ if (is_tcp_based_proto (req -> rcv .proto ) && req -> flags & tcp_persistent_flag )
1265
1265
tcp_check = 1 ;
1266
- }
1267
1266
1268
1267
LM_DBG ("running\n" );
1269
1268
1270
1269
/* remove all "Contact" headers from the reply */
1271
1270
for (hdr = rpl -> contact ; hdr ; hdr = hdr -> next ) {
1272
- if (hdr -> type == HDR_CONTACT_T ) {
1273
- if (del_lump (rpl , hdr -> name .s - rpl -> buf ,
1274
- hdr -> len , HDR_CONTACT_T ) == NULL ) {
1275
- LM_ERR ("failed to delete contact '%.*s'\n" , hdr -> name .len ,
1276
- hdr -> name .s );
1277
- goto error ;
1278
- }
1271
+ if (hdr -> type == HDR_CONTACT_T &&
1272
+ !del_lump (rpl , hdr -> name .s - rpl -> buf , hdr -> len , HDR_CONTACT_T )) {
1273
+ LM_ERR ("failed to delete contact '%.*s'\n" , hdr -> name .len ,
1274
+ hdr -> name .s );
1275
+ goto error ;
1279
1276
}
1280
1277
}
1281
1278
@@ -1339,7 +1336,7 @@ static inline int save_restore_rpl_contacts(struct sip_msg *req,
1339
1336
1340
1337
LM_DBG ("INSERTING contact with expires %lu\n" , ci -> expires );
1341
1338
1342
- if (ul .insert_ucontact ( r , & ctmap -> req_ct_uri , ci , & c , 0 ) < 0 ) {
1339
+ if (ul .insert_ucontact (r , & ctmap -> req_ct_uri , ci , & c , 0 ) < 0 ) {
1343
1340
rerrno = R_UL_INS_C ;
1344
1341
LM_ERR ("failed to insert contact\n" );
1345
1342
goto error ;
@@ -1492,7 +1489,7 @@ static inline int save_restore_req_contacts(struct sip_msg *req,
1492
1489
1493
1490
/* in MID_REG_THROTTLE_AOR mode, any reply will only contain 1 contact */
1494
1491
_c = get_first_contact (rpl );
1495
- if (_c != NULL )
1492
+ if (_c )
1496
1493
calc_contact_expires (rpl , _c -> expires , & e_out , 0 );
1497
1494
1498
1495
ul .lock_udomain (mri -> dom , & mri -> aor );
@@ -1503,7 +1500,7 @@ static inline int save_restore_req_contacts(struct sip_msg *req,
1503
1500
* AoR not yet stored here, and the main registrar is also clean!
1504
1501
* Just skip processing any contacts found in the request, we're good.
1505
1502
*/
1506
- if (_c == NULL )
1503
+ if (! _c )
1507
1504
goto out ;
1508
1505
1509
1506
if (ul .insert_urecord (mri -> dom , _a , & r , 0 ) < 0 ) {
@@ -1527,7 +1524,7 @@ static inline int save_restore_req_contacts(struct sip_msg *req,
1527
1524
}
1528
1525
}
1529
1526
1530
- if (_c != NULL ) {
1527
+ if (_c ) {
1531
1528
/**
1532
1529
* we now replace the single reply Contact hf with all Contact hfs
1533
1530
* present in the initial request
@@ -1554,7 +1551,7 @@ static inline int save_restore_req_contacts(struct sip_msg *req,
1554
1551
list_for_each (_ , & mri -> ct_mappings ) {
1555
1552
ctmap = list_entry (_ , struct ct_mapping , list );
1556
1553
1557
- if (_c == NULL ) {
1554
+ if (! _c ) {
1558
1555
if (ctmap -> expires != 0 )
1559
1556
LM_ERR ("200 OK from main registrar is missing Contact '%.*s'\n" ,
1560
1557
ctmap -> req_ct_uri .len , ctmap -> req_ct_uri .s );
@@ -1569,13 +1566,13 @@ static inline int save_restore_req_contacts(struct sip_msg *req,
1569
1566
c = NULL ;
1570
1567
/* pack the contact_info */
1571
1568
ci = mid_reg_pack_ci (req , rpl , mri , ctmap );
1572
- if (ci == NULL ) {
1569
+ if (! ci ) {
1573
1570
LM_ERR ("failed to extract contact info\n" );
1574
1571
goto out_clear_err ;
1575
1572
}
1576
1573
ci -> expires_out = e_out ;
1577
1574
1578
- if ((r -> contacts == NULL ||
1575
+ if ((! r -> contacts ||
1579
1576
ul .get_ucontact (r , & ctmap -> req_ct_uri , ci -> callid , ci -> cseq + 1 ,
1580
1577
& mri -> cmatch , & c ) != 0 ) && ctmap -> expires > 0 ) {
1581
1578
/* contact not found and not present on main reg either */
@@ -2241,7 +2238,7 @@ static int process_contacts_by_aor(struct sip_msg *req, urecord_t *urec,
2241
2238
unsigned int last_reg_ts ;
2242
2239
int_str_t * value ;
2243
2240
2244
- if (urec -> contacts == NULL )
2241
+ if (! urec -> contacts )
2245
2242
return 1 ;
2246
2243
2247
2244
value = ul .get_urecord_key (urec , & ul_key_last_reg_ts );
0 commit comments