Ver Fonte

usrloc: coherent indentation and whitespacing

Daniel-Constantin Mierla há 6 anos atrás
pai
commit
12bf3cb574
2 ficheiros alterados com 44 adições e 46 exclusões
  1. 19 20
      src/modules/usrloc/udomain.c
  2. 25 26
      src/modules/usrloc/urecord.c

+ 19 - 20
src/modules/usrloc/udomain.c

@@ -83,7 +83,7 @@ int new_udomain(str* _n, int _s, udomain_t** _d)
 #ifdef STATISTICS
 	char *name;
 #endif
-	
+
 	/* Must be always in shared memory, since
 	 * the cache is accessed from timer which
 	 * lives in a separate process
@@ -150,7 +150,7 @@ error0:
 void free_udomain(udomain_t* _d)
 {
 	int i;
-	
+
 	if (_d->table) {
 		for(i = 0; i < _d->size; i++) {
 			deinit_slot(_d->table + i);
@@ -215,7 +215,7 @@ void print_udomain(FILE* _f, udomain_t* _d)
 /*!
  * \brief Convert database values into ucontact_info
  *
- * Convert database values into ucontact_info, 
+ * Convert database values into ucontact_info,
  * expects 12 rows (contact, expirs, q, callid, cseq, flags,
  * ua, received, path, socket, methods, last_modified)
  * \param vals database values
@@ -294,7 +294,7 @@ static inline ucontact_info_t* dbrow2info(db_val_t *vals, str *contact, int rcon
 		received.len = strlen(received.s);
 	}
 	ci.received = received;
-	
+
 	path.s  = (char*)VAL_STRING(vals+9);
 		if (VAL_NULL(vals+9) || !path.s || !path.s[0]) {
 			path.len = 0;
@@ -309,7 +309,7 @@ static inline ucontact_info_t* dbrow2info(db_val_t *vals, str *contact, int rcon
 	if (VAL_NULL(vals+10) || p==0 || p[0]==0){
 		ci.sock = 0;
 	} else {
-		if (parse_phostport( p, &host.s, &host.len, 
+		if (parse_phostport( p, &host.s, &host.len,
 		&port, &proto)!=0) {
 			LM_ERR("bad socket <%s>\n", p);
 			return 0;
@@ -509,7 +509,6 @@ int preload_udomain(db1_con_t* _c, udomain_t* _d)
 				}
 			}
 
-		
 			lock_udomain(_d, &user);
 			if (get_urecord(_d, &user, &r) > 0) {
 				if (mem_insert_urecord(_d, &user, &r) < 0) {
@@ -657,7 +656,7 @@ urecord_t* db_load_urecord(db1_con_t* _c, udomain_t* _d, str *_aor)
 					_aor->len, _aor->s, _d->name->s);
 			continue;
 		}
-		
+
 		if ( r==0 )
 			get_static_urecord( _d, _aor, &r);
 
@@ -948,13 +947,13 @@ int udomain_contact_expired_cb(db1_con_t* _c, udomain_t* _d)
 	UL_DB_EXPIRES_SET(&query_vals[1], 0);
 
 	if (ul_db_srvid != 0) {
-                query_cols[2] = &srv_id_col;
-                query_ops[2] = OP_EQ;
-                query_vals[2].type = DB1_INT;
-                query_vals[2].nul = 0;
-                query_vals[2].val.int_val = server_id;
-                key_num = 3;
-        }
+		query_cols[2] = &srv_id_col;
+		query_ops[2] = OP_EQ;
+		query_vals[2].type = DB1_INT;
+		query_vals[2].nul = 0;
+		query_vals[2].val.int_val = server_id;
+		key_num = 3;
+	}
 
 	if (ul_dbf.use_table(_c, _d->name) < 0) {
 		LM_ERR("sql use_table failed\n");
@@ -985,8 +984,8 @@ int udomain_contact_expired_cb(db1_con_t* _c, udomain_t* _d)
 
 	if (RES_ROW_N(res) == 0) {
 		LM_DBG("no rows to be contact expired\n");
-                ul_dbf.free_result(_c, res);
-                return 0;
+		ul_dbf.free_result(_c, res);
+		return 0;
 	}
 
 	n = 0;
@@ -1059,7 +1058,7 @@ error:
 
 
 /*!
- * \brief Timer function to cleanup expired contacts, db_mode: DB_ONLY 
+ * \brief Timer function to cleanup expired contacts, db_mode: DB_ONLY
  *   and for WRITE_BACK, WRITE_THROUGH on config param
  * \param _d cleaned domain
  * \return 0 on success, -1 on failure
@@ -1097,7 +1096,7 @@ int db_timer_udomain(udomain_t* _d)
 		LM_ERR("use_table failed\n");
 		return -1;
 	}
-	
+
 	if (ul_dbf.delete(ul_dbh, keys, ops, vals, key_num) < 0) {
 		LM_ERR("failed to delete from table %s\n",_d->name->s);
 		return -1;
@@ -1131,7 +1130,7 @@ int testdb_udomain(db1_con_t* con, udomain_t* d)
 	VAL_TYPE(val) = DB1_STRING;
 	VAL_NULL(val) = 0;
 	VAL_STRING(val) = "dummy_user";
-	
+
 	VAL_TYPE(val+1) = DB1_STRING;
 	VAL_NULL(val+1) = 0;
 	VAL_STRING(val+1) = "dummy_domain";
@@ -1157,7 +1156,7 @@ int testdb_udomain(db1_con_t* con, udomain_t* d)
 int mem_insert_urecord(udomain_t* _d, str* _aor, struct urecord** _r)
 {
 	int sl;
-	
+
 	if (new_urecord(_d->name, _aor, _r) < 0) {
 		LM_ERR("creating urecord failed\n");
 		return -1;

+ 25 - 26
src/modules/usrloc/urecord.c

@@ -94,7 +94,7 @@ void free_urecord(urecord_t* _r)
 		_r->contacts = _r->contacts->next;
 		free_ucontact(ptr);
 	}
-	
+
 	/* if mem cache is not used, the urecord struct is static*/
 	if (db_mode!=DB_ONLY) {
 		if (_r->aor.s) shm_free(_r->aor.s);
@@ -117,7 +117,7 @@ void print_urecord(FILE* _f, urecord_t* _r)
 	fprintf(_f, "aor    : '%.*s'\n", _r->aor.len, ZSW(_r->aor.s));
 	fprintf(_f, "aorhash: '%u'\n", (unsigned)_r->aorhash);
 	fprintf(_f, "slot:    '%d'\n", _r->aorhash&(_r->slot->d->size-1));
-	
+
 	if (_r->contacts) {
 		ptr = _r->contacts;
 		while(ptr) {
@@ -201,7 +201,7 @@ void mem_remove_ucontact(urecord_t* _r, ucontact_t* _c)
 			_c->next->prev = 0;
 		}
 	}
-}	
+}
 
 
 /*!
@@ -534,7 +534,7 @@ int db_delete_urecord_by_ruid(str *_table, str *_ruid)
 	}
 
 	if (ul_dbf.affected_rows(ul_dbh) == 0) {
-	        return -2;
+		return -2;
 	}
 
 	return 0;
@@ -653,12 +653,12 @@ int delete_ucontact(urecord_t* _r, struct ucontact* _c)
 
 int delete_urecord_by_ruid(udomain_t* _d, str *_ruid)
 {
-    if (db_mode != DB_ONLY) {
-	LM_ERR("delete_urecord_by_ruid currently available only in db_mode=3\n");
-	return -1;
-    }
+	if (db_mode != DB_ONLY) {
+		LM_ERR("delete_urecord_by_ruid currently available only in db_mode=3\n");
+		return -1;
+	}
 
-    return db_delete_urecord_by_ruid(_d->name, _ruid);
+	return db_delete_urecord_by_ruid(_d->name, _ruid);
 }
 
 
@@ -674,7 +674,7 @@ static inline struct ucontact* contact_match( ucontact_t* ptr, str* _c)
 		if ((_c->len == ptr->c.len) && !memcmp(_c->s, ptr->c.s, _c->len)) {
 			return ptr;
 		}
-		
+
 		ptr = ptr->next;
 	}
 	return 0;
@@ -698,30 +698,29 @@ static inline struct ucontact* contact_callid_match( ucontact_t* ptr,
 		) {
 			return ptr;
 		}
-		
+
 		ptr = ptr->next;
 	}
 	return 0;
 }
 
- /*!
-+ * \brief Match a contact record to a contact string and path
-+ * \param ptr contact record
-+ * \param _c contact string
-+ * \param _path path
-+ * \return ptr on successfull match, 0 when they not match
-+ */
+/*!
+ * \brief Match a contact record to a contact string and path
+ * \param ptr contact record
+ * \param _c contact string
+ * \param _path path
+ * \return ptr on successfull match, 0 when they not match
+ */
 static inline struct ucontact* contact_path_match( ucontact_t* ptr, str* _c, str *_path)
 {
 	/* if no path is preset (in REGISTER request) or use_path is not configured
-	   in registrar module, default to contact_match() */
+	 * in registrar module, default to contact_match() */
 	if( _path == NULL) return contact_match(ptr, _c);
 
 	while(ptr) {
 		if ( (_c->len==ptr->c.len) && (_path->len==ptr->path.len)
-		&& !memcmp(_c->s, ptr->c.s, _c->len)
-		&& !memcmp(_path->s, ptr->path.s, _path->len)
-		) {
+			&& !memcmp(_c->s, ptr->c.s, _c->len)
+			&& !memcmp(_path->s, ptr->path.s, _path->len) ) {
 			return ptr;
 		}
 
@@ -744,7 +743,7 @@ static inline struct ucontact* contact_match_callidonly( ucontact_t* ptr, str* _
 		if ((_callid->len == ptr->callid.len) && !memcmp(_callid->s, ptr->callid.s, _callid->len)) {
 			return ptr;
 		}
-		
+
 		ptr = ptr->next;
 	}
 	return 0;
@@ -759,7 +758,7 @@ static inline struct ucontact* contact_match_callidonly( ucontact_t* ptr, str* _
  * \param _path path
  * \param _cseq CSEQ number
  * \param _co found contact
- * \return 0 - found, 1 - not found, -1 - invalid found, 
+ * \return 0 - found, 1 - not found, -1 - invalid found,
  * -2 - found, but to be skipped (same cseq)
  */
 int get_ucontact(urecord_t* _r, str* _c, str* _callid, str* _path, int _cseq,
@@ -818,7 +817,7 @@ int get_ucontact_by_instance(urecord_t* _r, str* _c, ucontact_info_t* _ci,
 	ucontact_t* ptr;
 	str i1;
 	str i2;
-	
+
 	if (_ci->instance.s == NULL || _ci->instance.len <= 0) {
 		return get_ucontact(_r, _c, _ci->callid, _ci->path, _ci->cseq, _co);
 	}
@@ -843,7 +842,7 @@ int get_ucontact_by_instance(urecord_t* _r, str* _c, ucontact_info_t* _ci,
 				return 0;
 			}
 		}
-		
+
 		ptr = ptr->next;
 	}
 	return 1;