[Asterisk-cvs] asterisk dnsmgr.c,1.1,1.2

kpfleming at lists.digium.com kpfleming at lists.digium.com
Thu Apr 7 02:48:32 CDT 2005


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv21025

Modified Files:
	dnsmgr.c 
Log Message:
fix thinko in dnsmgr.c (lesson: don't commit while you are rushing to a meeting and then heading out of town...)


Index: dnsmgr.c
===================================================================
RCS file: /usr/cvsroot/asterisk/dnsmgr.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- dnsmgr.c	6 Apr 2005 21:13:51 -0000	1.1
+++ dnsmgr.c	7 Apr 2005 07:41:06 -0000	1.2
@@ -86,13 +86,13 @@
 
 void ast_dnsmgr_release(struct ast_dnsmgr_entry *entry)
 {
-	/* if there is an entry (and not the special flag value), remove/free it */
-	if (entry && (entry != (typeof(entry)) -1)) {
-		AST_LIST_LOCK(&entry_list);
-		AST_LIST_REMOVE(&entry_list, entry, list);
-		AST_LIST_UNLOCK(&entry_list);
-		free(entry);
-	};
+	if (!entry)
+		return;
+
+	AST_LIST_LOCK(&entry_list);
+	AST_LIST_REMOVE(&entry_list, entry, list);
+	AST_LIST_UNLOCK(&entry_list);
+	free(entry);
 }
 
 int ast_dnsmgr_lookup(const char *name, struct in_addr *result, struct ast_dnsmgr_entry **dnsmgr)
@@ -119,15 +119,13 @@
 
 		if ((hp = ast_gethostbyname(name, &ahp)))
 			memcpy(result, hp->h_addr, sizeof(result));
-		/* flag value to indicate no manager was allocated */
-		*dnsmgr = (typeof(*dnsmgr)) -1;
+		return 0;
 	} else {
 		if (option_verbose > 2)
 			ast_verbose(VERBOSE_PREFIX_2 "adding manager for '%s'\n", name);
 		*dnsmgr = ast_dnsmgr_get(name, result);
+		return !*dnsmgr;
 	}
-
-	return !*dnsmgr;
 }
 
 static void *do_refresh(void *data)




More information about the svn-commits mailing list