strip_tabs() is related to s_conf.c ONLY - moved it there
This commit is contained in:
parent
c6b832270e
commit
5f4f1d055f
|
@ -83,12 +83,6 @@ extern char *canonize(char *);
|
||||||
*/
|
*/
|
||||||
char *strip_colour(char *string);
|
char *strip_colour(char *string);
|
||||||
|
|
||||||
/*
|
|
||||||
* strip_tabs - convert tabs to spaces
|
|
||||||
* - jdc
|
|
||||||
*/
|
|
||||||
char *strip_tabs(char *dest, const unsigned char *src, size_t len);
|
|
||||||
|
|
||||||
#define EmptyString(x) ((x) == NULL || *(x) == '\0')
|
#define EmptyString(x) ((x) == NULL || *(x) == '\0')
|
||||||
#define CheckEmpty(x) EmptyString(x) ? "" : x
|
#define CheckEmpty(x) EmptyString(x) ? "" : x
|
||||||
|
|
||||||
|
|
|
@ -29,45 +29,6 @@
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "setup.h"
|
#include "setup.h"
|
||||||
|
|
||||||
#ifndef INT16SZ
|
|
||||||
#define INT16SZ 2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* strip_tabs(dst, src, length)
|
|
||||||
*
|
|
||||||
* Copies src to dst, while converting all \t (tabs) into spaces.
|
|
||||||
*
|
|
||||||
* NOTE: jdc: I have a gut feeling there's a faster way to do this.
|
|
||||||
*/
|
|
||||||
char *
|
|
||||||
strip_tabs(char *dest, const unsigned char *src, size_t len)
|
|
||||||
{
|
|
||||||
char *d = dest;
|
|
||||||
/* Sanity check; we don't want anything nasty... */
|
|
||||||
s_assert(0 != dest);
|
|
||||||
s_assert(0 != src);
|
|
||||||
|
|
||||||
if(dest == NULL || src == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
while(*src && (len > 0))
|
|
||||||
{
|
|
||||||
if(*src == '\t')
|
|
||||||
{
|
|
||||||
*d++ = ' '; /* Translate the tab into a space */
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*d++ = *src; /* Copy src to dst */
|
|
||||||
}
|
|
||||||
++src;
|
|
||||||
--len;
|
|
||||||
}
|
|
||||||
*d = '\0'; /* Null terminate, thanks and goodbye */
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
strip_colour(char *string)
|
strip_colour(char *string)
|
||||||
{
|
{
|
||||||
|
|
18
src/s_conf.c
18
src/s_conf.c
|
@ -1507,6 +1507,24 @@ conf_add_d_conf(struct ConfItem *aconf)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
strip_tabs(char *dest, const char *src, size_t len)
|
||||||
|
{
|
||||||
|
char *d = dest;
|
||||||
|
|
||||||
|
if(dest == NULL || src == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
rb_strlcpy(dest, src, len);
|
||||||
|
|
||||||
|
while(*d)
|
||||||
|
{
|
||||||
|
if(*d == '\t')
|
||||||
|
*d = ' ';
|
||||||
|
d++;
|
||||||
|
}
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* yyerror
|
* yyerror
|
||||||
|
|
Loading…
Reference in New Issue