Browse code

pua: coherent whitespacing

Daniel-Constantin Mierla authored on 06/12/2016 09:54:25
Showing 1 changed files
... ...
@@ -15,8 +15,8 @@
15 15
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 16
  * GNU General Public License for more details.
17 17
  *
18
- * You should have received a copy of the GNU General Public License 
19
- * along with this program; if not, write to the Free Software 
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program; if not, write to the Free Software
20 20
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21 21
  *
22 22
  */
... ...
@@ -116,7 +116,7 @@ static cmd_export_t cmds[]=
116 116
 	{"bind_libxml_api",          (cmd_function)bind_libxml_api, 1, 0, 0, 0},
117 117
 	{"bind_pua",                 (cmd_function)bind_pua, 1, 0, 0, 0},
118 118
 	{"pua_update_contact",       (cmd_function)update_contact, 0, 0, 0, REQUEST_ROUTE},
119
-	{0,                          0,	0, 0, 0, 0} 
119
+	{0,                          0,	0, 0, 0, 0}
120 120
 };
121 121
 
122 122
 static param_export_t params[]={
... ...
@@ -210,7 +210,7 @@ static int mod_init(void)
210 210
 	}
211 211
 
212 212
 	if (dbmode != PUA_DB_ONLY)
213
-	{ 
213
+	{
214 214
 		if(HASH_SIZE<=1)
215 215
 			HASH_SIZE= 512;
216 216
 		else
... ...
@@ -227,7 +227,7 @@ static int mod_init(void)
227 227
 			LM_ERR("while restoring hash_table\n");
228 228
 			return -1;
229 229
 		}
230
-	} 
230
+	}
231 231
 
232 232
 	if (dbmode != PUA_DB_DEFAULT && dbmode != PUA_DB_ONLY)
233 233
 	{
... ...
@@ -273,19 +273,19 @@ static int mod_init(void)
273 273
 		return -1;
274 274
 	}
275 275
 
276
-	if (dbmode != PUA_DB_ONLY) 
277
-	{        
278
-		if (update_period > 0) 
276
+	if (dbmode != PUA_DB_ONLY)
277
+	{
278
+		if (update_period > 0)
279 279
 			register_timer(db_update, 0, update_period);
280 280
 	}
281 281
 
282 282
 	if (db_table_lock_write != 1)
283 283
 		db_table_lock = DB_LOCKING_NONE;
284
-	
284
+
285 285
 	if(pua_db)
286 286
 		pua_dbf.close(pua_db);
287 287
 	pua_db = NULL;
288
-	
288
+
289 289
 	return 0;
290 290
 }
291 291
 
... ...
@@ -355,8 +355,8 @@ static void destroy(void)
355 355
 	if (puacb_list)
356 356
 		destroy_puacb_list();
357 357
 
358
-	/* if dbmode is PUA_DB_ONLY, then HashT will be NULL 
359
-	   so db_update and destroy_htable won't get called */ 
358
+	/* if dbmode is PUA_DB_ONLY, then HashT will be NULL
359
+	 * so db_update and destroy_htable won't get called */
360 360
 	if(pua_db && HashT)
361 361
 		db_update(0,0);
362 362
 
... ...
@@ -374,9 +374,9 @@ static void destroy(void)
374 374
 static int db_restore(void)
375 375
 {
376 376
 	ua_pres_t* p= NULL;
377
-	db_key_t result_cols[19]; 
377
+	db_key_t result_cols[19];
378 378
 	db1_res_t *res= NULL;
379
-	db_row_t *row = NULL;	
379
+	db_row_t *row = NULL;
380 380
 	db_val_t *row_vals= NULL;
381 381
 	str pres_uri, pres_id;
382 382
 	str etag, tuple_id;
... ...
@@ -489,7 +489,7 @@ static int db_restore(void)
489 489
 			}
490 490
 
491 491
 			if(row_vals[watcher_col].val.string_val)
