|
Last change
on this file since 16badfe was b28a12e, checked in by Thomas Lopatic <thomas@…>, 8 years ago |
|
Zero redundant declarations.
|
-
Property mode
set to
100644
|
|
File size:
637 bytes
|
| Rev | Line | |
|---|
| [f40a309] | 1 | /*
|
|---|
| 2 | =============================================================================
|
|---|
| 3 | memccpy.c -- copy bytes until character seen
|
|---|
| 4 | Version 1 -- 1987-06-12
|
|---|
| 5 |
|
|---|
| [5c13d64] | 6 | Copy vp2 to vp1, stopping if character c is copied.
|
|---|
| [f40a309] | 7 | Copy no more than n bytes.
|
|---|
| 8 | Return a pointer to the byte after character c in the copy,
|
|---|
| 9 | or NULL if c is not found in the first n bytes.
|
|---|
| 10 | =============================================================================
|
|---|
| 11 | */
|
|---|
| 12 |
|
|---|
| [b28a12e] | 13 | #include "ram.h"
|
|---|
| [6262b5c] | 14 |
|
|---|
| [7258c6a] | 15 | void *memccpy(void *vp1, void *vp2, int8_t c, int16_t n)
|
|---|
| [f40a309] | 16 | {
|
|---|
| [7258c6a] | 17 | int8_t *cp1 = vp1;
|
|---|
| 18 | int8_t *cp2 = vp2;
|
|---|
| [5c13d64] | 19 |
|
|---|
| 20 | while (--n >= 0)
|
|---|
| 21 | if ((*cp1++ = *cp2++) == c)
|
|---|
| 22 | return(cp1);
|
|---|
| 23 |
|
|---|
| 24 | return((void *)0);
|
|---|
| [f40a309] | 25 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.