summaryrefslogtreecommitdiffstats
path: root/lib/libc/i386/string/memchr.S
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1994-11-25 04:11:19 +0000
committerdg <dg@FreeBSD.org>1994-11-25 04:11:19 +0000
commitfa43022815e442e55f48414a5ae8923e84980912 (patch)
tree765efc0b16c0ca4f3d0f4f8ee4623280ea6852dd /lib/libc/i386/string/memchr.S
parent885bd2dad5b99aeb3dca43beaf5bc770e19a299d (diff)
downloadFreeBSD-src-fa43022815e442e55f48414a5ae8923e84980912.zip
FreeBSD-src-fa43022815e442e55f48414a5ae8923e84980912.tar.gz
Fixed bugs related to returning NULL if length is zero.
Diffstat (limited to 'lib/libc/i386/string/memchr.S')
-rw-r--r--lib/libc/i386/string/memchr.S7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libc/i386/string/memchr.S b/lib/libc/i386/string/memchr.S
index 12a9298..a1b2bcc 100644
--- a/lib/libc/i386/string/memchr.S
+++ b/lib/libc/i386/string/memchr.S
@@ -27,11 +27,11 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: memchr.S,v 1.1 1994/08/05 01:18:28 wollman Exp $
+ * $Id: memchr.S,v 1.2 1994/10/27 11:36:11 bde Exp $
*/
#if defined(LIBC_RCS) && !defined(lint)
- .asciz "$Id: memchr.S,v 1.1 1994/08/05 01:18:28 wollman Exp $"
+ .asciz "$Id: memchr.S,v 1.2 1994/10/27 11:36:11 bde Exp $"
#endif /* LIBC_RCS and not lint */
#include "DEFS.h"
@@ -49,7 +49,8 @@ ENTRY(memchr)
movl 8(%esp),%edi /* string address */
movl 12(%esp),%eax /* set character to search for */
movl 16(%esp),%ecx /* set length of search */
- testl %edi,%edi /* clear Z flag, for len == 0 */
+ testl %ecx,%ecx /* return NULL if len == 0 */
+ jz L1
cld /* set search forward */
repne /* search! */
scasb
OpenPOWER on IntegriCloud