492
-			{	
492
+			{
493 493
 				watcher_uri.s= (char*)row_vals[watcher_col].val.string_val;
494 494
 				watcher_uri.len = strlen(watcher_uri.s);
495 495
 
... ...
@@ -506,7 +506,7 @@ static int db_restore(void)
506 506
 				{
507 507
 					record_route.s= (char*)row_vals[record_route_col].val.string_val;
508 508
 					record_route.len= strlen(record_route.s);
509
-				}	
509
+				}
510 510
 
511 511
 				contact.s= (char*)row_vals[contact_col].val.string_val;
512 512
 				contact.len = strlen(contact.s);
... ...
@@ -546,7 +546,7 @@ static int db_restore(void)
546 546
 			size+= pres_uri.len;
547 547
 
548 548
 			if(pres_id.s)
549
-			{	
549
+			{
550 550
 				p->id.s= (char*)p + size;
551 551
 				memcpy(p->id.s, pres_id.s, pres_id.len);
552 552
 				p->id.len= pres_id.len;
... ...
@@ -558,10 +558,10 @@ static int db_restore(void)
558 558
 				memcpy(p->tuple_id.s, tuple_id.s, tuple_id.len);
559 559
 				p->tuple_id.len= tuple_id.len;
560 560
 				size+= tuple_id.len;
561
-			}	
561
+			}
562 562
 
563 563
 			if(watcher_uri.s && watcher_uri.len)
564
-			{	
564
+			{
565 565
 				p->watcher_uri= (str*)((char*)p+ size);
566 566
 				size+= sizeof(str);
567 567
 
... ...
@@ -636,7 +636,7 @@ static int db_restore(void)
636 636
 				{
637 637
 					LM_ERR("no more share memory\n");
638 638
 					goto error;
639
-				}	
639
+				}
640 640
 				memcpy(p->etag.s, etag.s, etag.len);
641 641
 				p->etag.len= etag.len;
642 642
 			}
... ...
@@ -678,7 +678,7 @@ static void hashT_clean(unsigned int ticks,void *param)
678 678
 	time_t now;
679 679
 	ua_pres_t* p= NULL, *q= NULL;
680 680
 
681
-	if (dbmode==PUA_DB_ONLY) 
681
+	if (dbmode==PUA_DB_ONLY)
682 682
 	{
683 683
 		clean_puadb(update_period, min_expires );
684 684
 		return;
... ...
@@ -690,11 +690,11 @@ static void hashT_clean(unsigned int ticks,void *param)
690 690
 		lock_get(&HashT->p_records[i].lock);
691 691
 		p= HashT->p_records[i].entity->next;
692 692
 		while(p)
693
-		{	
693
+		{
694 694
 			print_ua_pres(p);
695 695
 			if(p->expires- update_period < now )
696 696
 			{
697
-				if((p->desired_expires> p->expires + min_expires) || 
697
+				if((p->desired_expires> p->expires + min_expires) ||
698 698
 						(p->desired_expires== 0 ))
699 699
 				{
700 700
 					if(update_pua(p)< 0)
... ...
@@ -705,7 +705,7 @@ static void hashT_clean(unsigned int ticks,void *param)
705 705
 					}
706 706
 					p= p->next;
707 707
 					continue;
708
-				}	
708
+				}
709 709
 				if(p->expires < now - 10)
710 710
 				{
711 711
 					q= p->next;
... ...
@@ -716,7 +716,7 @@ static void hashT_clean(unsigned int ticks,void *param)
716 716
 				}
717 717
 				else
718 718
 					p= p->next;
719
-			}	
719
+			}
720 720
 			else
721 721
 				p= p->next;
722 722
 		}
... ...
@@ -761,7 +761,7 @@ int update_pua(ua_pres_t* p)
761 761
 			LM_ERR("while constructing publ callback param\n");
762 762
 			ret_code = -1;
763 763
 			goto done;
764
-		}	
764
+		}
765 765
 
766 766
 		set_uac_req(&uac_r, &met, str_hdr, 0, 0, TMCB_LOCAL_COMPLETED,
767 767
 				publ_cback_func, (void*)cb_param);
