ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/irc_string.c
(Generate patch)

Comparing:
ircd-hybrid-7.2/src/irc_string.c (file contents), Revision 176 by michael, Sat Oct 22 00:00:13 2005 UTC vs.
ircd-hybrid-7.3/src/irc_string.c (file contents), Revision 1029 by michael, Sun Nov 8 13:10:50 2009 UTC

# Line 22 | Line 22
22   *  $Id$
23   */
24  
25 + #include "config.h"
26 + #ifdef HAVE_LIBPCRE
27 + #include <pcre.h>
28 + #endif
29 +
30   #include "stdinc.h"
26 #include "tools.h"
27 #include "pcre.h"
31   #include "irc_string.h"
32   #include "sprintf_irc.h"
30 #include "client.h"
31 #include "list.h"
32 #include "memory.h"
33  
34   #ifndef INADDRSZ
35   #define INADDRSZ 4
# Line 44 | Line 44
44   #endif
45  
46  
47 char *
48 xstrldup(const char *s, size_t n)
49 {
50  size_t len = strlen(s) + 1;
51  char *p = NULL;
52
53  if (len > n)
54    len = n;
55  return strlcpy((p = malloc(len)), s, len), p;
56 }
57
47   /*
48   * myctime - This is like standard ctime()-function, but it zaps away
49   *   the newline from the end of that string. Also, it takes
# Line 249 | Line 238 | inetntoa(const char *in)
238    return buf;
239   }
240  
241 < #ifndef HAVE_BASENAME
253 <
254 < /* basename()
241 > /* libio_basename()
242   *
243   * input        - i.e. "/usr/local/ircd/modules/m_whois.so"
244   * output       - i.e. "m_whois.so"
245   * side effects - this will be overwritten on subsequent calls
246   */
247 < char *
248 < basename(char *path)
247 > const char *
248 > libio_basename(const char *path)
249   {
250 <  char *s;
250 >  const char *s;
251  
252    if ((s = strrchr(path, '/')) == NULL)
253      s = path;
# Line 270 | Line 257 | basename(char *path)
257    return s;
258   }
259  
273 #endif /* !HAVE_BASENAME */
274
260   /*
261   * Copyright (c) 1996-1999 by Internet Software Consortium.
262   *
# Line 437 | Line 422 | inetntop(int af, const void *src, char *
422      case AF_INET6:
423        if (IN6_IS_ADDR_V4MAPPED((const struct in6_addr *)src) ||
424            IN6_IS_ADDR_V4COMPAT((const struct in6_addr *)src))
425 <        return inet_ntop4((unsigned char *)&((const struct in6_addr *)src)->s6_addr[12], dst, size);
425 >        return inet_ntop4((const unsigned char *)&((const struct in6_addr *)src)->s6_addr[12], dst, size);
426        else
427          return inet_ntop6(src, dst, size);
428   #endif
# Line 542 | Line 527 | strlcpy(char *dst, const char *src, size
527   }
528   #endif
529  
530 < pcre *
530 > #ifdef HAVE_LIBPCRE
531 > void *
532   ircd_pcre_compile(const char *pattern, const char **errptr)
533   {
534    int erroroffset = 0;
# Line 554 | Line 540 | ircd_pcre_compile(const char *pattern, c
540   }
541  
542   int
543 < ircd_pcre_exec(const pcre *code, const char *subject)
543 > ircd_pcre_exec(const void *code, const char *subject)
544   {
545    assert(code && subject);
546  
547    return pcre_exec(code, NULL, subject, strlen(subject), 0, 0, NULL, 0) < 0;
548   }
549 + #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)