Commit 68cd3bce authored by Davi Arnaut's avatar Davi Arnaut

WL#5498: Remove dead and unused source code

Remove unused string functions.
parent 60ab2b92
......@@ -114,12 +114,7 @@ extern void bchange(uchar *dst,size_t old_len,const uchar *src,
extern void strappend(char *s,size_t len,pchar fill);
extern char *strend(const char *s);
extern char *strcend(const char *, pchar);
extern char *strfield(char *src,int fields,int chars,int blanks,
int tabch);
extern char *strfill(char * s,size_t len,pchar fill);
extern size_t strinstr(const char *str,const char *search);
extern size_t r_strinstr(const char *str, size_t from, const char *search);
extern char *strkey(char *dst,char *head,char *tail,char *flags);
extern char *strmake(char *dst,const char *src,size_t length);
#ifndef strmov
......@@ -128,35 +123,16 @@ extern char *strmov(char *dst,const char *src);
extern char *strmov_overlapp(char *dst,const char *src);
#endif
extern char *strnmov(char *dst, const char *src, size_t n);
extern char *strsuff(const char *src, const char *suffix);
extern char *strcont(const char *src, const char *set);
extern char *strxcat(char *dst, const char *src, ...);
extern char *strxmov(char *dst, const char *src, ...);
extern char *strxcpy(char *dst, const char *src, ...);
extern char *strxncat(char *dst, size_t len, const char *src, ...);
extern char *strxnmov(char *dst, size_t len, const char *src, ...);
extern char *strxncpy(char *dst, size_t len, const char *src, ...);
/* Prototypes of normal stringfunctions (with may ours) */
#ifdef WANT_STRING_PROTOTYPES
extern char *strcat(char *, const char *);
extern char *strchr(const char *, pchar);
extern char *strrchr(const char *, pchar);
extern char *strcpy(char *, const char *);
extern int strcmp(const char *, const char *);
#ifndef __GNUC__
extern size_t strlen(const char *);
#endif
#endif
#ifndef HAVE_STRNLEN
extern size_t strnlen(const char *s, size_t n);
#endif
#if !defined(__cplusplus)
#ifndef HAVE_STRPBRK
extern char *strpbrk(const char *, const char *);
#endif
#ifndef HAVE_STRSTR
extern char *strstr(const char *, const char *);
#endif
......
......@@ -37,7 +37,7 @@ target_sources = libmysql.c password.c \
mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \
strmake.lo strend.lo \
strnlen.lo strfill.lo is_prefix.lo \
int2str.lo str2int.lo strinstr.lo strcont.lo \
int2str.lo str2int.lo strcont.lo \
strcend.lo ctype-latin1.lo \
bchange.lo bmove.lo bmove_upp.lo longlong2str.lo \
strtoull.lo strtoll.lo llstr.lo my_vsnprintf.lo \
......
......@@ -19,10 +19,10 @@ SET(STRINGS_SOURCES bchange.c bfill.c bmove_upp.c ctype-big5.c ctype-bin.c ctype
ctype-czech.c ctype-euc_kr.c ctype-eucjpms.c ctype-extra.c ctype-gb2312.c ctype-gbk.c
ctype-latin1.c ctype-mb.c ctype-simple.c ctype-sjis.c ctype-tis620.c ctype-uca.c
ctype-ucs2.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype.c decimal.c dtoa.c int2str.c
is_prefix.c llstr.c longlong2str.c my_strtoll10.c my_vsnprintf.c r_strinstr.c
is_prefix.c llstr.c longlong2str.c my_strtoll10.c my_vsnprintf.c
str2int.c str_alloc.c strcend.c strend.c strfill.c strmake.c strmov.c strnmov.c
strtol.c strtoll.c strtoul.c strtoull.c strxmov.c strxnmov.c xml.c
my_strchr.c strcont.c strinstr.c strnlen.c strappend.c)
my_strchr.c strcont.c strnlen.c strappend.c)
# Avoid dependencies on perschema data defined in mysys
ADD_DEFINITIONS(-DDISABLE_MYSQL_THREAD_H)
......
......@@ -30,19 +30,19 @@ pkglib_LIBRARIES = libmystrings.a
# Exact one of ASSEMBLER_X
if ASSEMBLER_x86
ASRCS = strings-x86.s longlong2str-x86.s my_strtoll10-x86.s
CSRCS = bfill.c bmove.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c str_alloc.c longlong2str_asm.c my_strchr.c dtoa.c strmov.c
CSRCS = bfill.c bmove.c bchange.c strxnmov.c int2str.c str2int.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c str_alloc.c longlong2str_asm.c my_strchr.c dtoa.c strmov.c
else
if ASSEMBLER_sparc32
# These file MUST all be on the same line!! Otherwise automake
# generats a very broken makefile
ASRCS = bmove_upp-sparc.s strappend-sparc.s strend-sparc.s strinstr-sparc.s strmake-sparc.s strmov-sparc.s strnmov-sparc.s strstr-sparc.s
CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c my_strchr.c dtoa.c strmov.c
ASRCS = bmove_upp-sparc.s strappend-sparc.s strend-sparc.s strmake-sparc.s strmov-sparc.s strnmov-sparc.s strstr-sparc.s
CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bchange.c strxnmov.c int2str.c str2int.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c my_strchr.c dtoa.c strmov.c
else
#no assembler
ASRCS =
# These file MUST all be on the same line!! Otherwise automake
# generats a very broken makefile
CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c my_strchr.c dtoa.c
CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bchange.c strxnmov.c int2str.c str2int.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c my_strchr.c dtoa.c
endif
endif
......@@ -57,10 +57,10 @@ EXTRA_DIST = ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc
longlong2str.c longlong2str-x86.s longlong2str_asm.c \
my_strtoll10.c my_strtoll10-x86.s \
strxmov.c bmove_upp.c strappend.c strcont.c strend.c \
strfill.c strcend.c is_prefix.c strstr.c strinstr.c \
strfill.c strcend.c is_prefix.c strstr.c \
strmake.c strnmov.c strmov.c strnlen.c \
bmove_upp-sparc.s strappend-sparc.s strend-sparc.s \
strinstr-sparc.s strmake-sparc.s strmov-sparc.s \
strmake-sparc.s strmov-sparc.s \
strnmov-sparc.s strstr-sparc.s strxmov-sparc.s \
t_ctype.h my_strchr.c CMakeLists.txt \
CHARSET_INFO.txt
......
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
Author : David
strintstr(src, from, pat) looks for an instance of pat in src
backwards from pos from. pat is not a regex(3) pattern, it is a literal
string which must be matched exactly.
The result 0 if the pattern was not found else it is the start char of
the pattern counted from the begining of the string.
*/
#include <my_global.h>
#include "m_string.h"
size_t r_strinstr(reg1 const char * str, size_t from, reg4 const char * search)
{
reg2 const char *i, *j;
size_t len = strlen(search);
/* pointer to the last char of buff */
const char * start = str + from - 1;
/* pointer to the last char of search */
const char * search_end = search + len - 1;
skip:
while (start >= str) /* Cant be != because the first char */
{
if (*start-- == *search_end)
{
i = start; j = search_end - 1;
while (j >= search && start > str)
if (*i-- != *j--)
goto skip;
return (size_t) ((start - len) - str + 3);
}
}
return (0);
}
......@@ -73,8 +73,6 @@ int main(void)
test_arg("strstr(v1,v5)",(long) strstr(v1,v5),0L);
test_arg("strstr(v6,v8)",(long) strstr(v6,v8),0L);
test_arg("strinstr(v1,v4)",(long) strinstr(v1,v4),4L);
test_arg("strinstr(v1,v5)",(long) strinstr(v1,v5),0L);
test_arg("strlen(from)",(long) strlen(from),(long) F_LEN);
test_arg("strlen(\"\")",(long) strlen(""),0L);
#ifdef HAVE_STRNLEN
......
......@@ -77,11 +77,6 @@ Speciella anv
The result is a pointer to the first character of the located instance,
or NullS if pat does not occur in src.
strinstr(src, pat) looks for an instance of pat in src. pat is not a
regex(3) pattern, it is a literal string which must be matched exactly.
The result 0 if the pattern was not found else it is the start char of
the pattern counted from the begining of the string.
strmake(dst,src,length) moves length characters, or until end, of src to
dst and appends a closing NUL to dst.
strmake() returns pointer to closing null;
......
#ifndef STRINGS_NOT_USED_INCLUDED
#define STRINGS_NOT_USED_INCLUDED
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* File : strings.h
Author : Richard A. O'Keefe.
Updated: 1 June 1984
Purpose: Header file for the "string(3C)" package.
All the routines in this package are the original work of
R.A.O'Keefe. Any resemblance between them and any routines in
licensed software is due entirely to these routines having been
written using the "man 3 string" UNIX manual page, or in some cases
the "man 1 sort" manual page as a specification. See the READ-ME to
find the conditions under which these routines may be used & copied.
*/
#ifndef NullS
#include <my_global.h> /* Define standar vars */
#include "m_string.h"
#define NUL '\0'
#define _AlphabetSize 256
#endif /* NullS */
#endif /* STRINGS_NOT_USED_INCLUDED */
......@@ -281,29 +281,6 @@ sf_fo: movl %edx,%eax # Char found here
.strstr_end:
.size strstr,.strstr_end-strstr
# Find a substring in string, return index
# Arg: str,search
.globl strinstr
.type strinstr,@function
strinstr:
pushl %ebp
movl %esp,%ebp
pushl 12(%ebp) # search
pushl 8(%ebp) # str
call strstr
add $8,%esp
or %eax,%eax
jz si_99 # Not found, return NULL
sub 8(%ebp),%eax # Pos from start
inc %eax # And first pos = 1
si_99: popl %ebp
ret
.strinstr_end:
.size strinstr,.strinstr_end-strinstr
# Make a string of len length from another string
# Arg: dst,src,length
# ret: end of dst
......
! Copyright (C) 2000 MySQL AB
!
! This library is free software; you can redistribute it and/or
! modify it under the terms of the GNU Library General Public
! License as published by the Free Software Foundation; version 2
! of the License.
!
! This library is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
! Library General Public License for more details.
!
! You should have received a copy of the GNU Library General Public
! License along with this library; if not, write to the Free
! Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
! MA 02111-1307, USA
.file "strinstr-sparc.s"
.section ".text"
.align 4
.global strinstr
.type strinstr,#function
.proc 0102
strinstr:
save %sp,-96,%sp
or %g0,%i1,%o1
call strstr,2 ! Result = %o0
or %g0,%i0,%o0
orcc %g0,%o0,%o0
bne .end
sub %o0,%i0,%i0
ret
restore %g0,%g0,%o0
.end:
ret
restore %i0,1,%o0 ! Offset for return value is from 1
.strinstr_end:
.size strinstr,.strinstr_end-strinstr
.ident "Matt Wagner & Monty"
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* File : strinstr.c
Author : Monty & David
Updated: 1986.12.08
Defines: strinstr()
strinstr(src, pat) looks for an instance of pat in src. pat is not a
regex(3) pattern, it is a literal string which must be matched exactly.
The result 0 if the pattern was not found else it is the start char of
the pattern counted from the beginning of the string, where the first
char is 1.
*/
#include <my_global.h>
#include "m_string.h"
size_t strinstr(reg1 const char *str,reg4 const char *search)
{
reg2 const char *i, *j;
const char *start= str;
skip:
while (*str != '\0')
{
if (*str++ == *search)
{
i= str; j= search+1;
while (*j)
if (*i++ != *j++) goto skip;
return ((size_t) (str - start));
}
}
return (0);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment