Merge commit 'upstream/1.7.2p6'
[debian/sudo] / alias.c
diff --git a/alias.c b/alias.c
index 9a030690ed54f9769a033277d4b53e1d7f1b2c62..e389c7113935751831425e86d03f1ba288bc59aa 100644 (file)
--- a/alias.c
+++ b/alias.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2005m, 2007-2008
+ * Copyright (c) 2004-2005m, 2007-2009
  *     Todd C. Miller <Todd.Miller@courtesan.com>
  *
  * Permission to use, copy, modify, and distribute this software for any
 #include "redblack.h"
 #include <gram.h>
 
-#ifndef lint
-__unused static const char rcsid[] = "$Sudo: alias.c,v 1.14 2008/11/18 13:29:58 millert Exp $";
-#endif /* lint */
-
 /*
  * Globals
  */
 struct rbtree *aliases;
 unsigned int alias_seqno;
 
-/*
- * Local protoypes
- */
-static int   alias_compare     __P((const void *, const void *));
-static void  alias_free                __P((void *));
-
 /*
  * Comparison function for the red-black tree.
  * Aliases are sorted by name with the type used as a tie-breaker.
  */
-static int
+int
 alias_compare(v1, v2)
     const void *v1, *v2;
 {
@@ -88,7 +78,7 @@ alias_compare(v1, v2)
  * Returns a pointer to the alias structure or NULL if not found.
  */
 struct alias *
-find_alias(name, type)
+alias_find(name, type)
     char *name;
     int type;
 {
@@ -161,7 +151,7 @@ no_aliases()
 /*
  * Free memory used by an alias struct and its members.
  */
-static void
+void
 alias_free(v)
     void *v;
 {
@@ -185,9 +175,9 @@ alias_free(v)
 }
 
 /*
- * Find the named alias, delete it from the tree and recover its resources.
+ * Find the named alias, remove it from the tree and return it.
  */
-int
+struct alias *
 alias_remove(name, type)
     char *name;
     int type;
@@ -198,10 +188,9 @@ alias_remove(name, type)
     key.name = name;
     key.type = type;
     if ((node = rbfind(aliases, &key)) == NULL)
-       return(FALSE);
+       return(NULL);
     a = rbdelete(aliases, node);
-    alias_free(a);
-    return(TRUE);
+    return(a);
 }
 
 void