This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [resend] memccpy() question


Jes Sorensen <jes at trained-monkey dot org> writes:

|> My question is: Is it reasonable to say that memccpy() has a free go at
|> touching the entire source string as specified by the len argument or is
|> it valid to expect that you can specify a random length as long as the
|> character searched for is within the valid area?

>From the POSIX description:

    The memccpy() function shall copy bytes from memory area s2 into s1,
    stopping after the first occurrence of byte c (converted to an
    unsigned char) is copied, or after n bytes are copied, whichever comes
    first.

I'd conclude that memccpy must not touch the memory after the character.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab at suse dot de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]