1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2008 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
14 #ifndef __IN_INSPSTRING_H
15 #define __IN_INSPSTRING_H
17 // This (inspircd_config) is needed as inspstring doesn't pull in the central header
18 #include "inspircd_config.h"
23 /** strlcpy() implementation for systems that don't have it (linux) */
24 CoreExport size_t strlcpy(char *dst, const char *src, size_t siz);
25 /** strlcat() implementation for systems that don't have it (linux) */
26 CoreExport size_t strlcat(char *dst, const char *src, size_t siz);
29 /** charlcat() will append one character to a string using the same
30 * safety scemantics as strlcat().
31 * @param x The string to operate on
32 * @param y the character to append to the end of x
33 * @param z The maximum allowed length for z including null terminator
35 CoreExport int charlcat(char* x,char y,int z);
36 /** charremove() will remove all instances of a character from a string
37 * @param mp The string to operate on
38 * @param remove The character to remove
40 CoreExport bool charremove(char* mp, char remove);
42 /** strnewdup() is an implemenetation of strdup() which calls operator new
43 * rather than malloc to allocate the new string, therefore allowing it to
44 * be hooked into the C++ memory manager, and freed with operator delete.
45 * This is required for windows, where we override operators new and delete
46 * to allow for global allocation between modules and the core.
48 inline char * strnewdup(const char * s1)
50 size_t len = strlen(s1) + 1;
51 char * p = new char[len];