diff options
author | Davi Arnaut <davi.arnaut@oracle.com> | 2010-11-20 20:56:09 -0200 |
---|---|---|
committer | Davi Arnaut <davi.arnaut@oracle.com> | 2010-11-20 20:56:09 -0200 |
commit | af67d8ae02d024d2d2de41584e0befc87518f3fd (patch) | |
tree | e5d2471d257297982cb0e705aa0ad5472f3a323c /strings | |
parent | 8f02025b21e73e78a2afdd9b99e23f15cb5729e0 (diff) | |
download | mariadb-git-af67d8ae02d024d2d2de41584e0befc87518f3fd.tar.gz |
WL#5665: Removal of the autotools-based build system
Remove some more leftovers from the initial removal:
o Update relevant mentions of configure.in throughout
the source code.
o Remove win/configure.js, which at this point just
duplicates logic already present in CMake based build
system.
o Remove support files which relied on the autotools
build system. In any case, MySQL is no longer officially
supported on SCO.
o Remove files which are no longer part of the build.
Diffstat (limited to 'strings')
-rw-r--r-- | strings/bfill.c | 41 | ||||
-rw-r--r-- | strings/bmove.c | 48 | ||||
-rw-r--r-- | strings/longlong2str-x86.s | 216 | ||||
-rw-r--r-- | strings/longlong2str_asm.c | 33 | ||||
-rw-r--r-- | strings/my_strtoll10-x86.s | 418 | ||||
-rw-r--r-- | strings/str_test.c | 275 | ||||
-rw-r--r-- | strings/strings-x86.s | 393 | ||||
-rw-r--r-- | strings/strstr.c | 52 | ||||
-rw-r--r-- | strings/strto.c | 209 | ||||
-rw-r--r-- | strings/strtol.c | 28 | ||||
-rw-r--r-- | strings/strtoll.c | 33 | ||||
-rw-r--r-- | strings/strtoul.c | 29 | ||||
-rw-r--r-- | strings/strtoull.c | 34 |
13 files changed, 0 insertions, 1809 deletions
diff --git a/strings/bfill.c b/strings/bfill.c deleted file mode 100644 index ccc063f59e3..00000000000 --- a/strings/bfill.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (C) 2002 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 : bfill.c - Author : Richard A. O'Keefe. - Michael Widenius; ifdef MC68000 - Updated: 23 April 1984 - Defines: bfill() - - bfill(dst, len, fill) moves "len" fill characters to "dst". - Thus to set a buffer to 80 spaces, do bfill(buff, 80, ' '). -*/ - -#include <my_global.h> -#include "m_string.h" - -#if !defined(bfill) && !defined(HAVE_BFILL) - -void bfill(dst, len, fill) -register byte *dst; -register uint len; -register pchar fill; -{ - while (len-- != 0) *dst++ = fill; -} - -#endif diff --git a/strings/bmove.c b/strings/bmove.c deleted file mode 100644 index 0aa825558ca..00000000000 --- a/strings/bmove.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (C) 2002 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 : bmove.c - Author : Richard A. O'Keefe. - Michael Widenius; ifdef MC68000 - Updated: 23 April 1984 - Defines: bmove() - - bmove(dst, src, len) moves exactly "len" bytes from the source "src" - to the destination "dst". It does not check for NUL characters as - strncpy() and strnmov() do. Thus if your C compiler doesn't support - structure assignment, you can simulate it with - bmove(&to, &from, sizeof from); - The standard 4.2bsd routine for this purpose is bcopy. But as bcopy - has its first two arguments the other way around you may find this a - bit easier to get right. - No value is returned. -*/ - -#include <my_global.h> -#include "m_string.h" - -#if !defined(HAVE_BMOVE) && !defined(bmove) - -void bmove(dst, src, len) -register char *dst; -register const char *src; -register uint len; -{ - while (len-- != 0) *dst++ = *src++; -} - -#endif diff --git a/strings/longlong2str-x86.s b/strings/longlong2str-x86.s deleted file mode 100644 index 3de43a96e78..00000000000 --- a/strings/longlong2str-x86.s +++ /dev/null @@ -1,216 +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 - -# Optimized longlong2str function for Intel 80x86 (gcc/gas syntax) -# Some set sequences are optimized for pentuimpro II - - .file "longlong2str-x86.s" - .version "1.02" - -.text - .align 4 - -.globl longlong2str_with_dig_vector - .type longlong2str_with_dig_vector,@function - -longlong2str_with_dig_vector: - subl $80,%esp # Temporary buffer for up to 64 radix-2 digits - pushl %ebp - pushl %esi - pushl %edi - pushl %ebx - movl 100(%esp),%esi # esi = Lower part of val - movl 112(%esp),%ebx # ebx = Radix - movl 104(%esp),%ebp # ebp = Higher part of val - movl 108(%esp),%edi # edi = dst - - testl %ebx,%ebx - jge .L144 # Radix was positive - negl %ebx # Change radix to positive - testl %ebp,%ebp # Test if given value is negative - jge .L144 - movb $45,(%edi) # Add sign - incl %edi # Change sign of val - negl %esi - adcl $0,%ebp - negl %ebp - -.L144: # Test that radix is between 2 and 36 - movl %ebx, %eax - addl $-2,%eax # Test that radix is between 2 and 36 - cmpl $34,%eax - ja .Lerror # Radix was not in range - - leal 92(%esp),%ecx # End of buffer - movl %edi, 108(%esp) # Store possible modified dest - movl 116(%esp), %edi # dig_vec_upper - testl %ebp,%ebp # Test if value > 0xFFFFFFFF - jne .Llongdiv - cmpl %ebx, %esi # Test if <= radix, for easy loop - movl %esi, %eax # Value in eax (for Llow) - jae .Llow - - # Value is one digit (negative or positive) - movb (%eax,%edi),%bl - movl 108(%esp),%edi # get dst - movb %bl,(%edi) - incl %edi # End null here - jmp .L10_end - -.Llongdiv: - # Value in ebp:esi. div the high part by the radix, - # then div remainder + low part by the radix. - movl %ebp,%eax # edx=0,eax=high(from ebp) - xorl %edx,%edx - decl %ecx - divl %ebx - movl %eax,%ebp # edx=result of last, eax=low(from esi) - movl %esi,%eax - divl %ebx - movl %eax,%esi # ebp:esi = quotient - movb (%edx,%edi),%dl # Store result number in temporary buffer - testl %ebp,%ebp - movb %dl,(%ecx) # store value in buff - ja .Llongdiv # (Higher part of val still > 0) - - .align 4 -.Llow: # Do rest with integer precision - # Value in 0:eax. div 0 + low part by the radix. - xorl %edx,%edx - decl %ecx - divl %ebx - movb (%edx,%edi),%dl # bh is always zero as ebx=radix < 36 - testl %eax,%eax - movb %dl,(%ecx) - jne .Llow - -.L160: - movl 108(%esp),%edi # get dst - -.Lcopy_end: - leal 92(%esp),%esi # End of buffer -.Lmov: # mov temporary buffer to result (%ecx -> %edi) - movb (%ecx), %al - movb %al, (%edi) - incl %ecx - incl %edi - cmpl %ecx,%esi - jne .Lmov - -.L10_end: - movl %edi,%eax # Pointer to end null - movb $0,(%edi) # Store the end null - -.L165: - popl %ebx - popl %edi - popl %esi - popl %ebp - addl $80,%esp - ret - -.Lerror: - xorl %eax,%eax # Wrong radix - jmp .L165 - -.Lfe3: - .size longlong2str_with_dig_vector,.Lfe3-longlong2str_with_dig_vector - -# -# This is almost equal to the above, except that we can do the final -# loop much more efficient -# - - .align 4 - -.globl longlong10_to_str - .type longlong10_to_str,@function -longlong10_to_str: - subl $80,%esp - pushl %ebp - pushl %esi - pushl %edi - pushl %ebx - movl 100(%esp),%esi # Lower part of val - movl 104(%esp),%ebp # Higher part of val - movl 108(%esp),%edi # get dst - movl 112(%esp),%ebx # Radix (10 or -10) - testl %ebx,%ebx - jge .L10_10 # Positive radix - - negl %ebx # Change radix to positive (= 10) - - testl %ebp,%ebp # Test if negative value - jge .L10_10 - movb $45,(%edi) # Add sign - incl %edi - negl %esi # Change sign of val (ebp:esi) - adcl $0,%ebp - negl %ebp - -.L10_10: - leal 92(%esp),%ecx # End of buffer - testl %ebp,%ebp # Test if value > 0xFFFFFFFF - jne .L10_longdiv - cmpl $10, %esi # Test if <= radix, for easy loop - movl %esi, %ebx # Value in eax (for L10_low) - jae .L10_low - - # Value is one digit (negative or positive) - addb $48, %bl - movb %bl,(%edi) - incl %edi - jmp .L10_end - .align 4 - -.L10_longdiv: - # val is stored in in ebp:esi - movl %ebp,%eax # High part of value - xorl %edx,%edx - divl %ebx # Divide by 10 - movl %eax,%ebp - movl %esi,%eax - divl %ebx # Divide by 10 - decl %ecx - movl %eax,%esi # quotent in ebp:esi - addl $48,%edx # Convert to ascii - movb %dl,(%ecx) # store value in buff - -.L10_30: - testl %ebp,%ebp - ja .L10_longdiv - movl %esi,%ebx # Move val to %ebx - -.L10_low: - # The following code uses some tricks to change division by 10 to - # multiplication and shifts - movl $0xcccccccd,%esi - -.L10_40: # Divide %ebx with 10 - movl %ebx,%eax - mull %esi - decl %ecx - shrl $3,%edx - leal (%edx,%edx,4),%eax - addl %eax,%eax - subb %al,%bl # %bl now contains val % 10 - addb $48,%bl - movb %bl,(%ecx) - movl %edx,%ebx - testl %ebx,%ebx - jne .L10_40 - jmp .Lcopy_end # Shared end with longlong2str - -.L10end: - .size longlong10_to_str,.L10end-longlong10_to_str diff --git a/strings/longlong2str_asm.c b/strings/longlong2str_asm.c deleted file mode 100644 index e5628043da6..00000000000 --- a/strings/longlong2str_asm.c +++ /dev/null @@ -1,33 +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 */ - -/* - Wrapper for longlong2str.s - - We need this because the assembler code can't access the local variable - _dig_vector in a portable manner. -*/ - -#include <my_global.h> -#include "m_string.h" - -extern char *longlong2str_with_dig_vector(longlong val,char *dst,int radix, - const char *dig_vector); - -char *ll2str(longlong val,char *dst,int radix, int upcase) -{ - return longlong2str_with_dig_vector(val, dst, radix, - upcase ? _dig_vec_upper : _dig_vec_lower); -} diff --git a/strings/my_strtoll10-x86.s b/strings/my_strtoll10-x86.s deleted file mode 100644 index f73428de7de..00000000000 --- a/strings/my_strtoll10-x86.s +++ /dev/null @@ -1,418 +0,0 @@ -# Copyright (C) 2003 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 - -# Implemention of my_strtoll(): Converting a string to a 64 bit integer. -# For documentation, check my_strtoll.c - - .file "my_strtoll10-x86.s" - .version "01.02" - -.text - .align 4 - -.globl my_strtoll10 - .type my_strtoll10,@function - - - # Used stack variables - # ebp-4 dummy for storing endptr if endptr = 0 - # ebp-8 First 9 digits of return values - # ebp-12 Pointer to first digit of second part - # ebp-16 Store lowest 2 digits - # ebp-20 != 0 if value was negative - # ebp-24 High max value - # ebp-28 Middle max value - # ebp-32 Low max value - # ebp-36 Temp value - - # esi Pointer to input string - # ebx End of string - -my_strtoll10: - pushl %ebp - movl %esp,%ebp - subl $48,%esp - pushl %esi - pushl %edi - pushl %ebx - movl 8(%ebp),%esi # esi= nptr - movl 16(%ebp),%ecx # ecx= error (Will be overwritten later) - movl 12(%ebp),%eax # eax= endptr - cmpl $0,%eax # if (endptr) - je .L110 - -# Fixed length string - movl (%eax),%ebx # bx= end-of-string - .p2align 4,,7 -.L100: - cmpl %ebx,%esi - je .Lno_conv - movb (%esi), %al # al= next byte - incl %esi - cmpb $32,%al # Skip space - je .L100 - cmpb $9,%al # Skip tab - je .L100 - jmp .L130 - -# String that ends with \0 - -.L110: - leal -4(%ebp),%edi - movl %edi,12(%ebp) # endptr= &dummy, for easier end check - .p2align 4,,7 -.L120: - movb (%esi), %al # al= next byte - incl %esi - cmpb $32,%al - je .L120 - cmpb $9,%al - je .L120 - testb %al,%al # Test if we found end \0 - je .Lno_conv - leal 65535(%esi),%ebx # ebx = end-of-string - -.L130: - cmpb $45,%al # Test if '-' - jne .Lpositive - - # negative number - movl $-1,(%ecx) # error = -1 (mark that number is negative) - movl $1,-20(%ebp) # negative= 1 - movl $92233720,-24(%ebp) - movl $368547758,-28(%ebp) - movl $8,-32(%ebp) - jmp .L460 - - .p2align 4,,7 -.Lpositive: - movl $0,(%ecx) # error=0 - movl $0,-20(%ebp) # negative= 0 - movl $184467440,-24(%ebp) - movl $737095516,-28(%ebp) - movl $15,-32(%ebp) - cmpb $43,%al # Check if '+' - jne .L462 - -.L460: - cmpl %ebx,%esi # Check if overflow - je .Lno_conv - movb (%esi), %al # al= next byte after sign - incl %esi - - # Remove pre zero to be able to handle a lot of pre-zero -.L462: - cmpb $48,%al - jne .L475 # Number doesn't start with 0 - decl %esi - .p2align 4,,7 - - # Skip pre zeros -.L481: - incl %esi # Skip processed byte - cmpl %ebx,%esi - je .Lms_return_zero - cmpb (%esi),%al # Test if next byte is also zero - je .L481 - leal 9(%esi),%ecx # ecx = end-of-current-part - xorl %edi,%edi # Store first 9 digits in edi - jmp .L482 - .p2align 4,,7 - - # Check if first char is a valid number -.L475: - addb $-48,%al - cmpb $9,%al - ja .Lno_conv -.L477: - movzbl %al,%edi # edi = first digit - leal 8(%esi),%ecx # ecx = end-of-current-part - - # Handle first 8/9 digits and store them in edi -.L482: - cmpl %ebx,%ecx - jbe .L522 - movl %ebx,%ecx # ecx = min(end-of-current-part, end-of-string) - jmp .L522 - - .p2align 4,,7 -.L488: - movb (%esi), %al # al= next byte - incl %esi - addb $-48,%al - cmpb $9,%al - ja .Lend_i_dec_esi - - # Calculate edi= edi*10 + al - leal (%edi,%edi,4),%edx - movzbl %al,%eax - leal (%eax,%edx,2),%edi -.L522: - cmpl %ecx,%esi # If more digits at this level - jne .L488 - cmpl %ebx,%esi # If end of string - je .Lend_i - - movl %edi,-8(%ebp) # Store first 9 digits - movl %esi,-12(%ebp) # store pos to first digit of second part - - # Calculate next 9 digits and store them in edi - - xorl %edi,%edi - leal 9(%esi),%ecx # ecx= end-of-current-part - movl %ecx,-36(%ebp) # Store max length - cmpl %ebx,%ecx - jbe .L498 - movl %ebx,%ecx # ecx = min(end-of-current-part, end-of-string) - - .p2align 4,,7 -.L498: - movb (%esi), %al # al= next byte - incl %esi - addb $-48,%al - cmpb $9,%al - ja .Lend_i_and_j_decl_esi - - # Calculate edi= edi*10 + al - leal (%edi,%edi,4),%edx - movzbl %al,%eax - leal (%eax,%edx,2),%edi - - cmpl %ecx,%esi # If end of current part - jne .L498 - cmpl %ebx,%esi # If end of string - jne .L500 - cmpl -36(%ebp),%esi # Test if string is less than 18 digits - jne .Lend_i_and_j -.L499: - movl $1000000000,%eax - jmp .Lgot_factor # 18 digit string - - # Handle the possible next to last digit and store in ecx -.L500: - movb (%esi),%al - addb $-48,%al - cmpb $9,%al - ja .L499 # 18 digit string - - incl %esi - movzbl %al,%ecx - cmpl %ebx,%esi # If end of string - je .Lend4 - - movb (%esi),%al # Read last digit - addb $-48,%al - cmpb $9,%al - ja .Lend4 - - # ecx= ecx*10 + al - leal (%ecx,%ecx,4),%edx - movzbl %al,%eax - leal (%eax,%edx,2),%ecx - - movl 12(%ebp),%eax # eax = endptr - incl %esi - movl %esi,(%eax) # *endptr = end-of-string - cmpl %ebx,%esi - je .L505 # At end of string - - movb (%esi),%al # check if extra digits - addb $-48,%al - cmpb $9,%al - jbe .Loverflow - - # At this point we have: - # -8(%ebp) First 9 digits - # edi Next 9 digits - # ecx Last 2 digits - # *endpos end-of-string - -.L505: # Check that we are not going to get overflow for unsigned long long - movl -8(%ebp),%eax # First 9 digits - cmpl -24(%ebp),%eax - ja .Loverflow - jne .L507 - cmpl -28(%ebp),%edi - ja .Loverflow - jne .L507 - cmpl -32(%ebp),%ecx - ja .Loverflow - -.L507: - movl %edi,-4(%ebp) # Save middle bytes - movl %ecx,%esi # esi = 2 last digits - movl $1215752192,%ecx # %ecx= lower_32_bits(100000000000) - mull %ecx - imull $23,-8(%ebp),%ecx - movl $0,-36(%ebp) - movl %eax,%ebx - imull $1215752192,-36(%ebp),%eax - movl %edx,%edi - addl %ecx,%edi - addl %eax,%edi # Temp in edi:ebx - - movl $100,%eax # j= j*100 - mull -4(%ebp) - addl %ebx,%eax # edx:eax+= edi:ebx - adcl %edi,%edx - addl %esi,%eax - adcl $0,%edx - jmp .Lms_return - -.Loverflow: - # When we come here, *endptr is already updated - - movl 16(%ebp),%edx # edx= error - movl $34,(%edx) # *error = 34 - movl $-1,%eax - movl %eax,%edx - cmpl $0,-20(%ebp) # If negative - je .Lms_return - xor %eax,%eax # edx:eax = LONGLONG_LMIN - movl $-2147483648,%edx - jmp .Lms_return - - # Return value that is in %edi as long long - .p2align 4,,7 -.Lend_i_dec_esi: - decl %esi # Fix so that it points at last digit -.Lend_i: - xorl %edx,%edx - movl %edi,%eax - cmpl $0,-20(%ebp) - je .Lreturn_save_endptr # Positive number - negl %eax - cltd # Neg result in edx:eax - jmp .Lreturn_save_endptr - - # Return value (%ebp-8) * lfactor[(uint) (edx-start)] + edi - .p2align 4,,7 -.Lend_i_and_j_decl_esi: - decl %esi # Fix so that it points at last digit -.Lend_i_and_j: - movl %esi,%ecx - subl -12(%ebp),%ecx # ecx= number of digits in second part - - # Calculate %eax= 10 ** %cl, where %cl <= 8 - # With an array one could do this with: - # movl 10_factor_table(,%ecx,4),%eax - # We calculate the table here to avoid problems in - # position independent code (gcc -pic) - - cmpb $3,%cl - ja .L4_to_8 - movl $1000, %eax - je .Lgot_factor # %cl=3, eax= 1000 - movl $10, %eax - cmpb $1,%cl # %cl is here 0 - 2 - je .Lgot_factor # %cl=1, eax= 10 - movl $100, %eax - ja .Lgot_factor # %cl=2, eax=100 - movl $1, %eax - jmp .Lgot_factor # %cl=0, eax=1 - -.L4_to_8: # %cl is here 4-8 - cmpb $5,%cl - movl $100000, %eax - je .Lgot_factor # %cl=5, eax=100000 - movl $10000, %eax - jbe .Lgot_factor # %cl=4, eax=10000 - movl $10000000, %eax - cmpb $7,%cl - je .Lgot_factor # %cl=7, eax=10000000 - movl $100000000, %eax - ja .Lgot_factor # %cl=8, eax=100000000 - movl $1000000, %eax # %cl=6, eax=1000000 - - # Return -8(%ebp) * %eax + edi - .p2align 4,,7 -.Lgot_factor: - mull -8(%ebp) - addl %edi,%eax - adcl $0,%edx - cmpl $0,-20(%ebp) # if negative - je .Lreturn_save_endptr - negl %eax # Neg edx:%eax - adcl $0,%edx - negl %edx - jmp .Lreturn_save_endptr - - # Return -8(%ebp) * $10000000000 + edi*10 + ecx - .p2align 4,,7 -.Lend4: - movl %ecx,-16(%ebp) # store lowest digits - movl 12(%ebp),%ebx - movl %esi,(%ebx) # *endpos = end-of-string - movl -8(%ebp),%eax # First 9 digits - movl $1410065408,%ecx # ecx= lower_32_bits(10000000000) - mull %ecx - movl $0,-36(%ebp) - movl %eax,%ebx # Store lowest 32 byte from multiplication - imull $1410065408,-36(%ebp),%eax - movl -8(%ebp),%ecx # First 9 digits - movl %edx,%esi - addl %ecx,%ecx - addl %ecx,%esi - addl %eax,%esi # %esi:%ebx now has -8(%ebp) * $10000000000 - - movl $10,%eax # Calc edi*10 - mull %edi - addl %ebx,%eax # And add to result - adcl %esi,%edx - addl -16(%ebp),%eax # Add lowest digit - adcl $0,%edx - cmpl $0,-20(%ebp) # if negative - je .Lms_return - - cmpl $-2147483648,%edx # Test if too big signed integer - ja .Loverflow - jne .L516 - testl %eax,%eax - ja .Loverflow - -.L516: - negl %eax - adcl $0,%edx - negl %edx - jmp .Lms_return - - .p2align 4,,7 -.Lno_conv: # Not a legal number - movl 16(%ebp),%eax - movl $33,(%eax) # error= edom - -.Lms_return_zero: - xorl %eax,%eax # Return zero - xorl %edx,%edx - - .p2align 4,,7 -.Lreturn_save_endptr: - movl 12(%ebp),%ecx # endptr= end-of-string - movl %esi,(%ecx) # *endptr= end-of-string - -.Lms_return: - popl %ebx - popl %edi - popl %esi - movl %ebp,%esp - popl %ebp - ret - -.my_strtoll10_end: - .size my_strtoll10,.my_strtoll10_end-my_strtoll10 - .comm res,240,32 - .comm end_ptr,120,32 - .comm error,120,32 - .ident "Monty" diff --git a/strings/str_test.c b/strings/str_test.c deleted file mode 100644 index 7e304fbd10a..00000000000 --- a/strings/str_test.c +++ /dev/null @@ -1,275 +0,0 @@ -/* Copyright (C) 2000-2003 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 */ - -/* Test of all stringfunktions that is coded in assembler */ - -#include <my_global.h> -#include <stdarg.h> -#include "m_string.h" - -#define F_LEN 8 -#define F_CHAR 'A' -#define F_FILL 'B' -#define T_LEN 15 -#define T_CHAR 'D' -#define T_FILL 'E' -#define F_PREFILL '0' -#define T_PREFILL '1' - -static char from_buff[100],to_buff[100]; -static char * from, *to; -static int errors,tests; -static int test_strarg(const char *name,...); -static void init_strings (void); /* Init from and to */ -void test_arg (const char *message,long func_value,long value); -int compare_buff(const char *message,char * b1,char * b2,int length, - pchar fill, pchar prefill); - -static int my_test(int a) -{ - return a ? 1 : 0; -} - -int main(void) -{ - static char v1[]="Monty",v2[]="on",v3[]="Montys",v4[]="ty",v5[]="gr", - v6[]="hohohoo",v7[]="hohoo",v8[]="hohooo",v9[]="t", - cont[]="qwet"; - errors=tests=0; - init_strings(); - - test_arg("memcmp(from,to,5)",(long) my_test(memcmp(from,to,5)),1L); - test_arg("memcmp(from,from,5)",(long) memcmp(from,from,5),0L); - - test_arg("memcmp(from,to,0)",(long) memcmp(from,to,0),0L); - test_arg("strend(from)",(long) strend(from),(long) from+F_LEN); - test_arg("strchr(v1,'M')",(long) strchr(v1,'M'),(long) v1); - test_arg("strchr(v1,'y')",(long) strchr(v1,'y'),(long) v1+4); - test_arg("strchr(v1,'x')",(long) strchr(v1,'x'),0L); - test_arg("strcont(v1,cont)",(long) strcont(v1,cont),(long) v1+3); - test_arg("strcont(v1,v2)",(long) strcont(v1,v2),(long) v1+1); - test_arg("strcont(v1,v5)",(long) strcont(v1,v5),0L); - test_arg("is_prefix(v3,v1)",(long) is_prefix(v3,v1),1L); - test_arg("is_prefix(v1,v3)",(long) is_prefix(v1,v3),0L); - test_arg("is_prefix(v3,v4)",(long) is_prefix(v3,v4),0L); - test_arg("strstr(v1,v1)",(long) strstr(v1,v1),(long) v1); - test_arg("strstr(v1,v2)",(long) strstr(v1,v2),(long) v1+1); - test_arg("strstr(v1,v4)",(long) strstr(v1,v4),(long) v1+3); - test_arg("strstr(v6,v7)",(long) strstr(v6,v7),(long) v6+2); - test_arg("strstr(v1,v9)",(long) strstr(v1,v9),(long) v1+3); - test_arg("strstr(v1,v3)",(long) strstr(v1,v3),0L); - test_arg("strstr(v1,v5)",(long) strstr(v1,v5),0L); - test_arg("strstr(v6,v8)",(long) strstr(v6,v8),0L); - - test_arg("strlen(from)",(long) strlen(from),(long) F_LEN); - test_arg("strlen(\"\")",(long) strlen(""),0L); -#ifdef HAVE_STRNLEN - test_arg("strnlen(from,3)",(long) strnlen(from,3),3L); - test_arg("strnlen(from,0)",(long) strnlen(from,0),0L); - test_arg("strnlen(from,1000)",(long) strnlen(from,1000),(long) F_LEN); -#endif - - test_strarg("bfill(to,4,' ')",(bfill(to,4,' '),0L),INT_MAX32,4,' ',0,0); - test_strarg("bfill(from,0,' ')",(bfill(from,0,' '),0L),INT_MAX32,0,0); - test_strarg("bzero(to,3)",(bzero(to,3),0L),INT_MAX32,3,0,0,0); - test_strarg("bzero(to,0)",(bzero(to,0),0L),INT_MAX32,0,0); - test_strarg("bmove(to,from,4)",(bmove(to,from,4),0L),INT_MAX32,4,F_CHAR, - 0,0); - test_strarg("bmove(to,from,0)",(bmove(to,from,0),0L),INT_MAX32,0,0); - test_strarg("bmove_upp(to+6,from+6,3)",(bmove_upp(to+6,from+6,3),0L),INT_MAX32, - 3,T_CHAR,3,F_CHAR,0,0); - test_strarg("bmove_upp(to,from,0)",(bmove_upp(to,from,0),0L),INT_MAX32,0,0); - test_strarg("memcpy(to,from,8)",(memcpy(to,from,8),0L),INT_MAX32, - 8,F_CHAR,0,0); - test_strarg("strappend(to,3,' ')",(strappend(to,3,' '),0L),INT_MAX32, - 3,T_CHAR,1,0,T_LEN-4,T_CHAR,1,0,0,0); - test_strarg("strappend(to,T_LEN+5,' ')",(strappend(to,T_LEN+5,' '),0L),INT_MAX32, - T_LEN,T_CHAR,5,' ',1,0,0,0); - test_strarg("strcat(to,from)",strcat(to,from),to,T_LEN,T_CHAR, - F_LEN,F_CHAR,1,0,0,0); - test_strarg("strcat(to,\"\")",strcat(to,""),INT_MAX32,0,0); - test_strarg("strfill(to,4,' ')",strfill(to,4,' '),to+4,4,' ',1,0,0,0); - test_strarg("strfill(from,0,' ')",strfill(from,0,' '),from,0,1,0,0); - test_strarg("strmake(to,from,4)",strmake(to,from,4),to+4,4,F_CHAR, - 1,0,0,0); - test_strarg("strmake(to,from,0)",strmake(to,from,0),to+0,1,0,0,0); - test_strarg("strmov(to,from)",strmov(to,from),to+F_LEN,F_LEN,F_CHAR,0,0); - test_strarg("strmov(to,\"\")",strmov(to,""),to,1,0,0,0); - test_strarg("strnmov(to,from,2)",strnmov(to,from,2),to+2,2,F_CHAR,0,0); - test_strarg("strnmov(to,from,F_LEN+5)",strnmov(to,from,F_LEN+5),to+F_LEN, - F_LEN,F_CHAR,1,0,0,0); - test_strarg("strnmov(to,\"\",2)",strnmov(to,"",2),to,1,0,0,0); - test_strarg("strxmov(to,from,\"!!\",NullS)",strxmov(to,from,"!!",NullS),to+F_LEN+2,F_LEN,F_CHAR,2,'!',0,0,0); - test_strarg("strxmov(to,NullS)",strxmov(to,NullS),to,1,0,0,0); - test_strarg("strxmov(to,from,from,from,from,from,'!!',from,NullS)",strxmov(to,from,from,from,from,from,"!!",from,NullS),to+F_LEN*6+2,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,2,'!',F_LEN,F_CHAR,1,0,0,0); - - test_strarg("strxnmov(to,100,from,\"!!\",NullS)",strxnmov(to,100,from,"!!",NullS),to+F_LEN+2,F_LEN,F_CHAR,2,'!',0,0,0); - test_strarg("strxnmov(to,2,NullS)",strxnmov(to,2,NullS),to,1,0,0,0); - test_strarg("strxnmov(to,100,from,from,from,from,from,'!!',from,NullS)",strxnmov(to,100,from,from,from,from,from,"!!",from,NullS),to+F_LEN*6+2,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,2,'!',F_LEN,F_CHAR,1,0,0,0); - test_strarg("strxnmov(to,2,\"!!!\",NullS)",strxnmov(to,2,"!!!",NullS),to+2,2,'!',0,0,0); - test_strarg("strxnmov(to,2,\"!!\",NullS)",strxnmov(to,2,"!!","xx",NullS),to+2,2,'!',0,0,0); - test_strarg("strxnmov(to,2,\"!\",\"x\",\"y\",NullS)",strxnmov(to,2,"!","x","y",NullS),to+2,1,'!',1,'x',0,0,0); - - test_strarg("bchange(to,2,from,4,6)",(bchange(to,2,from,4,6),0L),INT_MAX32, - 4,F_CHAR,2,T_CHAR,0,0); - - printf("tests: %d errors: %d\n",tests,errors); - if (errors) - fputs("--- Some functions doesn't work!! Fix them\n",stderr); - return(errors > 0); -} /* main */ - - - /* Init strings */ - -void init_strings(void) -{ - reg1 int i; - reg2 char *pos; - - from=from_buff+3; to=to_buff+3; - - pos=from_buff; *pos++= F_FILL; *pos++=F_FILL; *pos++=F_PREFILL; - for (i=0 ; i < F_LEN ; i++) - *pos++=F_CHAR; - *pos++=0; - for (i=0; i<50 ; i++) - *pos++= F_FILL; - - pos=to_buff; *pos++= T_FILL; *pos++=T_FILL; *pos++=T_PREFILL; - for (i=0 ; i < T_LEN ; i++) - *pos++=T_CHAR; - *pos++=0; - for (i=0; i<50 ; i++) - *pos++= T_FILL; -} /* init_strings */ - - - /* Test that function return rigth value */ - -void test_arg(const char *message, long int func_value, long int value) -{ - tests++; - printf("testing '%s'\n",message); - if (func_value != value) - { - printf("func: '%s' = %ld Should be: %ld\n",message,func_value,value); - errors++; - } -} /* test_arg */ - - /* Test function return value and from and to arrays */ - -static int test_strarg(const char *message,...) -{ - long func_value,value; - int error,length; - char chr,cmp_buff[100],*pos,*pos2; - va_list pvar; - - tests++; - va_start(pvar,message); - func_value=va_arg(pvar,long); - value=va_arg(pvar,long); - - printf("testing '%s'\n",message); - if (func_value != value && value != INT_MAX32) - { - printf("func: '%s' = %ld Should be: %ld\n",message,func_value,value); - errors++; - } - pos= cmp_buff; - while ((length = va_arg(pvar, int)) != 0) - { - chr= (char) (va_arg(pvar, int)); - while (length--) - *pos++=chr; - } - pos2=to+ (int)(pos-cmp_buff); - while (pos <= cmp_buff+T_LEN) - *pos++= *pos2++; - if (compare_buff(message,to,cmp_buff,(int) (pos-cmp_buff),T_FILL,T_PREFILL)) - { - init_strings(); - va_end(pvar); - return 1; - } - - pos= cmp_buff; - while ((length = va_arg(pvar, int)) != 0) - { - chr= (char) (va_arg(pvar, int)); - while (length--) - *pos++=chr; - } - pos2=from+ (int)(pos-cmp_buff); - while (pos <= cmp_buff+F_LEN) - *pos++= *pos2++; - error=compare_buff(message,from,cmp_buff,(int) (pos-cmp_buff),F_FILL,F_PREFILL); - init_strings(); - va_end(pvar); - return (error != 0); -} /* test_strarg */ - - - /* test if function made right value */ - -int compare_buff(const char *message, char * b1, char * b2, int length, - pchar fill, pchar prefill) -{ - int i,error=0; - - if (memcmp(b1,b2,length)) - { - errors++; - printf("func: '%s' Buffers differ\nIs: ",message); - for (i=0 ; i<length ; i++) - printf("%3d ",b1[i]); - printf("\nShould be: "); - for (i=0 ; i<length ; i++) - printf("%3d ",b2[i]); - puts(""); - } - else if (b1[-1] != prefill || b1[-2] != fill || b1[-3] != fill) - { - printf("func: '%s' Chars before buffer is changed\n",message); - errors++; - error=1; - } - else if (b1[length] != fill || b1[length+1] != fill) - { - printf("func: '%s' Chars after buffer is changed\n",message); - errors++; - error=1; - } - return error; -} /* compare_buff */ - - /* These are here to be loaded and examined */ - -extern void dummy_functions(void); - -void dummy_functions(void) -{ - (void) memchr(from,'a',5); - (void) memcmp(from,to,5); - (void) memcpy(from,to,5); - (void) memset(from,' ',5); - (void) strcmp(from,to); - (void) strcpy(from,to); - (void) strstr(from,to); - (void) strrchr(from,'a'); - return; -} diff --git a/strings/strings-x86.s b/strings/strings-x86.s deleted file mode 100644 index 4872c566685..00000000000 --- a/strings/strings-x86.s +++ /dev/null @@ -1,393 +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 - -# Optimized string functions Intel 80x86 (gcc/gas syntax) - - .file "strings.s" - .version "1.00" - -.text - -# Move a alligned, not overlapped, by (long) divided memory area -# Args: to,from,length - -.globl bmove_align - .type bmove_align,@function -bmove_align: - movl %edi,%edx - push %esi - movl 4(%esp),%edi # to - movl 8(%esp),%esi # from - movl 12(%esp),%ecx # length - addw $3,%cx # fix if not divisible with long - shrw $2,%cx - jz .ba_20 - .p2align 4,,7 -.ba_10: - movl -4(%esi,%ecx),%eax - movl %eax,-4(%edi,%ecx) - decl %ecx - jnz .ba_10 -.ba_20: pop %esi - movl %edx,%edi - ret - -.bmove_align_end: - .size bmove_align,.bmove_align_end-bmove_align - - # Move a string from higher to lower - # Arg from_end+1,to_end+1,length - -.globl bmove_upp - .type bmove_upp,@function -bmove_upp: - movl %edi,%edx # Remember %edi - push %esi - movl 8(%esp),%edi # dst - movl 16(%esp),%ecx # length - movl 12(%esp),%esi # source - test %ecx,%ecx - jz .bu_20 - subl %ecx,%esi # To start of strings - subl %ecx,%edi - - .p2align 4,,7 -.bu_10: movb -1(%esi,%ecx),%al - movb %al,-1(%edi,%ecx) - decl %ecx - jnz .bu_10 -.bu_20: pop %esi - movl %edx,%edi - ret - -.bmove_upp_end: - .size bmove_upp,.bmove_upp_end-bmove_upp - - # Append fillchars to string - # Args: dest,len,fill - -.globl strappend - .type strappend,@function -strappend: - pushl %edi - movl 8(%esp),%edi # Memory pointer - movl 12(%esp),%ecx # Length - clrl %eax # Find end of string - repne - scasb - jnz sa_99 # String to long, shorten it - movzb 16(%esp),%eax # Fillchar - decl %edi # Point at end null - incl %ecx # rep made one dec for null-char - - movb %al,%ah # (2) Set up a 32 bit pattern. - movw %ax,%dx # (2) - shll $16,%eax # (3) - movw %dx,%ax # (2) %eax has the 32 bit pattern. - - movl %ecx,%edx # (2) Save the count of bytes. - shrl $2,%ecx # (2) Number of dwords. - rep - stosl # (5 + 5n) - movb $3,%cl # (2) - and %edx,%ecx # (2) Fill in the odd bytes - rep - stosb # Move last bytes if any - -sa_99: movb $0,(%edi) # End of string - popl %edi - ret -.strappend_end: - .size strappend,.strappend_end-strappend - - # Find if string contains any char in another string - # Arg: str,set - # Ret: Pointer to first found char in str - -.globl strcont - .type strcont,@function -strcont: - movl %edi,%edx - pushl %esi - movl 8(%esp),%esi # str - movl 12(%esp),%ecx # set - clrb %ah # For endtest - jmp sc_60 - -sc_10: scasb - jz sc_fo # Found char -sc_20: cmp (%edi),%ah # Test if null - jnz sc_10 # Not end of set yet - incl %esi # Next char in str -sc_60: movl %ecx,%edi # %edi = Set - movb (%esi),%al # Test if this char exist - andb %al,%al - jnz sc_20 # Not end of string - clrl %esi # Return Null -sc_fo: movl %esi,%eax # Char found here - movl %edx,%edi # Restore - popl %esi - ret -.strcont_end: - .size strcont,.strcont_end-strcont - - # Find end of string - # Arg: str - # ret: Pointer to end null - -.globl strend - .type strend,@function -strend: - movl %edi,%edx # Save - movl 4(%esp),%edi # str - clrl %eax # Find end of string - movl %eax,%ecx - decl %ecx # ECX = -1 - repne - scasb - movl %edi,%eax - decl %eax # End of string - movl %edx,%edi # Restore - ret -.strend_end: - .size strend,.strend_end-strend - - # Make a string with len fill-chars and endnull - # Args: dest,len,fill - # Ret: dest+len - -.globl strfill - .type strfill,@function -strfill: - pushl %edi - movl 8(%esp),%edi # Memory pointer - movl 12(%esp),%ecx # Length - movzb 16(%esp),%eax # Fill - - movb %al,%ah # (2) Set up a 32 bit pattern - movw %ax,%dx # (2) - shll $16,%eax # (3) - movw %dx,%ax # (2) %eax has the 32 bit pattern. - - movl %ecx,%edx # (2) Save the count of bytes. - shrl $2,%ecx # (2) Number of dwords. - rep - stosl # (5 + 5n) - movb $3,%cl # (2) - and %edx,%ecx # (2) Fill in the odd bytes - rep - stosb # Move last bytes if any - - movb %cl,(%edi) # End NULL - movl %edi,%eax # End i %eax - popl %edi - ret -.strfill_end: - .size strfill,.strfill_end-strfill - - - # Find a char in or end of a string - # Arg: str,char - # Ret: pointer to found char or NullS - -.globl strcend - .type strcend,@function -strcend: - movl %edi,%edx - movl 4(%esp),%edi # str - movb 8(%esp),%ah # search - clrb %al # for scasb to find end - -se_10: cmpb (%edi),%ah - jz se_20 # Found char - scasb - jnz se_10 # Not end - dec %edi # Not found, point at end of string -se_20: movl %edi,%eax - movl %edx,%edi # Restore - ret -.strcend_end: - .size strcend,.strcend_end-strcend - - # Test if string has a given suffix - -.globl is_prefix - .type is_prefix,@function -is_prefix: - movl %edi,%edx # Save %edi - pushl %esi # and %esi - movl 12(%esp),%esi # get suffix - movl 8(%esp),%edi # s1 - movl $1,%eax # Ok and zero-test -ip_10: cmpb (%esi),%ah - jz suf_ok # End of string/ found suffix - cmpsb # Compare strings - jz ip_10 # Same, possible prefix - xor %eax,%eax # Not suffix -suf_ok: popl %esi - movl %edx,%edi - ret -.is_prefix_end: - .size is_prefix,.is_prefix_end-is_prefix - - # Find a substring in string - # Arg: str,search - -.globl strstr - .type strstr,@function - -strstr: - pushl %edi - pushl %esi - movl 12(%esp),%esi # str - movl 16(%esp),%edi # search - movl %edi,%ecx - incl %ecx # %ecx = search+1 - movb (%edi),%ah # %ah = First char in search - jmp sf_10 - -sf_00: movl %edx,%esi # si = Current str-pos -sf_10: movb (%esi),%al # Test if this char exist - andb %al,%al - jz sf_90 # End of string, didn't find search - incl %esi - cmpb %al,%ah - jnz sf_10 # Didn't find first char, continue - movl %esi,%edx # Save str-pos in %edx - movl %ecx,%edi -sf_20: cmpb $0,(%edi) - jz sf_fo # Found substring - cmpsb - jz sf_20 # Char ok - jmp sf_00 # Next str-pos - -sf_90: movl $1,%edx # Return Null -sf_fo: movl %edx,%eax # Char found here - decl %eax # Pointed one after - popl %esi - popl %edi - ret -.strstr_end: - .size strstr,.strstr_end-strstr - - # Make a string of len length from another string - # Arg: dst,src,length - # ret: end of dst - -.globl strmake - .type strmake,@function - -strmake: - pushl %edi - pushl %esi - mov 12(%esp),%edi # dst - movl $0,%edx - movl 20(%esp),%ecx # length - movl 16(%esp),%esi # src - cmpl %edx,%ecx - jz sm_90 -sm_00: movb (%esi,%edx),%al - cmpb $0,%al - jz sm_90 - movb %al,(%edi,%edx) - incl %edx - cmpl %edx,%ecx - jnz sm_00 -sm_90: movb $0,(%edi,%edx) -sm_99: lea (%edi,%edx),%eax # Return pointer to end null - pop %esi - pop %edi - ret -.strmake_end: - .size strmake,.strmake_end-strmake - - # Move a string with max len chars - # arg: dst,src,len - # ret: pos to first null or dst+len - -.globl strnmov - .type strnmov,@function -strnmov: - pushl %edi - pushl %esi - movl 12(%esp),%edi # dst - movl 16(%esp),%esi # src - movl 20(%esp),%ecx # Length of memory-area - jecxz snm_99 # Nothing to do - clrb %al # For test of end-null - -snm_10: cmpb (%esi),%al # Next char to move - movsb # move arg - jz snm_20 # last char, fill with null - loop snm_10 # Continue moving - incl %edi # Point two after last -snm_20: decl %edi # Point at first null (or last+1) -snm_99: movl %edi,%eax # Pointer at last char - popl %esi - popl %edi - ret -.strnmov_end: - .size strnmov,.strnmov_end-strnmov - - -.globl strmov - .type strmov,@function -strmov: - movl %esi,%ecx # Save old %esi and %edi - movl %edi,%edx - movl 8(%esp),%esi # get source pointer (s2) - movl 4(%esp),%edi # %edi -> s1 -smo_10: movb (%esi),%al - movsb # move arg - andb %al,%al - jnz smo_10 # Not last - movl %edi,%eax - dec %eax - movl %ecx,%esi # Restore - movl %edx,%edi - ret -.strmov_end: - .size strmov,.strmov_end-strmov - -.globl strxmov - .type strxmov,@function -strxmov: - movl %ebx,%edx # Save %ebx, %esi and %edi - mov %esi,%ecx - push %edi - leal 8(%esp),%ebx # Get destination - movl (%ebx),%edi - xorb %al,%al - jmp next_str # Handle source ebx+4 - -start_str: - movsb - cmpb -1(%edi),%al - jne start_str - decl %edi # Don't copy last null - -next_str: - addl $4,%ebx - movl (%ebx),%esi - orl %esi,%esi - jne start_str - movb %al,0(%edi) # Force last to ASCII 0 - - movl %edi,%eax # Return ptr to ASCII 0 - pop %edi # Restore registers - movl %ecx,%esi - movl %edx,%ebx - ret -.strxmov_end: - .size strxmov,.strxmov_end-strxmov diff --git a/strings/strstr.c b/strings/strstr.c deleted file mode 100644 index a5b50d12043..00000000000 --- a/strings/strstr.c +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (C) 2002 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 : strstr.c - Author : Monty - Updated: 1986.11.24 - Defines: strstr() - - strstr(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 is a pointer to the first character of the located instance, - or NullS if pat does not occur in src. - -*/ - -#include <my_global.h> -#include "m_string.h" - -#ifndef HAVE_STRSTR - -char *strstr(register const char *str,const char *search) -{ - register char *i,*j; - register char first= *search; - -skip: - while (*str != '\0') { - if (*str++ == first) { - i=(char*) str; j=(char*) search+1; - while (*j) - if (*i++ != *j++) goto skip; - return ((char*) str-1); - } - } - return ((char*) 0); -} /* strstr */ - -#endif diff --git a/strings/strto.c b/strings/strto.c deleted file mode 100644 index fcb0d800b81..00000000000 --- a/strings/strto.c +++ /dev/null @@ -1,209 +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 */ - -/* - strtol,strtoul,strtoll,strtoull - convert string to long, unsigned long, long long or unsigned long long. - strtoxx(char *src,char **ptr,int base) - converts the string pointed to by src to an long of appropriate long and - returnes it. It skips leading spaces and tabs (but not newlines, formfeeds, - backspaces), then it accepts an optional sign and a sequence of digits - in the specified radix. - If the value of ptr is not (char **)NULL, a pointer to the character - terminating the scan is returned in the location pointed to by ptr. - Trailing spaces will NOT be skipped. - - If an error is detected, the result will be LONG_MIN, 0 or LONG_MAX, - (or LONGLONG..) and errno will be set to - EDOM if there are no digits - ERANGE if the result would overflow. - the ptr will be set to src. - This file is based on the strtol from the the GNU C Library. - it can be compiled with the UNSIGNED and/or LONGLONG flag set -*/ - - -#if !defined(_global_h) || !defined(_m_string_h) -# error Calling file must include 'my_global.h' and 'm_string.h' - /* see 'strtoll.c' and 'strtoull.c' for the reasons */ -#endif - -#include "m_ctype.h" -#include "my_sys.h" /* defines errno */ -#include <errno.h> - -#undef strtoull -#undef strtoll -#undef strtoul -#undef strtol -#ifdef USE_LONGLONG -#define UTYPE_MAX (~(ulonglong) 0) -#define TYPE_MIN LONGLONG_MIN -#define TYPE_MAX LONGLONG_MAX -#define longtype longlong -#define ulongtype ulonglong -#ifdef USE_UNSIGNED -#define function ulongtype strtoull -#else -#define function longtype strtoll -#endif -#else -#define UTYPE_MAX (ulong) ~0L -#define TYPE_MIN LONG_MIN -#define TYPE_MAX LONG_MAX -#define longtype long -#define ulongtype unsigned long -#ifdef USE_UNSIGNED -#define function ulongtype strtoul -#else -#define function longtype strtol -#endif -#endif - - -/* Convert NPTR to an `unsigned long int' or `long int' in base BASE. - If BASE is 0 the base is determined by the presence of a leading - zero, indicating octal or a leading "0x" or "0X", indicating hexadecimal. - If BASE is < 2 or > 36, it is reset to 10. - If ENDPTR is not NULL, a pointer to the character after the last - one converted is stored in *ENDPTR. */ - - -function (const char *nptr,char **endptr,int base) -{ - int negative; - register ulongtype cutoff; - register unsigned int cutlim; - register ulongtype i; - register const char *s; - register uchar c; - const char *save; - int overflow; - - if (base < 0 || base == 1 || base > 36) - base = 10; - - s = nptr; - - /* Skip white space. */ - while (my_isspace(&my_charset_latin1, *s)) - ++s; - if (*s == '\0') - { - goto noconv; - } - - /* Check for a sign. */ - negative= 0; - if (*s == '-') - { - negative = 1; - ++s; - } - else if (*s == '+') - { - ++s; - } - - - if (base == 16 && s[0] == '0' && my_toupper (&my_charset_latin1, s[1]) == 'X') - s += 2; - - /* If BASE is zero, figure it out ourselves. */ - if (base == 0) - { - if (*s == '0') - { - if (my_toupper (&my_charset_latin1, s[1]) == 'X') - { - s += 2; - base = 16; - } - else - base = 8; - } - else - base = 10; - } - - /* Save the pointer so we can check later if anything happened. */ - save = s; - - cutoff = UTYPE_MAX / (unsigned long int) base; - cutlim = (uint) (UTYPE_MAX % (unsigned long int) base); - - overflow = 0; - i = 0; - for (c = *s; c != '\0'; c = *++s) - { - if (my_isdigit (&my_charset_latin1, c)) - c -= '0'; - else if (my_isalpha (&my_charset_latin1, c)) - c = my_toupper (&my_charset_latin1, c) - 'A' + 10; - else - break; - if (c >= base) - break; - /* Check for overflow. */ - if (i > cutoff || (i == cutoff && c > cutlim)) - overflow = 1; - else - { - i *= (ulongtype) base; - i += c; - } - } - - /* Check if anything actually happened. */ - if (s == save) - goto noconv; - - /* Store in ENDPTR the address of one character - past the last character we converted. */ - if (endptr != NULL) - *endptr = (char *) s; - -#ifndef USE_UNSIGNED - /* Check for a value that is within the range of - `unsigned long int', but outside the range of `long int'. */ - if (negative) - { - if (i > (ulongtype) TYPE_MIN) - overflow = 1; - } - else if (i > (ulongtype) TYPE_MAX) - overflow = 1; -#endif - - if (overflow) - { - my_errno=ERANGE; -#ifdef USE_UNSIGNED - return UTYPE_MAX; -#else - return negative ? TYPE_MIN : TYPE_MAX; -#endif - } - - /* Return the result of the appropriate sign. */ - return (negative ? -((longtype) i) : (longtype) i); - -noconv: - /* There was no number to convert. */ - my_errno=EDOM; - if (endptr != NULL) - *endptr = (char *) nptr; - return 0L; -} diff --git a/strings/strtol.c b/strings/strtol.c deleted file mode 100644 index 2f0a5286ee9..00000000000 --- a/strings/strtol.c +++ /dev/null @@ -1,28 +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 */ - -/* This implements strtol() if needed */ - -/* - These includes are mandatory because they check for type sizes and - functions, especially they handle tricks for Tru64 where 'long' is - 64 bit already and our 'longlong' is just a 'long'. - */ -#include <my_global.h> -#include <m_string.h> - -#if !defined(HAVE_STRTOL) && !defined(__WIN__) -#include "strto.c" -#endif diff --git a/strings/strtoll.c b/strings/strtoll.c deleted file mode 100644 index cfb6fbd75ee..00000000000 --- a/strings/strtoll.c +++ /dev/null @@ -1,33 +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 */ - -/* This implements strtoll() if needed */ - - -/* - These includes are mandatory because they check for type sizes and - functions, especially they handle tricks for Tru64 where 'long' is - 64 bit already and our 'longlong' is just a 'long'. - This solves a problem on Tru64 where the C99 compiler has a prototype - for 'strtoll()' but no implementation, see "6.1 New C99 library functions" - in file '/usr/share/doclib/cc.dtk/release_notes.txt'. - */ -#include <my_global.h> -#include <m_string.h> - -#if !defined(HAVE_STRTOLL) && defined(HAVE_LONG_LONG) -#define USE_LONGLONG -#include "strto.c" -#endif diff --git a/strings/strtoul.c b/strings/strtoul.c deleted file mode 100644 index df5c46c220f..00000000000 --- a/strings/strtoul.c +++ /dev/null @@ -1,29 +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 */ - -/* This implements strtol() if needed */ - -/* - These includes are mandatory because they check for type sizes and - functions, especially they handle tricks for Tru64 where 'long' is - 64 bit already and our 'longlong' is just a 'long'. - */ -#include <my_global.h> -#include <m_string.h> - -#if !defined(HAVE_STRTOUL) -#define USE_UNSIGNED -#include "strto.c" -#endif diff --git a/strings/strtoull.c b/strings/strtoull.c deleted file mode 100644 index 94bf6904f8d..00000000000 --- a/strings/strtoull.c +++ /dev/null @@ -1,34 +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 */ - -/* This implements strtoull() if needed */ - - -/* - These includes are mandatory because they check for type sizes and - functions, especially they handle tricks for Tru64 where 'long' is - 64 bit already and our 'longlong' is just a 'long'. - This solves a problem on Tru64 where the C99 compiler has a prototype - for 'strtoull()' but no implementation, see "6.1 New C99 library functions" - in file '/usr/share/doclib/cc.dtk/release_notes.txt'. - */ -#include <my_global.h> -#include <m_string.h> - -#if !defined(HAVE_STRTOULL) && defined(HAVE_LONG_LONG) -#define USE_UNSIGNED -#define USE_LONGLONG -#include "strto.c" -#endif |