... ...
@@ -773,7 +773,7 @@ int update_pua(ua_pres_t* p)
773 773
 				);
774 774
 		if(result< 0)
775 775
 		{
776
-			LM_ERR("in t_request function\n"); 
776
+			LM_ERR("in t_request function\n");
777 777
 			shm_free(cb_param);
778 778
 			ret_code = -1;
779 779
 			goto done;
... ...
@@ -787,7 +787,7 @@ int update_pua(ua_pres_t* p)
787 787
 		td= pua_build_dlg_t(p);
788 788
 		if(td== NULL)
789 789
 		{
790
-			LM_ERR("while building tm dlg_t structure");		
790
+			LM_ERR("while building tm dlg_t structure");
791 791
 			ret_code = -1;
792 792
 			goto done;
793 793
 		};
... ...
@@ -806,7 +806,7 @@ int update_pua(ua_pres_t* p)
806 806
 			LM_ERR("while constructing subs callback param\n");
807 807
 			ret_code = -1;
808 808
 			goto done;
809
-		}	
809
+		}
810 810
 
811 811
 		set_uac_req(&uac_r, &met, str_hdr, 0, td, TMCB_LOCAL_COMPLETED,
812 812
 				subs_cback_func, (void*)cb_param);
... ...
@@ -814,7 +814,7 @@ int update_pua(ua_pres_t* p)
814 814
 		result= tmb.t_request_within(&uac_r);
815 815
 		if(result< 0)
816 816
 		{
817
-			LM_ERR("in t_request function\n"); 
817
+			LM_ERR("in t_request function\n");
818 818
 			shm_free(cb_param);
819 819
 			ret_code = -1;
820 820
 			goto done;
... ...
@@ -862,7 +862,7 @@ static void db_update(unsigned int ticks,void *param)
862 862
 	q_vals[puri_col].nul = 0;
863 863
 	n_query_cols++;
864 864
 
865
-	q_cols[pid_col= n_query_cols] = &str_pres_id_col;	
865
+	q_cols[pid_col= n_query_cols] = &str_pres_id_col;
866 866
 	q_vals[pid_col].type = DB1_STR;
867 867
 	q_vals[pid_col].nul = 0;
868 868
 	n_query_cols++;
... ...
@@ -900,7 +900,7 @@ static void db_update(unsigned int ticks,void *param)
900 900
 	q_cols[etag_col= n_query_cols] = &str_etag_col;
901 901
 	q_vals[etag_col].type = DB1_STR;
902 902
 	q_vals[etag_col].nul = 0;
903
-	n_query_cols++;	
903
+	n_query_cols++;
904 904
 
905 905
 	q_cols[tuple_col= n_query_cols] = &str_tuple_id_col;
906 906
 	q_vals[tuple_col].type = DB1_STR;
... ...
@@ -983,15 +983,15 @@ static void db_update(unsigned int ticks,void *param)
983 983
 		return ;
984 984
 	}
985 985
 
