[asterisk-commits] russell: branch group/security_events r193464 - /team/group/security_events/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat May 9 07:05:49 CDT 2009


Author: russell
Date: Sat May  9 07:05:45 2009
New Revision: 193464

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=193464
Log:
Put constant in caps, reduce a little bit of duplication

Modified:
    team/group/security_events/res/res_security_log.c

Modified: team/group/security_events/res/res_security_log.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/res/res_security_log.c?view=diff&rev=193464&r1=193463&r2=193464
==============================================================================
--- team/group/security_events/res/res_security_log.c (original)
+++ team/group/security_events/res/res_security_log.c Sat May  9 07:05:45 2009
@@ -38,7 +38,7 @@
 static struct ast_event_sub *security_event_sub;
 
 AST_THREADSTORAGE(security_event_buf);
-static const size_t security_event_buf_init_len = 256;
+static const size_t SECURITY_EVENT_BUF_INIT_LEN = 256;
 
 enum ie_required {
 	NOT_REQUIRED,
@@ -87,14 +87,21 @@
 	}
 }
 
+static void append_ies(struct ast_str **str, const struct ast_event *event,
+		const enum ast_event_ie_type *ies, enum ie_required required)
+{
+	for (; *ies != AST_EVENT_IE_END; ies++) {
+		append_ie(str, event, *ies, required);
+	}
+}
+
 static void security_event_cb(const struct ast_event *event, void *data)
 {
 	struct ast_str *str;
 	enum ast_security_event_type event_type;
-	const enum ast_event_ie_type *ies;
 
 	if (!(str = ast_str_thread_get(&security_event_buf,
-			security_event_buf_init_len))) {
+			SECURITY_EVENT_BUF_INIT_LEN))) {
 		return;
 	}
 
@@ -106,17 +113,10 @@
 			ast_event_get_ie_type_name(AST_EVENT_IE_SECURITY_EVENT),
 			ast_security_event_get_name(event_type));
 
-	for (ies = ast_security_event_get_required_ies(event_type);
-			*ies != AST_EVENT_IE_END;
-			ies++) {
-		append_ie(&str, event, *ies, REQUIRED);
-	}
-
-	for (ies = ast_security_event_get_optional_ies(event_type);
-			*ies != AST_EVENT_IE_END;
-			ies++) {
-		append_ie(&str, event, *ies, NOT_REQUIRED);
-	}
+	append_ies(&str, event,
+			ast_security_event_get_required_ies(event_type), REQUIRED);
+	append_ies(&str, event,
+			ast_security_event_get_optional_ies(event_type), NOT_REQUIRED);
 
 	ast_log(LOG_SECURITY, "%s\n", ast_str_buffer(str));
 }




More information about the asterisk-commits mailing list