mirror of
git://sourceware.org/git/glibc.git
synced 2024-11-21 01:12:26 +08:00
entered into RCS
This commit is contained in:
parent
3120ef0231
commit
1cc063a780
@ -22,17 +22,24 @@ Cambridge, MA 02139, USA. */
|
||||
#define SYS_brk 17
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GNU_LD
|
||||
#define __end _end
|
||||
#endif
|
||||
|
||||
.data
|
||||
.globl ___curbrk
|
||||
___curbrk:
|
||||
#ifdef __GNU_STAB__
|
||||
.long ___end
|
||||
#else
|
||||
.long _end
|
||||
#endif
|
||||
.long __end
|
||||
|
||||
.text
|
||||
SYSCALL__ (brk)
|
||||
movl r0, ___curbrk
|
||||
ENTRY (__brk)
|
||||
cmpl 4(ap), __end
|
||||
bgeq 0f
|
||||
movl __env, 4(ap)
|
||||
0: chmk $SYS_brk
|
||||
bcs 1f
|
||||
movl 4(ap), ___curbrk
|
||||
clrl r0
|
||||
ret
|
||||
1:
|
||||
jmp syscall_error
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -22,22 +22,22 @@ Cambridge, MA 02139, USA. */
|
||||
|
||||
/* Copy no more than N bytes of SRC to DEST, stopping when C is found.
|
||||
Return the position in DEST one byte past where C was copied,
|
||||
or NULL if C was not found in the first NBYTES bytes of SRC. */
|
||||
or NULL if C was not found in the first N bytes of SRC. */
|
||||
PTR
|
||||
DEFUN(__memccpy, (dest, src, c, n),
|
||||
PTR dest AND CONST PTR src AND int c AND size_t nbytes)
|
||||
{
|
||||
/* Except when NBYTES > 65535, this is what a hand-coded version would
|
||||
/* Except when N > 65535, this is what a hand-coded version would
|
||||
do anyway. */
|
||||
|
||||
PTR found = memchr(src, c, n);
|
||||
PTR found = memchr (src, c, n);
|
||||
|
||||
if (found == NULL)
|
||||
{
|
||||
(void) memcpy(dest, src, n);
|
||||
(void) memcpy (dest, src, n);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
(void) memcpy(dest, src, (char *) found + 1 - (char *) src);
|
||||
(void) memcpy (dest, src, (char *) found + 1 - (char *) src);
|
||||
return (PTR) ((char *) dest + ((char *) found + 1 - (char *) src));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user