986
-	for(i=0; i<HASH_SIZE; i++) 
986
+	for(i=0; i<HASH_SIZE; i++)
987 987
 	{
988 988
 		if(!no_lock)
989
-			lock_get(&HashT->p_records[i].lock);	
989
+			lock_get(&HashT->p_records[i].lock);
990 990
 
991 991
 		p = HashT->p_records[i].entity->next;
992 992
 		while(p)
993 993
 		{
994
-			if((int)p->expires - (int)time(NULL)< 0)	
994
+			if((int)p->expires - (int)time(NULL)< 0)
995 995
 			{
996 996
 				p= p->next;
997 997
 				continue;
... ...
@@ -1002,7 +1002,7 @@ static void db_update(unsigned int ticks,void *param)
1002 1002
 				case NO_UPDATEDB_FLAG:
1003 1003
 					{
1004 1004
 						LM_DBG("NO_UPDATEDB_FLAG\n");
1005
-						break;			  
1005
+						break;
1006 1006
 					}
1007 1007
 
1008 1008
 				case UPDATEDB_FLAG:
... ...
@@ -1063,38 +1063,38 @@ static void db_update(unsigned int ticks,void *param)
1063 1063
 							if(!no_lock)
1064 1064
 								lock_release(&HashT->p_records[i].lock);
1065 1065
 							if(res)
1066
-								pua_dbf.free_result(pua_db, res);	
1066
+								pua_dbf.free_result(pua_db, res);
1067 1067
 							return ;
1068 1068
 						}
1069 1069
 						if(res && res->n> 0)
1070
-						{																				
1071
-							if(pua_dbf.update(pua_db, q_cols, 0, q_vals, db_cols, 
1070
+						{
1071
+							if(pua_dbf.update(pua_db, q_cols, 0, q_vals, db_cols,
1072 1072
 										db_vals, n_query_update, n_update_cols)<0)
1073 1073
 							{
1074 1074
 								LM_ERR("while updating in database\n");
1075 1075
 								if(!no_lock)
1076
-									lock_release(&HashT->p_records[i].lock);	
1076
+									lock_release(&HashT->p_records[i].lock);
1077 1077
 								pua_dbf.free_result(pua_db, res);
1078 1078
 								res= NULL;
1079 1079
 								return ;
1080 1080
 							}
1081 1081
 							pua_dbf.free_result(pua_db, res);
1082
-							res= NULL;		
1082
+							res= NULL;
1083 1083
 						}
1084 1084
 						else
1085 1085
 						{
1086 1086
 							if(res)
1087
-							{	
1087
+							{
1088 1088
 								pua_dbf.free_result(pua_db, res);
1089 1089
 								res= NULL;
1090 1090
 							}
1091 1091
 							LM_DBG("UPDATEDB_FLAG and no record found\n");
1092 1092
 							//	p->db_flag= INSERTDB_FLAG;
1093
-						}	
1094
-						break;	
1093
+						}
1094
+						break;
1095 1095
 					}
1096 1096
 				case INSERTDB_FLAG:
1097
-					{	
1097
+					{
1098 1098
 						LM_DBG("INSERTDB_FLAG\n");
1099 1099
 						q_vals[puri_col].val.str_val = *(p->pres_uri);
1100 1100
 						q_vals[pid_col].val.str_val = p->id;
... ...
@@ -1198,11 +1198,11 @@ static void db_update(unsigned int ticks,void *param)
1198 1198
 					}
1199 1199
 
1200 1200
 			}
1201
-			p->db_flag= NO_UPDATEDB_FLAG;	
1201
+			p->db_flag= NO_UPDATEDB_FLAG;
1202 1202
 			p= p->next;
1203 1203
 		}
1204 1204
 		if(!no_lock)
1205
-			lock_release(&HashT->p_records[i].lock);	
1205
+			lock_release(&HashT->p_records[i].lock);
1206 1206
 	}
1207 1207
 
1208 1208
 	db_vals[0].val.int_val= (int)time(NULL)- 10;
... ...
@@ -1213,7 +1213,7 @@ static void db_update(unsigned int ticks,void *param)
1213 1213
 	}
1214 1214
 
1215 1215
 	return ;
1216
-}	
1216
+}
1217 1217
 
1218 1218
 static ua_pres_t* build_uppubl_cbparam(ua_pres_t* p)
1219 1219
 {
... ...
@@ -1225,8 +1225,8 @@ static ua_pres_t* build_uppubl_cbparam(ua_pres_t* p)
1225 1225
 	publ.content_type= p->content_type;
1226 1226
 	publ.id= p->id;
1227 1227
 	publ.expires= (p->desired_expires== 0) ?-1:p->desired_expires- (int)time(NULL);
1228
-	publ.flag= UPDATE_TYPE; 
1229
-	publ.source_flag= p->flag; 
1228
+	publ.flag= UPDATE_TYPE;
1229
+	publ.source_flag= p->flag;
1230 1230
 	publ.event= p->event;
1231 1231
 	publ.etag= &p->etag;
1232 1232
 	publ.extra_headers= p->extra_headers;