From: michael Date: Wed, 31 Dec 2014 15:07:49 +0000 (+0000) Subject: - match.c, match.h: removed collapse() X-Git-Tag: 1.0.0beta2~3 X-Git-Url: http://git.serene-ircd.net/?a=commitdiff_plain;h=b5a0bf7f1bbf9d718e47665bcb4752e64efd29d2;p=hopm.git - match.c, match.h: removed collapse() - inet.h: moved poll.h header include to libopm.c git-svn-id: svn://svn.ircd-hybrid.org/svnroot/hopm/branches/1.0.x@5232 82007160-df01-0410-b94d-b575c5fd34c7 --- diff --git a/src/libopm/src/inet.h b/src/libopm/src/inet.h index a9ebe79..d7d03d8 100644 --- a/src/libopm/src/inet.h +++ b/src/libopm/src/inet.h @@ -11,10 +11,6 @@ #endif #include -#ifdef HAVE_SYS_POLL_H -# include -#endif - typedef struct _opm_sockaddr opm_sockaddr; typedef struct _opm_inaddr opm_inaddr; diff --git a/src/libopm/src/libopm.c b/src/libopm/src/libopm.c index 9dd7b53..9a1d77c 100644 --- a/src/libopm/src/libopm.c +++ b/src/libopm/src/libopm.c @@ -44,9 +44,9 @@ # include # endif #endif - #include #include +#include static OPM_PROTOCOL_CONFIG_T *libopm_protocol_config_create(void); diff --git a/src/match.c b/src/match.c index a342ca4..83fcdfc 100644 --- a/src/match.c +++ b/src/match.c @@ -156,68 +156,3 @@ match(const char *mask, const char *name) return 1; } - -/* - * collapse() - * Collapse a pattern string into minimal components. - * This particular version is "in place", so that it changes the pattern - * which is to be reduced to a "minimal" size. - * - * (C) Carlo Wood - 6 Oct 1998 - * Speedup rewrite by Andrea Cocito, December 1998. - * Note that this new optimized algorithm can *only* work in place. - */ - -/*! \brief Collapse a mask string to remove redundancies. - * Specifically, it replaces a sequence of '*' followed by additional - * '*' or '?' with the same number of '?'s as the input, followed by - * one '*'. This minimizes useless backtracking when matching later. - * \param mask Mask string to collapse. - * \return Pointer to the start of the string. - */ -char * -collapse(char *mask) -{ - unsigned int star = 0; - char *m = mask; - char *b = NULL; - - if (m) - { - do - { - if ((*m == '*') && (*(m + 1) == '*' || *(m + 1) == '?')) - { - b = m; - - do - { - if (*m == '*') - star = 1; - else - { - if (star && (*m != '?')) - { - *b++ = '*'; - star = 0; - } - - *b++ = *m; - - if ((*m == '\\') && (*(m + 1) == '*' || *(m + 1) == '?')) - *b++ = *++m; - } - } while (*m++); - - break; - } - else - { - if ((*m == '\\') && (*(m + 1) == '*' || *(m + 1) == '?')) - ++m; - } - } while (*m++); - } - - return mask; -} diff --git a/src/match.h b/src/match.h index 7a2487e..8f4d997 100644 --- a/src/match.h +++ b/src/match.h @@ -30,5 +30,4 @@ #define EmptyString(x) (!(x) || (*(x) == '\0')) extern int match(const char *, const char *); -extern char *collapse(char *); #endif