aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-04-07 07:41:06 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-04-07 07:41:06 +0000
commit350c7943c6a1b877e6a9e9b60d2e5f997eda7485 (patch)
tree9155266a8f055b5aef7cfd833829cadd0000e60f
parente0c1878b7030f1020384db26a246c62248fd412b (diff)
fix thinko in dnsmgr.c (lesson: don't commit while you are rushing to a meeting and then heading out of town...)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5433 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-xdnsmgr.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/dnsmgr.c b/dnsmgr.c
index 09a097d41..5afa776fe 100755
--- a/dnsmgr.c
+++ b/dnsmgr.c
@@ -86,13 +86,13 @@ struct ast_dnsmgr_entry *ast_dnsmgr_get(const char *name, struct in_addr *result
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 @@ int ast_dnsmgr_lookup(const char *name, struct in_addr *result, struct ast_dnsmg
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)