Browse Source
WL#5498: Remove dead and unused source code
WL#5498: Remove dead and unused source code
Remove unused string functions.pull/73/head
11 changed files with 9 additions and 245 deletions
-
24include/m_string.h
-
2libmysql/Makefile.shared
-
4strings/CMakeLists.txt
-
12strings/Makefile.am
-
50strings/r_strinstr.c
-
2strings/str_test.c
-
5strings/string.doc
-
41strings/strings-not-used.h
-
23strings/strings-x86.s
-
43strings/strinstr-sparc.s
-
48strings/strinstr.c
@ -1,50 +0,0 @@ |
|||
/* 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); |
|||
} |
|||
@ -1,41 +0,0 @@ |
|||
#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 */ |
|||
@ -1,43 +0,0 @@ |
|||
! 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" |
|||
|
|||
|
|||
|
|||
@ -1,48 +0,0 @@ |
|||
/* 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); |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue