Commits

Anonymous committed b8c7b79

clean_string() is related to m_links.c ONLY - moved it there

Comments (0)

Files changed (3)

include/irc_string.h

 #endif
 
 /*
- * clean_string - cleanup control and high ascii characters
- * -Dianora
- */
-char *clean_string(char *dest, const unsigned char *src, size_t len);
-
-/*
  * strip_colour - remove colour codes from a string
  * -asuffield (?)
  */

modules/m_links.c

 
 static int m_links(struct Client *, struct Client *, int, const char **);
 static int mo_links(struct Client *, struct Client *, int, const char **);
+static char * clean_string(char *dest, const unsigned char *src, size_t len);
 
 struct Message links_msgtab = {
 	"LINKS", 0, 0, 0, MFLG_SLOW,
 	return 0;
 }
 
+static char *
+clean_string(char *dest, const unsigned char *src, size_t len)
+{
+	char *d = dest;
+	s_assert(0 != dest);
+	s_assert(0 != src);
+
+	if(dest == NULL || src == NULL)
+		return NULL;
+
+	len -= 3;		/* allow for worst case, '^A\0' */
+
+	while (*src && (len > 0))
+	{
+		if(*src & 0x80)	/* if high bit is set */
+		{
+			*d++ = '.';
+			--len;
+		}
+		else if(!IsPrint(*src))	/* if NOT printable */
+		{
+			*d++ = '^';
+			--len;
+			*d++ = 0x40 + *src;	/* turn it into a printable */
+		}
+		else
+			*d++ = *src;
+		++src;
+		--len;
+	}
+	*d = '\0';
+	return dest;
+}
 #endif
 
 /*
- * clean_string - clean up a string possibly containing garbage
- *
- * *sigh* Before the kiddies find this new and exciting way of 
- * annoying opers, lets clean up what is sent to local opers
- * -Dianora
- */
-char *
-clean_string(char *dest, const unsigned char *src, size_t len)
-{
-	char *d = dest;
-	s_assert(0 != dest);
-	s_assert(0 != src);
-
-	if(dest == NULL || src == NULL)
-		return NULL;
-
-	len -= 3;		/* allow for worst case, '^A\0' */
-
-	while(*src && (len > 0))
-	{
-		if(*src & 0x80)	/* if high bit is set */
-		{
-			*d++ = '.';
-			--len;
-		}
-		else if(!IsPrint(*src))	/* if NOT printable */
-		{
-			*d++ = '^';
-			--len;
-			*d++ = 0x40 + *src;	/* turn it into a printable */
-		}
-		else
-			*d++ = *src;
-		++src;
-		--len;
-	}
-	*d = '\0';
-	return dest;
-}
-
-/*
  * strip_tabs(dst, src, length)
  *
  *   Copies src to dst, while converting all \t (tabs) into spaces.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.