Remove unused code and variables.
authorMichael Poole <mdpoole@troilus.org>
Mon, 30 May 2005 21:07:33 +0000 (21:07 +0000)
committerMichael Poole <mdpoole@troilus.org>
Mon, 30 May 2005 21:07:33 +0000 (21:07 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1417 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
include/class.h
include/ircd_string.h
include/list.h
ircd/class.c
ircd/ircd.c
ircd/ircd_string.c
ircd/list.c

index 8ba3eb9180b6543d98dc14b23a221b993268c202..7d6d553d5531ac5c11942d26ccb8f89b47cf5c9c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2005-05-30  Michael Poole <mdpoole@troilus.org>
+
+       * include/class.h (get_con_freq): Remove unused function.
+
+       * include/list.h (find_user_link): Remove unused function.
+
+       * include/class.c (get_con_freq): Remove.
+
+       * ircd/list.c (find_user_link): Remove.
+
+       * include/string.h (string_is_hostname, string_is_address,
+       strnChattr): Remove unused functions.
+       (init_string): Remove function that becomes a noop.
+
+       * ircd/string.h (init_string): Remove.
+       (string_is_hostname, string_is_address, strnChattr): Likewise.
+
+       * ircd/ircd.c (main): Remove call to init_string().
+
 2005-05-30  Michael Poole <mdpoole@troilus.org>
 
        * include/numeric.h (RPL_TRACELOG, RPL_MYPORTIS,
index dfffb7b9b557afdb981579785a50af394cf0f83d..816576db30dc15c36e43ceb57d04852fe5cc9468 100644 (file)
@@ -100,7 +100,6 @@ extern void class_delete_marked(void);
 extern struct ConnectionClass *find_class(const char *name);
 extern struct ConnectionClass *make_class(void);
 extern void free_class(struct ConnectionClass * tmp);
-extern unsigned int get_con_freq(struct ConnectionClass * clptr);
 extern char *get_conf_class(const struct ConfItem *aconf);
 extern int get_conf_ping(const struct ConfItem *aconf);
 extern char *get_client_class(struct Client *acptr);
index 2cd1d1c5ed9de4df97316d012e0c710a4e822cba..888cfb33de36e43d4ae89861ca014f6b674167f6 100644 (file)
@@ -16,13 +16,6 @@ struct irc_in_addr;
 /** Check whether \a x is a NULL or empty string. */
 #define EmptyString(x) (!(x) || !(*x))
 
-/*
- * initialize recognizers
- */
-extern int init_string(void);
-
-extern int string_is_hostname(const char* str);
-extern int string_is_address(const char* str);
 extern int string_has_wildcards(const char* str);
 
 extern char*       ircd_strncpy(char* dest, const char* src, size_t len);
@@ -117,10 +110,5 @@ static __inline__ NTL_HDR_strCasediff { NTL_SRC_strCasediff }
 #endif
 #endif /* FORCEINLINE */
 
-/*
- * Proto types of other externally visible functions
- */
-extern int strnChattr(const char *s, const size_t n);
-
 #endif /* INCLUDED_ircd_string_h */
 
index 1c8880b08f5182dc1ddb86bf00456b2abe2091dd..3d591b635f6a0a65df52d860cc18699ca745896e 100644 (file)
@@ -47,7 +47,6 @@ struct DLink {
 
 extern void free_link(struct SLink *lp);
 extern struct SLink *make_link(void);
-extern struct SLink *find_user_link(struct SLink *lp, struct Client *ptr);
 extern void init_list(void);
 extern struct Client *make_client(struct Client *from, int status);
 extern void free_connection(struct Connection *con);
index 2509f6577be1e7b58fd5f924a2218cf5b263a946..95b6f96c5eae845f22fdbbc30bbcb52662b04a31 100644 (file)
@@ -196,19 +196,6 @@ get_client_class(struct Client *acptr)
   return "(null-class)";
 }
 
-/** Get connection interval for a connection class.
- * @param[in] clptr Connection class to check (or NULL).
- * @return If \a clptr != NULL, its connection frequency; else default
- * connection frequency.
- */
-unsigned int get_con_freq(struct ConnectionClass * clptr)
-{
-  if (clptr)
-    return (ConFreq(clptr));
-  else
-    return feature_int(FEAT_CONNECTFREQUENCY);
-}
-
 /** Make sure we have a connection class named \a name.
  * If one does not exist, create it.  Then set its ping frequency,
  * connection frequency, maximum link count, and max SendQ according
index ec86bf1aabf82a25006876f52d6e2a5bb4a422c0..a6ffa002912eb7e2cb57bc707649a022fc73c7a8 100644 (file)
@@ -680,11 +680,6 @@ int main(int argc, char **argv) {
   log_init(*argv);
   set_nomem_handler(outofmemory);
 
-  if (!init_string()) {
-    log_write(LS_SYSTEM, L_CRIT, 0, "Failed to initialize string module");
-    return 6;
-  }
-
   initload();
   init_list();
   init_hash();
index 9ff635b6bc45c60ecaa14b354d7fcfcf2da4aab6..1569349c28903d4773393eae29374681a5d35f2d 100644 (file)
@@ -30,7 +30,6 @@
 
 /* #include <assert.h> -- Now using assert in ircd_log.h */
 #include <string.h>
-#include <regex.h>
 #include <sys/types.h>
 #include <netinet/in.h>
 
  */
 #include "chattr.tab.c"
 
-
-/*
- * Disallow a hostname label to contain anything but a [-a-zA-Z0-9].
- * It may not start or end on a '.'.
- * A label may not end on a '-', the maximum length of a label is
- * 63 characters.
- * On top of that (which seems to be the RFC) we demand that the
- * top domain does not contain any digits.
- */
-/** Regular expression to match a hostname.
- * Matches zero or more alphanumeric labels followed by '.' and a
- * final label that may only contain alphabetic characters.
- */
-static const char* hostExpr = "^([-0-9A-Za-z]*[0-9A-Za-z]\\.)+[A-Za-z]+$";
-/** Compiled regex to match a hostname.  Built from #hostExpr. */
-static regex_t hostRegex;
-
-/** Regular expression to match an IP address. */
-static const char* addrExpr =
-    "^((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\\.){1,3}"
-    "(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])$";
-/** Compiled regex to match an IP address.  Built from #addrExpr. */
-static regex_t addrRegex;
-
-/** Initialize the string matching code. */
-int init_string(void)
-{
-  /*
-   * initialize matching expressions
-   * XXX - expressions MUST be correct, don't change expressions
-   * without testing them. Might be a good idea to exit if these fail,
-   * important code depends on them.
-   * TODO: use regerror for an error message
-   */
-  if (regcomp(&hostRegex, hostExpr, REG_EXTENDED | REG_NOSUB))
-    return 0;
-
-  if (regcomp(&addrRegex, addrExpr, REG_EXTENDED | REG_NOSUB))
-    return 0;
-  return 1;
-}
-
-/** Check whether \a str looks like a hostname.
- * @param[in] str String that might be a hostname.
- * @return Non-zero if it conforms to the rules, zero if not.
- */
-int string_is_hostname(const char* str)
-{
-  assert(0 != str);
-  return (strlen(str) <= HOSTLEN && 0 == regexec(&hostRegex, str, 0, 0, 0));
-}
-
-/** Check whether \a str looks like an IP address.
- * @param[in] str String that might be an address.
- * @return Non-zero if it conforms to the rules, zero if not.
- */
-int string_is_address(const char* str)
-{
-  assert(0 != str);
-  return (0 == regexec(&addrRegex, str, 0, 0, 0));
-}
-
 /** Check whether \a str contains wildcard characters.
  * @param[in] str String that might contain wildcards.
  * @return Non-zero if \a str contains naked (non-escaped) wildcards,
@@ -232,21 +169,6 @@ NTL_HDR_strCasediff { NTL_SRC_strCasediff }
  * Other functions visible externally
  */
 
-/** Find common character attributes for the start of a string.
- * @param[in] s Input string to scan.
- * @param[in] n Maximum number of bytes to check.
- * @return Bitmask of all character attributes shared by the start of \a s.
- */
-int strnChattr(const char *s, const size_t n)
-{
-  const char *rs = s;
-  unsigned int x = ~0;
-  int r = n;
-  while (*rs && r--)
-    x &= IRCD_CharAttrTab[*rs++ - CHAR_MIN];
-  return x;
-}
-
 /** Case insensitive string comparison.
  * @param[in] a First string to compare.
  * @param[in] b Second string to compare.
index 2dca5e94d6a0d31b44977c22e977169f04636d65..8a567d6cd176c44b021fa726b69bf4508f8bc008 100644 (file)
@@ -449,23 +449,6 @@ void verify_client_list(void)
 }
 #endif /* DEBUGMODE */
 
-/** Find the list element that corresponds to a client.
- * @param[in] lp Head of singly linked list.
- * @param[in] ptr %Client to search for.
- * @return SLink element from \a lp that contains \a ptr, or NULL if none exist.
- */
-struct SLink *find_user_link(struct SLink *lp, struct Client *ptr)
-{
-  if (ptr) {
-    while (lp) {
-      if (lp->value.cptr == ptr)
-        return (lp);
-      lp = lp->next;
-    }
-  }
-  return NULL;
-}
-
 /** Allocate a new SLink element.
  * Pulls from #slinkFreeList if it contains anything, else it
  * allocates a new one from the heap.